Skip to content

Instantly share code, notes, and snippets.

Avatar

David Konsumer konsumer

View GitHub Profile
@konsumer
konsumer / 5.py
Created Feb 6, 2012
Entry for day 5 of Daily Art Challenge
View 5.py
#!/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 Feb 7, 2012
Day 6 Velocipede
View 6.html
<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)";
View elasticsearch.yml
# load jetty transport
http.type: com.sonian.elasticsearch.http.jetty.JettyHttpServerTransportModule
View estools.js
/**
* 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/';
View httpd-vhosts.conf.xml
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 Sep 22, 2012
Plays creepy random sitar music when Tony types.
View for_tony.ck
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 Sep 26, 2012
Basic analog read
View ana_read.ino
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 Sep 26, 2012
Basic analog read, using Firmata
View ana_read.js
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);
}
View get_all_commnds.sh
#!/bin/bash
path_list=`echo $PATH | tr ':' ' '`
for d in $path_list
do
ls $d
done
View cli.js
#!/usr/bin/env node
console.log("sup, dude?");