2019/01/25

CORSAIR SCIMITAR RGB PRO update firmware 2.04 to 3.04 failed

今天無意間看到韌體版本有新版本3.04可以下載
心血來潮更新看看沒想到糊里糊塗搞了兩個小時

不過在此發現更新失敗時iCUE上沒有偵測到滑鼠
將軟體重開或重插拔滑鼠又出現了
也嘗試安裝過舊的版本去更新也是一樣的結果

思考後覺得問題可能是開啟SDK造成程序衝突
將其關閉重插拔滑鼠,在更新就成功了

也曾向官方客服尋求解決方案,在此列出給各位參考

不過我不會採用CCleaner這個方案就是了XD

2018/08/13

Python multiprocessing and thread


Thread

import threading
from datetime import datetime


def show(n, s):
    total = 0
    from random import random
    for i in range(n):
        total += i
    print('total={} start={} end={}'.format(total, str(s), str(datetime.now())))

if __name__ == "__main__":
    max = 1000

    jobs = []
    for index in range(4):
        s = datetime.now()
        jobs.append(threading.Thread(target=show, args=[max, s]))

    for index in range(4):
        jobs[index].start()

    for index in range(4):
        jobs[index].join()



total=499500 start=2018-08-13 14:32:26.588980 end=2018-08-13 14:32:26.590985
total=499500 start=2018-08-13 14:32:26.588980 end=2018-08-13 14:32:26.591987
total=499500 start=2018-08-13 14:32:26.589481 end=2018-08-13 14:32:26.592990
total=499500 start=2018-08-13 14:32:26.589481 end=2018-08-13 14:32:26.593993

Python install Parse Server API

先用Github fork「ParsePy」修改connection.py的24行



API_ROOT = os.environ.get('PARSE_API_ROOT') or 'https://api.parse.com/1'
修改成
API_ROOT = os.environ.get('PARSE_API_ROOT')

用pip進行安裝
sudo pip3 install git+https://github.com/xxxxxx/ParsePy.git


import os
os.environ["PARSE_API_ROOT"] = "https://your.domain.com/parse"
import datetime
from parse_rest.datatypes import Object
from parse_rest.connection import register

class Student(Object):
    pass



APPLICATION_ID = 'AppID'
REST_API_KEY = 'RestKey'
MASTER_KEY = 'MasterKey'

register(APPLICATION_ID, REST_API_KEY, master_key=MASTER_KEY)
s = Student.Query.get(objectId='xxxxaaaa10')
s.name = "C.Y.Fang"
s.math = 60
s.eng = 50
s.cht = 61
s.save()



參考資料:
https://github.com/milesrichardson/ParsePy

Raspberry Pi Startup run Python script



sudo chmod 755 xxx.py

sudo nano /etc/rc.local


#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

# Print the IP address
_IP=$(hostname -I) || true
if [ "$_IP" ]; then
  printf "My IP address is %s\n" "$_IP"
fi
sudo python xxx.py
exit 0

2018/08/04

Install BlueZ on the Raspberry Pi


sudo systemctl stop bluetooth
sudo apt-get update
sudo apt-get install libusb-dev libdbus-1-dev libglib2.0-dev libudev-dev libical-dev libreadline-dev libdbus-glib-1-dev unzip libcap2-bin
wget http://www.kernel.org/pub/linux/bluetooth/bluez-5.44.tar.xz
tar xf bluez-5.44.tar.xz
mv bluez-5.44 bluez
cd bluez
./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --enable-library
make
sudo make install
sudo ln -svf /usr/libexec/bluetooth/bluetoothd /usr/sbin/
sudo install -v -dm755 /etc/bluetooth
sudo install -v -m644 src/main.conf /etc/bluetooth/main.conf
sudo systemctl daemon-reload
sudo systemctl start bluetooth
bluetoothd --version
sudo setcap 'cap_net_raw,cap_net_admin+eip' `which hcitool`
getcap !$

參考資料:
https://github.com/getsenic/gatt-python
Bluetooth LE scan as non root?