Skip to content

Instantly share code, notes, and snippets.

View vkoloss's full-sized avatar

Vladislav Kolosnicin vkoloss

  • Belarus
View GitHub Profile
@vkoloss
vkoloss / mh_z19.py
Created December 26, 2016 08:58 — forked from UedaTakeyuki/mh_z19.py
MH-Z19 CO2 Sensor reading.
# http://eleparts.co.kr/data/design/product_file/SENSOR/gas/MH-Z19_CO2%20Manual%20V2.pdf
# http://qiita.com/UedaTakeyuki/items/c5226960a7328155635f
import serial
import time
def mh_z19():
ser = serial.Serial('/dev/ttyAMA0',
baudrate=9600,
bytesize=serial.EIGHTBITS,
parity=serial.PARITY_NONE,
@vkoloss
vkoloss / start-stop-daemon-example.sh
Last active December 31, 2017 11:23 — forked from alobato/start-stop-example.sh
start-stop-daemon-example
#!/bin/bash
# Quick start-stop-daemon example, derived from Debian /etc/init.d/ssh
set -e
NAME=app
DIR=/home/username/app/bin
PIDFILE=/var/run/$NAME.pid
DAEMON=/home/username/app/bin/executable
DAEMON_ARGS="-foo bar"
@vkoloss
vkoloss / node_debian_init.sh
Created July 31, 2017 20:13 — forked from peterhost/node_debian_init.sh
Daemon init script for node.js based app/server (DEBIAN/UBUNTU)
#!/bin/sh
# ------------------------------------------------------------------------------
# SOME INFOS : fairly standard (debian) init script.
# Note that node doesn't create a PID file (hence --make-pidfile)
# has to be run in the background (hence --background)
# and NOT as root (hence --chuid)
#
# MORE INFOS : INIT SCRIPT http://www.debian.org/doc/debian-policy/ch-opersys.html#s-sysvinit
# INIT-INFO RULES http://wiki.debian.org/LSBInitScripts
# INSTALL/REMOVE http://www.debian-administration.org/articles/28