Skip to content

Instantly share code, notes, and snippets.

View konsumer's full-sized avatar

David Konsumer konsumer

View GitHub Profile
@konsumer
konsumer / 5.py
Created February 6, 2012 22:36
Entry for day 5 of Daily Art Challenge
#!/usr/bin/env python
import re
text = """1st your name.
2nd an article of clothing.
3rd a flowering plant.
4th a piece of furniture.
5th a machine.
6th a bicycle/velocipede.
@konsumer
konsumer / 6.html
Created February 7, 2012 01:27
Day 6 Velocipede
<html><title>Day 6 (velocipede)</title><head>
<style> body { background: -webkit-canvas(velocipede); width:100%; height:100%; }</style>
<script type="text/javascript">
var ctx = document.getCSSCanvasContext("2d", "velocipede", 60, 60);
ctx.strokeStyle = 'rgba(0,0,0,0)';
ctx.lineCap = 'butt';
ctx.lineJoin = 'miter';
ctx.miterLimit = 4;
ctx.fillStyle = "#000000";
ctx.strokeStyle = "rgba(0, 0, 0, 0)";
# load jetty transport
http.type: com.sonian.elasticsearch.http.jetty.JettyHttpServerTransportModule
/**
* Save a record, directly to elasticsearch
* @param {Object} record Record to be saved
* @param {String} index_name Index to save to
* @param {String} type type to save to
* @param {Function} callback called on complete: req, result
* @param {String} prefix url for DB ('http://localhost:9200/')
*/
exports.save = function(record, index_name, type, callback, prefix, id){
prefix = prefix || 'http://localhost:9200/';
NameVirtualHost *:80
<VirtualHost *:80>
ServerAdmin konsumer@metaltoad.com
VirtualDocumentRoot "/Users/konsumer/Sites/%1/webroot/"
DocumentRoot "/Users/konsumer/Sites/%1/webroot/"
LogFormat "%V %h %l %u %t \"%r\" %s %b" vcommon
ErrorLog "/var/log/apache2/vhosts-error_log"
CustomLog "/var/log/apache2/vhosts-access_log" vcommon
</VirtualHost>
@konsumer
konsumer / for_tony.ck
Created September 22, 2012 20:56
Plays creepy random sitar music when Tony types.
Hid hi;
HidMsg msg;
hi.openKeyboard( 0 );
Sitar sit => PRCRev r => dac;
fun void pluk( int code ) {
Math.random2( 0, 11 ) => float winner;
Std.mtof( 57 + Math.random2(0,3) * 12 + winner ) => sit.freq;
@konsumer
konsumer / ana_read.ino
Created September 26, 2012 16:39
Basic analog read
int analogPin = 3;
int val = 0;
void setup() {
Serial.begin(9600); // setup serial
}
void loop() {
val = analogRead(analogPin); // read the input pin
Serial.println(val); // debug value
@konsumer
konsumer / ana_read.js
Created September 26, 2012 16:44
Basic analog read, using Firmata
var firmata = require('firmata');
var analogPin = 3;
var board = new firmata.Board('/dev/tty.usbmodemfd121', function(err) {
if (err){
console.log(err);
process.exit(1);
}
#!/bin/bash
path_list=`echo $PATH | tr ':' ' '`
for d in $path_list
do
ls $d
done
#!/usr/bin/env node
console.log("sup, dude?");