Skip to content

Instantly share code, notes, and snippets.

View mjard's full-sized avatar

Michael Jard mjard

  • Misadventure Games
View GitHub Profile
size(500, 425, P3D)
frameRate(30)
background(0)
noStroke()
val heart = {
val l = createGraphics(50,50,P3D)
l.beginDraw
l.noStroke
l.fill(255,0,0)
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
class Migration(DataMigration):
def forwards(self, orm):
"Write your forwards methods here."
#!/bin/bash
for gzip_file in *.gz; do
gzip -t $gzip_file 2> /dev/null
if [ $? -ne 0 ]; then
echo $gzip_file >&2
rm $gzip_file
fi
echo -n "."
done
echo ""
#include <stdio.h>
int
main(int argc, char *argv[])
{
char c[]="wat is this, because this is a lie",*a=&c[0],*b=&c[0]+(sizeof c-1);
while(a<--b){*a=*a+*b;*b=*a-*b;*a=*a-*b;a++;}
printf("%s\n",c);
return 0;
}
from collections import defaultdict
from itertools import combinations
worddict = defaultdict(list)
letters='sillystring'
for word in file('/usr/share/dict/words'):
w = word.strip().lower()
worddict["".join(sorted(w))].append(w)
@mjard
mjard / intro.txt
Created March 5, 2012 00:32
Gist Spie
This is the first iteration of a helpful gist irc roebit.
Try the following commands:
!gists - lists the last 5 gists pasted in the channel
!gists kaptin - list the last 5 gists pasted by kaptin
!search <search term> - search the last 5 gists with the search terms in the description
I'm welcome to questions and suggestions.
-Kaptin
# pythonic
def map(source, func):
dest = []
for x in source:
dest.append(func(x))
return dest
# list comprehension
def map(source, func):
return [func(x) for x in source]
# kaptin, safe from desg
def map(source, func):
return __builtins__.map(func, source)
# sixthgear
def mop(source, func):
return map(func, source)
# pythonic
def map(source, func):
@mjard
mjard / httpd_sample.go
Created November 26, 2012 09:06
Few things to benchmark
package main
import (
"fmt"
"io"
"net/http"
"os"
"strings"
)
@mjard
mjard / bench_interfaces.go
Created December 12, 2012 20:30
Benchmarking Go Interfaces
package main
import (
"testing"
)
func Nop() {
}
type Stupid interface {