Skip to content

Instantly share code, notes, and snippets.

@leandrosilva
leandrosilva / README
Created May 29, 2011 02:04
Playing with Clojure, Redis, Compojure, and Jedis library
As always, I'm just playing with interesting things to relax a little bit. Just it.
== 1. Dependencies
I tried to use redis-clojure but it sucks and I shifted to Jedis which rocks. So if you want to try
as well, this little joke (ops! I mean...) program depends on:
* org.clojure/clojure "1.2.0"
* org.clojure/clojure-contrib "1.2.0"
* redis.clients/jedis "1.5.2"
@Cairnarvon
Cairnarvon / nottineye.py
Created June 4, 2011 14:25
Tineye-style image search, locally. Everyone's a winner. (Requires PIL. --help for usage.)
#!/usr/bin/python
import glob
import math
import os
import getopt
import sys
from PIL import Image
@mattetti
mattetti / main.go
Created June 6, 2011 01:48
Go's reflection example
package main
import(
"fmt"
"reflect"
)
func main(){
// iterate through the attributes of a Data Model instance
for name, mtype := range attributes(&Dish{}) {
@jdmaturen
jdmaturen / pbc_pool_transport.py
Created June 20, 2011 23:39
Riak python client PBC connection pooling
import logging
log = logging.getLogger('socrates')
from Queue import Empty, Full, Queue
from riak.transports import RiakPbcTransport
from riak.transports.transport import RiakTransport
class PbcPoolTransport(RiakTransport):
@kimsterv
kimsterv / gist:1040741
Created June 22, 2011 18:23
Clean bad gzips
#!/bin/bash
for i in `hadoop fs -lsr /flume/incoming/2011/04 | awk '{print $8}'`; do
echo $i; hadoop fs -cat $i | gzip -t
if [ $? -ne 0 ] && [ -n "`echo \"$i\" | grep 'gz$'`" ]; then
`echo hadoop fs -rmr -skipTrash $i`
fi
done
anonymous
anonymous / Prelude.cs
Created July 16, 2011 21:36
Oh, you poor, poor imperative developers...
/* Prelude.cs : What happens when a haskell programmer learns C#.
Copyright (c) 2011 Clark Gaebel
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
@maraca
maraca / gist:1096231
Created July 21, 2011 00:12
Coding in French
#!/utilisateur/bin/frython
@privé
le debut class (ma variable)
le debut init(moi)
imprime 'Bonjour Monde'
le fin
le fin
@lalinsky
lalinsky / fp-find.py
Created July 22, 2011 18:02
Locate audio snippets in a longer stream
def format_time(secs):
return "%d:%02d" % (secs / 60, secs % 60)
def invert(arr):
"""
Make a dictionary that with the array elements as keys and
their positions positions as values.
>>> invert([3, 1, 3, 6])
@alexalemi
alexalemi / twittercompress.py
Created August 31, 2011 03:24
Twitter Compression
""" A script to attempt the compression of written english
to the chinese character set """
import os
from collections import OrderedDict
from math import log
import itertools
from collections import Counter
@Cairnarvon
Cairnarvon / chaos.c
Created October 25, 2011 22:41
What ho, chaos game.
/* gcc -Wall -Wextra `allegro-config --libs` -lm w.c */
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <allegro.h>
#define POINTS 3
#define WIDTH 600