Skip to content

Instantly share code, notes, and snippets.

@teeler
teeler / lefty.py
Created July 13, 2012 01:40
Left handed passwords
# Generate passwords of length suitable for typing with just your left hand.
import os, random, string
length = 10
chars = "12345qwertasdfgzxcvQWERT!@#$%ASDFGZXCV"
random.seed = (os.urandom(1024))
print ''.join(random.choice(chars) for i in range(length))
@teeler
teeler / synapyse.py
Created July 12, 2012 01:13
synapse python client
import base64
import hashlib
import hmac
import jsonlib2
import requests
import sys
import time
class SynapseLoginException(Exception):
@teeler
teeler / index.js
Created May 9, 2012 03:10 — forked from kconragan/index.js
list surf sessions
exports.listLogs = function(req, res) {
SurfSession.find()
.populate('location')
.run(function(err, log) {
Wave.find(function(err, waves) {
var surfHeight = SurfSession.schema.path('surfHeight').enumValues;
var surfConditions = SurfSession.schema.path('surfConditions').enumValues;
var surfStoke = new SurfSession().generateStoke();
var currentYear = moment().year();
var surfSessionsThisYear = 0;
@teeler
teeler / gist:2411377
Created April 18, 2012 05:58
without bullshit
var request = require("request")
var parseBuoyData(buoyid, cb) {
request(buoyURL(buoyid), function(e, r, b) {
if (e) {
throw new Error(e)
}
// do all that insane parsing nonsense here
// Takes NDBC Buoy ID, and returns
// series of readings
// Just to generate a URL.
var BuoyURL = function(buoyId) {
return 'http://www.ndbc.noaa.gov/data/5day2/' + buoyId + '_5day.txt';
};
exports.parseBuoyData = function(buoy) {
var moment = require('moment');
var request = require('request');
exports.formatDate = function(format, date) {
};
// Takes NDBC Buoy ID, and returns
// series of readings
var fetchBuoy = function(buoyId) {
request('http://www.ndbc.noaa.gov/data/5day2/' + buoyId + '_5day.txt', function(err, response, body){
@teeler
teeler / wtf.R
Created March 14, 2012 20:06
R WTF
# Ok, so appending items to lists.
# I'm fine with this.
f <- list()
f <- c(f, 1)
f <- c(f, 2)
f <- c(f, 3)
# Ok, lets try something fancier, lists of lists.
library(doRedis)
registerDoRedis()
library(doRedis)
@teeler
teeler / stream.html
Created September 7, 2011 18:36
Stream demo
<!DOCTYPE html>
<html>
<head>
<title>Streamgraph</title>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js?1.29.1"></script>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.layout.js?1.29.1"></script>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.time.js?1.29.1"></script>
<script type="text/javascript" src="tech.js"></script>
<link type="text/css" rel="stylesheet" href="http://mbostock.github.com/d3/ex/button.css"/>
<link type="text/css" rel="stylesheet" href="http://mbostock.github.com/d3/ex/stream.css"/>