Skip to content

Instantly share code, notes, and snippets.

@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
@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 / 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 / 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 / gist:3751961
Created September 19, 2012 20:15
Simple backbone.js handler for GAE
import json
import logging
from google.appengine.ext import db
from google.appengine.api import users
import webapp2
# With routes like:
#app = webapp2.WSGIApplication([
# webapp2.Route("/d/<collection>", DataHandler, methods=["GET", "POST"]),
# webapp2.Route("/d/<collection>/<id>", DataHandler, methods=["GET", "PUT", "DELETE"]),
@teeler
teeler / gist:4004711
Created November 2, 2012 22:23
color iter
# thanks @craigcitro
import collections
import itertools
RGB = collections.namedtuple('RGB', ['r', 'g', 'b'])
def rgb_to_str(rgb):
return "%02x%02x%02x" % (rgb.r, rgb.g, rgb.b)
@teeler
teeler / designer.html
Last active August 29, 2015 14:13
designer
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<link rel="import" href="../core-header-panel/core-header-panel.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;
@teeler
teeler / BUILD
Created September 12, 2018 15:36
# /usr/local/google/home/rtp/github/graphd.teeler/test/unit/BUILD:2:5
sh_test(
name = "zeroguid",
data = ["//test/unit:zeroguid.sh", "//test/unit:rungraphd", "//graphd:graphd", "//util:gpush", "//test/unit:bigconf.conf", "//test/unit:cost2.broken.conf", "//test/unit:cost2.conf", "//test/unit:cost2.short.broken.conf", "//test/unit:cost2.short.conf", "//test/unit:david_1.conf", "//test/unit:david_4.conf", "//test/unit:dbname.broken.conf", "//test/unit:dbname.conf", "//test/unit:instance-id.conf", "//test/unit:logrotate.conf", "//test/unit:override-dir-1.conf", "//test/unit:override-dir-2.conf", "//test/unit:spewrequest.conf", "//test/unit:sync.conf", "//test/unit:zeroguid.out.exp"],
srcs = ["//test/unit:test.sh"],
args = ["-v", "zeroguid.sh"],
)
# /usr/local/google/home/rtp/github/graphd.teeler/test/unit/BUILD:2:5
sh_test(
<!-- Creator : groff version 1.19.2 -->
<!-- CreationDate: Fri Sep 14 10:51:19 2018 -->
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta name="generator" content="groff -Thtml, see www.gnu.org">
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<meta name="Content-Style" content="text/css">
<style type="text/css">
Graphd testing
First build it:
{•̃_•̃} bazel build graphd
Then, run it:
{•̃_•̃} bazel-bin/graphd/graphd -d /tmp/some-tmp-db -y
graphd> write (name="human" value="chris"