Skip to content

Instantly share code, notes, and snippets.

View sasimpson's full-sized avatar

Scott Simpson sasimpson

View GitHub Profile
@sasimpson
sasimpson / gist:1112739
Created July 28, 2011 22:37
Ruby Net:HTTP chunked transfer
require 'uri'
require 'net/http'
class Chunked
def initialize(data, chunk_size)
@size = chunk_size
if data.respond_to? :read
@file = data
end
end
@sasimpson
sasimpson / gist:1334943
Created November 2, 2011 21:13
dallas temperature to rgb led on arduino
#include <OneWire.h>
#include <DallasTemperature.h>
#define ONE_WIRE_BUS 10
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
struct RGB {
byte red;
@sasimpson
sasimpson / gist:1405374
Created November 29, 2011 16:15
python to send proper hex to arduino program
def color_bulb(s, bulb, i, rgb):
req = "2E %02X %s %02X %02X %02X" % (bulb, i, rgb[0], rgb[1], rgb[2])
print req
s.write(binascii.unhexlify(''.join(req.split())))
@sasimpson
sasimpson / dnsupdate.py
Created April 13, 2012 19:43
tool to periodically update dns from a remote location
import requests
import json
from cloudauth import getauth
def update_record(domain_name=None, record_name=None):
token, dns_url = getauth('dnsextension:dns')
headers = {'x-auth-token': token, 'content-type': 'application/json'}
my_ip_resp = requests.get('http://automation.whatismyip.com/n09230945.asp')
if my_ip_resp.ok:
@sasimpson
sasimpson / cloudfiles_blog.py
Created April 13, 2012 20:08
upload a static blog directory named 'output' to a container named 'blog'
import mimetypes
import requests
import cloudauth
import os
import re
token, storage_url = cloudauth.getauth('object-store')
headers = {'x-auth-token': token}
regexp = re.compile('./output/')
@sasimpson
sasimpson / gist:5136553
Created March 11, 2013 18:42
simcity status
Antarctica: available
Europe East 4: available
Europe West 5: available
Europe West 6: available
North America West 3: available
North America West 4: available
North America East 3: available
North America East 4: available
Oceanic 2: full
Asia: available
@sasimpson
sasimpson / isitquesoweek.py
Created October 30, 2013 16:20
determines if it is queso week at Biff Buzby's Burgers. Assumes the beginning of the week is Monday.
#!/usr/bin/python
import sys
import datetime
import argparse
def is_queso_week(today=None):
if today is None:
today = datetime.datetime.now()
if today.weekday() is not 0:
@sasimpson
sasimpson / keybase.md
Created April 14, 2014 21:22
keybase verification

Keybase proof

I hereby claim:

  • I am sasimpson on github.
  • I am sasimpson (https://keybase.io/sasimpson) on keybase.
  • I have a public key whose fingerprint is 24E2 0C0F FF97 6865 E969 5840 A4AE 2A7C 582F 2A14

To claim this, I am signing this object:

@sasimpson
sasimpson / tmux.md
Last active August 29, 2015 14:14 — forked from bylatt/tmux.md

Download Libevent and Tmux.

mkdir ~/build
cd ~/build
curl -OL http://downloads.sourceforge.net/tmux/tmux-1.9a.tar.gz
curl -OL http://downloads.sourceforge.net/project/levent/libevent/libevent-2.0/libevent-2.0.16-stable.tar.gz
@sasimpson
sasimpson / sections.json
Last active September 27, 2022 01:50
ARRL Field Day sections in JSON
{
"sections": [
{
"name": "Connecticut",
"abbr": "CT",
"area": "1"
}, {
"name": "Eastern Massachusetts",
"abbr": "EMA",
"area": "1"