Skip to content

Instantly share code, notes, and snippets.

View dougluce's full-sized avatar

Doug Luce dougluce

View GitHub Profile
checkcode = (req, cb) ->
if req.params.code
err, result <- dbconn.query QUERY
cb result.rows[0].id
else
cb 1
mainfunc = req ->
org <- checkcode
... use org somewhere ...
@dougluce
dougluce / parse.go
Created February 21, 2016 22:30
otto parser test
package main
import (
"fmt"
"time"
"github.com/robertkrimen/otto/parser"
)
func main () {
filename := "/tmp/addthis_widget.js"
#0 0x17b964da in xt_handle (xt=0x804c4340, node=0xdfdfdfdf, depth=0) at xmltree.c:180
#1 0x17b964b8 in xt_handle (xt=0x804c4340, node=0x84ac54a0, depth=1) at xmltree.c:174
#2 0x17b9646f in xt_handle (xt=0x804c4340, node=0x0, depth=1) at xmltree.c:169
#3 0x17ba4d78 in jabber_feed_input (ic=0x7f2ae240,
buf=0xcfbf4fd0 "<iq id='BeeCCRPZkeyC1AfIgWws' type='error'><error type='cancel'><service-unavailable xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/></error></iq>\t", size=143) at io.c:167
#4 0x17ba4ffc in jabber_read_callback (data=0x7f2ae240, fd=20, cond=B_EV_IO_READ) at io.c:237
#5 0x17b8adbf in gaim_io_invoke (source=0x829dad80, condition=G_IO_IN, data=0x7e972130) at events_glib.c:86
#6 0x0656aa8d in g_io_unix_dispatch () from /usr/local/lib/libglib-2.0.so.4200.0
#7 0x0651f632 in g_main_context_dispatch () from /usr/local/lib/libglib-2.0.so.4200.0
#8 0x065219ff in g_main_context_iterate () from /usr/local/lib/libglib-2.0.so.4200.0
@dougluce
dougluce / gist:1956acf8d35e42aab3f2
Created March 14, 2016 19:39
R script for scraping cloning stats from Github clone graphs.
library(jsonlite)
library(httr)
library(XML)
username <- "allenluce"
repo <- "mmap-object"
password <- "allenluce's password"
# Go to Github
response <- GET ("https://github.com/login")
@dougluce
dougluce / svelte.txt
Last active July 6, 2016 21:34
Python Got Too Big
from email.header import decode_header
import sys,re
for line in sys.stdin:
if re.match('(From|Subject|To): ', line):
dh = decode_header(line)
print ' '.join([unicode(t[0], t[1] or 'ASCII') for t in dh])
@dougluce
dougluce / keybase.md
Created August 3, 2016 21:54
Keybase proof

Keybase proof [37/2211]

I hereby claim:

  • I am dougluce on github.
  • I am dougluce (https://keybase.io/dougluce) on keybase.
  • I have a public key ASA4wq7OzwGkwHFTryhWIsmodyI1jwEBiNdigTOHRAX2cQo

To claim this, I am signing this object:

while(<>) {
chomp;
my $len = length($_);
my $steps = int(log($len)/log(10));
for (my $o = $steps; $o >= 0; $o--) {
my $n = 1;
for (my $i = 0; $i < $len-(10**$o)+1; $i+= 10**$o) {
print " " x ((10**$o)-1) . ($n++ % 10);
}
print "\n";
func e(input string) string {
return base64.URLEncoding.EncodeToString([]byte(input))
}
var fixtureFiles = map[string]string{
"digger_static_06-09-16-11:18:48": `josephmaltz 30
josephmaltz 20
robjerfy 50
josephmaltz 10`,
"digger_static_06-09-16-11:19:59": `robjerfy 3
package main
import (
"encoding/base64"
"fmt"
yaml "gopkg.in/yaml.v2"
"regexp"
)
var fixtureFiles = `
gistup