Skip to content

Instantly share code, notes, and snippets.

View thraxil's full-sized avatar

Anders Pearson thraxil

View GitHub Profile
@thraxil
thraxil / gist:881707
Created March 22, 2011 18:08
logarithmic scaling of tag clouds
#!/usr/bin/env python
import math
tags = [('admin', 1), ('annotation', 1), ('annotations', 6), ('apache', 1),
('authentication', 2), ('backend', 27), ('caching', 1), ('cgi_app', 1),
('cherrypy', 1), ('cherrypy-branch', 2), ('client', 3), ('cookies', 1),
('CSS', 2), ('dependencies', 4), ('documentation', 8), ('email', 8),
('exif', 1), ('fields', 4), ('flash', 2), ('forum', 3), ('fozzy', 1),
('frink', 1), ('groups', 3), ('HTML', 2), ('items', 29),
@thraxil
thraxil / gist:1718994
Created February 1, 2012 19:59
cachebuster bookmarklet
javascript:window.location=window.location.href+(window.location.href.indexOf("?")==-1?"?":"&")+"__cachebuster="+parseInt(Math.random()*99999999);
@thraxil
thraxil / mod7.go
Created May 1, 2012 15:01
simple implementation of the mod 7 graph walking algorithm
// simple implementation of the mod 7 algorithm described here:
// http://blog.tanyakhovanova.com/?p=262
// compile with "go build mod7.go"
// then:
//
// $ echo 1098712349087123409871234908712340917823490187234091827340918273490128734 | ./mod7
// 1
//
// time echo 1098712349087123409871234908712340917823490187234091827340918273490128734 | ./mod7
@thraxil
thraxil / gist:3218950
Created July 31, 2012 17:58
my ~/.jshint
{
"asi" : true,
"bitwise" : true,
"boss" : false,
"browser" : true,
"couch" : true,
"curly" : true,
"debug" : false,
"devel" : true,
"eqeqeq" : true,
@thraxil
thraxil / gist:3239180
Created August 2, 2012 18:00
goldap interface test
package main
import (
"github.com/jmckaskill/goldap"
"fmt"
"os"
)
func printer (r string) {
fmt.Println("out!")
{% set app='example' %}
upstream {{app}} {
{% if pillar.role == 'staging' %}
server {{app}}.stage.ccnmtl.columbia.edu.s3-website-us-east-1.amazonaws.com;
{% else %}
server {{app}}.ccnmtl.columbia.edu.s3-website-us-east-1.amazonaws.com;
{% endif %}
}
server {
@thraxil
thraxil / gist:5404231
Last active December 16, 2015 08:09
How to add a gittip button to your github project.

Very simple. Just create a README.md or README.markdown for your project (if you haven't already) and add code like the following:

[![Fund me on Gittip](https://www.gittip.com/assets/7.0.8/logo.png)](https://www.gittip.com/<your account here>/)

Gittip needs a proper button for linking. The small logo file was the best I could find. It will look something like this:

Fund me on Gittip

@thraxil
thraxil / gist:5940700
Created July 6, 2013 18:04
This is valid Java
public class Foo {
public static void main(String[] args) {
Integer i = 3;
System.out.println("i is: " + i);
}
}
@thraxil
thraxil / gist:5940704
Created July 6, 2013 18:05
But this is not valid Python:
i = 3
print "i is: " + i
# you get: TypeError: cannot concatenate 'str' and 'int' objects
@thraxil
thraxil / gist:6067562
Created July 24, 2013 01:54
hekad config for a simple statsd replacement
[StatsdInput]
address = ":8125"
[StatAccumInput]
ticker_interval = 10
emit_in_payload = true
[CarbonOutput]
message_matcher = "Type == 'heka.statmetric'"
address = "graphite.example.com:2003"