Skip to content

Instantly share code, notes, and snippets.

BEGIN{n=0;}
{
/* Grab six bytes */
while(n != 6) {
/* The first byte is always A8, so wait for that */
while(n == 0 && $2 != "A8")
getline;
/* Only take data from the UART */
if(/^uart-1:/) {
/* Save it to an array */
db module:
class CocktailDB:
def __init__(dbfile):
pass
# void
def set_ingredient_position(position, ingredient_id, amount = 0):
pass
Cocktail:
- id
- name
- picture
Ingredient:
- id
- name
- ABV
@Cat-Ion
Cat-Ion / tektronix.py
Created April 10, 2017 02:53
Some code to get waveforms from my Tektronix TDS 2012
import serial
import struct
import time
ser = serial.Serial(port='/dev/ttyUSB0', baudrate=19200, parity=serial.PARITY_NONE, stopbits=serial.STOPBITS_ONE, bytesize=serial.EIGHTBITS)
def cmd(s):
ser.write(s)
ser.write(b"\r\n")
time.sleep(0.1) # *shrug*
IQ DCR alpha: 1.04166e-05
Using audio backend: auto
New filter offset: 0 Hz
low: 144452000
high: 144548000
divswanted: 11
adjlow: 144460000
step: 10000
divs: 9
low: -115
@Cat-Ion
Cat-Ion / gist:3577047
Created September 1, 2012 15:23
useful stuff

vim

Join paragraphs into single lines

`:g/^./ .,/^$/-1 join`

mdadm