Skip to content

Instantly share code, notes, and snippets.

@billroy
billroy / packit
Created May 21, 2013 21:44
tar-compress a directory and name the tarfile with the date
#! /bin/bash
tar -czvf $1-$(date +%Y-%m-%d-%H.%M).tgz $1
<html>
<body>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script src="springy.js"></script>
<script src="springyui.js"></script>
<textarea id='network_text'
rows=10 cols=100>
Paste Here
@billroy
billroy / InputCapture.ino
Created November 7, 2012 16:33
Arduino input capture example
/***
InputCapture.ino
Timer 1 high-resolution timing facility.
Copyright (C) 2008-2012 Bill Roy
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
@billroy
billroy / jsonio.py
Created September 21, 2012 13:38
Read/write JSON object from file in python
import simplejson
import json
def put(data, filename):
try:
jsondata = simplejson.dumps(data, indent=4, skipkeys=True, sort_keys=True)
fd = open(filename, 'w')
fd.write(jsondata)
fd.close()
except:
@billroy
billroy / force-bounds-titles.html
Created September 17, 2012 01:14
Force directed layout with titles
<!DOCTYPE html>
<html>
<head>
<title>Force-Directed Layout</title>
<script type="text/javascript" src="../../d3.v2.js"></script>
<style type="text/css">
circle {
stroke-width: 1.5px;
}
var util = require('util'),
spawn = require('child_process').spawn;
var taskid = 1;
var numtasks = 4;
while (taskid <= numtasks) {
console.log('Spawning', taskid);
var task = spawn('python', ['potato.py', '-x', '3', '-n', taskid++])
from optparse import OptionParser
parser = OptionParser()
parser.add_option("-n", "--number",
dest="count", type='int',
help="which potato am i")
parser.add_option("-x", "--exit",
dest="exit", type='int',
help="exit after this many logging cycles")