Difference between revisions of "Pi"
(Created page with "default user pi passwd raspberry") |
|||
Line 1: | Line 1: | ||
default | ===default=== | ||
user pi | user pi | ||
passwd raspberry | passwd raspberry | ||
==bluetooth 4.0 LE== | |||
http://www.ioncannon.net/linux/1570/bluetooth-4-0-le-on-raspberry-pi-with-bluez-5-x/ | |||
http://www.elinux.org/RPi_Bluetooth_LE | |||
{{:python}} |
Revision as of 08:34, 28 April 2015
default
user pi passwd raspberry
bluetooth 4.0 LE
http://www.ioncannon.net/linux/1570/bluetooth-4-0-le-on-raspberry-pi-with-bluez-5-x/
http://www.elinux.org/RPi_Bluetooth_LE
python
jupyter on python3
is installed in omen www/environments/jup
tim@omen:/d/fs/www/environments$ pyvenv jup tim@omen:/d/fs/www$ cd environments/ tim@omen:/d/fs/www/environments$ . jup/bin/activate (jup) tim@omen:/d/fs/www/environments$ jupyter notebook (jup) tim@omen:/d/fs/www/environments/jup/bin$ deactivate
accessing object properties
status ={} status['pond'] = {'spot': 'center', 'state': 'off', 'tleft': 0, 'nexton': 9}
status['pond']['tleft']= 16
parsing u'5'
basic tutorial
running app forever - supervisorctl
cascada
- port = 8087
- /home/pi/mypi/cascada/server/cascada.py
cascada2
- port = 8088
- /home/pi/mypi/cascada/server/cascada2.py
<markdown>
sudo`supervisorctl` reads configuration from `/etc/supervisor/conf.d` and runs whatever files if finds there.
a typical `conf` ile looks like:
[program:cascada2] command=/usr/bin/python /home/pi/mypi/cascada/server/cascada2.py directory=/home/pi/mypi/cascada/server autostart=true autorestart=true startretries=3 stderr_logfile=/var/log/cascada/cascada2.err.log stdout_logfile=/var/log/cascada/cascada2.out.log user=root environment=SECRET_PASSPHRASE='this is secret',SECRET_TWO='another secret'
you may have to `>supervisor reload` then `ctrl c` the `sudo supervisorctl` to get a new program running forever
</markdown>
pi@raspberrypi ~ $ sudo supervisorctl cascada RUNNING pid 2273, uptime 7 days, 3:17:36
tail -f /var/log/cascada/cascada.out.log tail -f /var/log/cascada/cascada.err.log
after changing cascada.py
pi@raspberrypi ~ $ sudo supervisorctl cascada RUNNING pid 2273, uptime 7 days, 3:17:36 supervisor> stop cascada
exit w ctrl C
sudo lsof -i :8087 sudo kill -9 21118 (kill whatever port lsof returns)
pi@raspberrypi ~ $ sudo supervisorctl cascada STOPPED Jul 16 04:34 PM supervisor> start cascada cascada: started supervisor>
exit w ctrl C ??
- nohup python app.py &
- use screen
- run supervisord(link) on system startup and control all through it (pythonic way :))
nohup means: do not terminate this process even when the stty is cut off.
& at the end means: run this command as a background task.
SSE - Server Side Events
http://flask.pocoo.org/snippets/116/
https://github.com/stevenewey/ssedemo
for node
https://www.npmjs.com/package/simple-sse (has room,haven't tried)
https://tomkersten.com/articles/server-sent-events-with-node/
http://www.futureinsights.com/home/real-time-the-easy-way-with-eventsource-angularjs-and-nodejs.html
SocketIO
http://stackoverflow.com/questions/17641602/how-to-emit-to-room-in-socket-io