Skip to content

Instantly share code, notes, and snippets.

View a-andreyev's full-sized avatar
🕊️

Alexey Andreyev a-andreyev

🕊️
View GitHub Profile
@a-andreyev
a-andreyev / mserial.py
Created April 10, 2017 17:06
pyserial non-block read to stdout
#!/usr/bin/python
import serial
import threading
port = '/dev/ttyUSB0'
baud = 9600
serial_port = serial.Serial(port, baud, timeout=120)
@a-andreyev
a-andreyev / readme.md
Last active January 2, 2017 17:23 — forked from albertcarrete/readme.md
Surface Pro 4 Arch Linux Installation
@a-andreyev
a-andreyev / PKGBUILD
Last active November 16, 2016 23:00
linux4tegra-ventana AUR archlinux PKGBUILD
# Based on linux-tegra by: Anatol Pomozov <[email protected]>
# Contributor: Alexey Andreyev <[email protected]>
pkgname=linux4tegra
pkgver=24
pkgrel=1
pkgdesc='linux4tegra'
arch=(x86_64)
license=(NVIDIA)
depends=(lib32-glibc lib32-gcc-libs) # mkbootimg is 32-bit binary
@a-andreyev
a-andreyev / truthtable.py
Last active October 18, 2016 15:23 — forked from pindia/gist:3836713
Python truth table calculator
#!/usr/bin/python2
# based on: https://gist.github.com/pindia/3836713
from itertools import izip, product, tee
# Logic functions: take and return iterators of truth values
def AND(a, b):
for p, q in izip(a, b):
yield p and q
// TODO: separate to lib:
#define DEBUG_BAUDRATE 115200
// RS485 PROTOCOL:
#define SerialTxControl 10
#define RS485Transmit HIGH
#define RS485Receive LOW
// CE PROTOCOL:
#define CE_BAUDRATE 9600
from socketserver import *
host = '192.168.0.121'
port = 5683
addr = (host,port)
class MyUDPHandler(DatagramRequestHandler):
def handle(self):
data = self.request[0]
@a-andreyev
a-andreyev / PKGBUILD
Last active March 11, 2016 12:39
Breakfastquay Dataquay ArchLinux PKGBUILD
# Maintainer: aa13q <[email protected]>
# Contributor: speps <speps at aur dot archlinux dot org>
pkgname=dataquay-git
appname=dataquay
pkgver=0.9
pkgrel=3
pkgbranch=master
pkgdesc="A free open source library that provides a friendly C++ API for an RDF data store, using Qt classes and containers."
arch=(i686 x86_64)
@a-andreyev
a-andreyev / semiot.ru
Created February 29, 2016 14:59
udp_timer_actuator_minimal_example.qml
import QtQuick 2.2
import ru.semiot.gateway 0.1
SemIoTDeviceConfig {
driverName: "udp";
property int listenPort: 54321
onDriverConnected: {
// do nothing
// addDriverDataSource({"port":listenPort})
}
import QtQuick 2.2
import ru.semiot.gateway 0.1
SemIoTDeviceConfig {
// NOTE: is that ok that system driver is only one per device driver?
driverName: "udp";
onDriverConnected: {
addDriverDataSource({"port":33333})
}
onNewDataPacketReceived: {
@a-andreyev
a-andreyev / energomera_ce102r5_ak.ino
Last active January 20, 2016 15:59
energomera ce102r5 ak via max485 initial support
// TODO: separate to lib:
#define DEBUG_BAUDRATE 115200
// RS485 PROTOCOL:
#define SerialTxControl 10
#define RS485Transmit HIGH
#define RS485Receive LOW
// CE PROTOCOL:
#define CE_BAUDRATE 9600