Skip to content

Instantly share code, notes, and snippets.

View pingswept's full-sized avatar

Brandon Stafford pingswept

  • Tufts University
  • Somerville, Massachusetts, USA
View GitHub Profile
@pingswept
pingswept / ghost-import.py
Created February 6, 2014 02:07
The sorriest excuse for a Markdown file importer for Ghost that can be imagined.
def insert_post_into_database(list_of_posts):
import sqlite3
con = sqlite3.connect('ghost-dev.db')
cur = con.cursor()
for post in list_of_posts:
print(post)
cur.execute('INSERT INTO posts(uuid, title, slug, markdown, featured, page, status, language, author_id, created_at, created_by) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', post)
@pingswept
pingswept / test-4x4-driver-shield.ino
Created February 7, 2014 19:22
Test code for the 4x4 driver shield. Pulses all 16 outputs on and off with a 1 second delay in between.
void setup() {
//set pins to output because they are addressed in the main loop
pinMode(7, OUTPUT);
pinMode(8, OUTPUT);
pinMode(11, OUTPUT);
pinMode(13, OUTPUT);
}
void loop() {
@pingswept
pingswept / gist:9295878
Created March 1, 2014 19:37
Nginx conf for test.rm.com
server {
listen 0.0.0.0:80;
server_name test.rascalmicro.com;
access_log /var/log/nginx/test.rascalmicro.com/access.log;
error_log /var/log/nginx/test.rascalmicro.com/error.log;
location / { # catch-all directive
proxy_set_header X-Real-IP $remote_addr;
@pingswept
pingswept / 18_bit_precision_voltage_shield.ino
Created March 24, 2014 19:37
Demonstration code for the 18-bit variant of the Rascal Micro Precision Voltage Shield
#include <SPI.h>
#define RESOLUTION 18
#define SCALE_FACTOR 0.00003814697265625
// 10/(2^18) = 0.00003814697265625
#define BUSY 3
#define RESET 4
#define START_CONVERSION 5
#define CHIP_SELECT 10
@pingswept
pingswept / evolver-experiment.ini
Last active August 29, 2015 14:01
First cut at turbidostat experiment config file
[optical density]
max_od=0.25
min_od=0.1
od_logging_interval=30
[stirrer]
speed="medium"
[temperature]
target=37.0
@pingswept
pingswept / evolver.py
Last active August 29, 2015 14:02
Skeleton of Python code for Evolver
import time
TUBES = range(1,49)
while(1):
ReadOpticalSensors()
ReadTemperatures()
ReadFluidFlowStatus()
(speeds, temps, flows) = DecideExperimentSpecificStuff() # This is where the custom stuff goes!
@pingswept
pingswept / smack-blog.py
Last active August 29, 2015 14:03
Code for monitoring the 3D printers at Happy Workhorse Farms
# Add in cat /etc/supervisor/conf.d/smack-blog.conf
#
# [program:smack-blog]
# command=/root/smack-blog.py
#!/usr/bin/python
import Adafruit_BBIO.UART as UART
import os, pytumblr, serial, time
### Keybase proof
I hereby claim:
* I am pingswept on github.
* I am brandonstafford (https://keybase.io/brandonstafford) on keybase.
* I have a public key whose fingerprint is 96E3 30F7 534B B328 14BD 92AF F3B1 AADE 8B45 35C0
To claim this, I am signing this object:
@pingswept
pingswept / voltage-shield.html
Last active August 29, 2015 14:10
Demo of Precision Voltage Shield on Rascal
<!DOCTYPE html>
<html>
<head>
<title>Battery Voltage</title>
{% include "include/rascal-head.html" %}
<style>
#chart1 {
margin-top: 20px;
margin-left: -40px;
height: 400px;
@pingswept
pingswept / uluvart.ino
Created December 1, 2014 21:15
Test code for U-LUV-ART
#include <Adafruit_NeoPixel.h>
#define PIN 6
// Parameter 1 = number of pixels in strip
// Parameter 2 = Arduino pin number (most are valid)
// Parameter 3 = pixel type flags, add together as needed:
// NEO_KHZ800 800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
// NEO_KHZ400 400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
// NEO_GRB Pixels are wired for GRB bitstream (most NeoPixel products)