Skip to content

Instantly share code, notes, and snippets.

View cellularmitosis's full-sized avatar

Jason Pepas cellularmitosis

View GitHub Profile
@cellularmitosis
cellularmitosis / swagger.yaml
Created February 11, 2016 05:05
test of swagger 'enum' allowed values in response object.
swagger: '2.0'
info:
version: 1.0.0
title: PetStore on Heroku
description: |
**This example has a working backend hosted in Heroku**
You can try all HTTP operation described in this Swagger spec.
Find source code of this API [here](https://github.com/mohsen1/petstore-api)
@cellularmitosis
cellularmitosis / make_sysroot.py
Last active February 23, 2016 22:33 — forked from froody/make_sysroot.py
A fork of froody's make_sysroot.py which supports Debian Jessie (and thus armel).
#!/usr/bin/env python
# Install dpkg with `brew install dpkg libelf` before running this script
import argparse
import sys
import gzip
import urllib
import urlparse
import posixpath
import cStringIO
@cellularmitosis
cellularmitosis / gist:dd9c9cd3aa9be2e177d8
Created March 9, 2016 23:14
delete all but the latest three files
for i in `ls -1t *.tar.lzo | tail -n+4`
do
rm $i
done
@cellularmitosis
cellularmitosis / ab.py
Created March 15, 2016 04:57
Fooling around with using Python's parsley to generate Swift code.
#!/usr/bin/env python
# fooling around with using parsley to generate swift.
import parsley
x = parsley.makeGrammar("""
ab = <'a'+>:a <'b'+>:b -> (a,b)
""", {})
@cellularmitosis
cellularmitosis / best-four-of-n.py
Last active April 15, 2017 09:05
A script for finding the best two pairs of matched resistors for use in a 1x gain difference amp.
#!/usr/bin/env python
# This script finds the best two pairs of resistors for making a diff amp with
# a gain of 1.
#
# List all of your resistor values in a file (one per line), for example:
#
# 9.990
# 10.004
# 9.999
@cellularmitosis
cellularmitosis / bootstrapped-zener-resistors.py
Last active June 8, 2017 00:58
Resistor selection table for the bootstrapped LM399 circuit
#!/usr/bin/env python
# Schematic:
#
# +------+-------+
# | | |
# | /\ |
# rf / \ rz
# | / \ |
# | / - + \ |
@cellularmitosis
cellularmitosis / mux2x8ch.py
Created August 11, 2017 06:05
A python script which can mux two 8-channel Pulseview logic analyzer files into a single 16-channel file.
#!/usr/bin/env python
# mux2x8ch.py: mux two 8-channel srzip files into one 16-channel file.
# Copyright Jason Pepas, 2017. Released under the terms of the MIT License.
import sys
import os
import zipfile
import zlib
import tempfile
@cellularmitosis
cellularmitosis / Si7021-logger.py
Created November 17, 2017 22:58
Logging client for an Arduino-based Si7021 temperature and humidity logger
#!/usr/bin/env python
# Si7021-logger.py: read temperature / humidity data from an Arduino and log as CSV.
#
# linux usage examples:
# ./Si7021-logger.py /dev/ttyACM0
# ./Si7021-logger.py /dev/ttyUSB0
#
# mac usage examples:
# ./Si7021-logger.py /dev/tty.usbserial-DN02TIYO
@cellularmitosis
cellularmitosis / Si7021-arduino.ino
Created November 17, 2017 23:31
An Arduino sketch which implements an Si7021-based temperature and humidity logger.
/*
A simple temperature / humidity logger, using the Si7021.
Hardware connections:
The two pins above the AREF pin are (from the top): SCL and SDA.
*/
/*
The following Si7021 "Weather" code was adapted from Sparkfun's library.
See https://github.com/sparkfun/Si7021_Breakout/tree/master/Libraries
#!/usr/bin/env python
import serial
import sys
import time
ser = serial.Serial(
port = sys.argv[1],
baudrate = 9600,
bytesize=serial.EIGHTBITS,