Skip to content

Instantly share code, notes, and snippets.

Anders Pearson thraxil

Block or report user

Report or block thraxil

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@thraxil
thraxil / gist:881707
Created Mar 22, 2011
logarithmic scaling of tag clouds
View gist:881707
#!/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 Feb 1, 2012
cachebuster bookmarklet
View gist:1718994
javascript:window.location=window.location.href+(window.location.href.indexOf("?")==-1?"?":"&")+"__cachebuster="+parseInt(Math.random()*99999999);
@thraxil
thraxil / mod7.go
Created May 1, 2012
simple implementation of the mod 7 graph walking algorithm
View mod7.go
// 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:3123935
Created Jul 16, 2012
django project git pre-commit hook
View gist:3123935
#!/usr/bin/env python
import os
import re
import subprocess
import sys
modified = re.compile('^(?:M|A)(\s+)(?P<name>.*)')
CHECKS = [
View gist:3218950
{
"asi" : true,
"bitwise" : true,
"boss" : false,
"browser" : true,
"couch" : true,
"curly" : true,
"debug" : false,
"devel" : true,
"eqeqeq" : true,
@thraxil
thraxil / gist:3239180
Created Aug 2, 2012
goldap interface test
View gist:3239180
package main
import (
"github.com/jmckaskill/goldap"
"fmt"
"os"
)
func printer (r string) {
fmt.Println("out!")
@thraxil
thraxil / gist:5404231
Last active Dec 16, 2015
How to add a gittip button to your github project.
View gist:5404231

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 Jul 6, 2013
This is valid Java
View gist:5940700
public class Foo {
public static void main(String[] args) {
Integer i = 3;
System.out.println("i is: " + i);
}
}
@thraxil
thraxil / gist:5940704
Created Jul 6, 2013
But this is not valid Python:
View gist:5940704
i = 3
print "i is: " + i
# you get: TypeError: cannot concatenate 'str' and 'int' objects
@thraxil
thraxil / gist:6067558
Last active Dec 20, 2015
hekad config to echo input file to output file
View gist:6067558
[LogfileInput]
logfile = "/tmp/input"
seekjournal = "/tmp/hekaseekjournal"
[FileOutput]
message_matcher = "Type =~ /.*/"
path = "/tmp/output"
You can’t perform that action at this time.