Skip to content

Instantly share code, notes, and snippets.

View ketralnis's full-sized avatar

david king ketralnis

View GitHub Profile
@ketralnis
ketralnis / defcon18ninjacrack.c
Created August 4, 2010 22:55
defcon badge bruteforce
#include <stdio.h>
#include <mach/std_types.h>
#include <stdlib.h>
#define TUMBLERS_PER_IMAGE 15
typedef enum {
DEFCON,
EIGHTEEN, // * 0xE38 + 16¢
BADGE,
@ketralnis
ketralnis / lrucache.py
Created September 13, 2010 22:15
simplelrucache.py
"""
A simple LRU cache
"""
class NotFound(object):
pass
class LRUCacheEntry(object):
__slots__ = ('prev', # the next most recently used item
'next',
@ketralnis
ketralnis / gist:617397
Created October 8, 2010 19:40
pylibmc_testleak.py
#!/usr/bin/env python
import pylibmc
print pylibmc.__file__
from pylibmc import Client
import random
import sys
client = Client(['localhost:11211'])
client.behaviors.update({'cas': 1})
@ketralnis
ketralnis / gist:617399
Created October 8, 2010 19:42
redditcastest.py
from r2.models import *
from r2.lib.utils import thread_dump
def cc():
g.cache.caches[0].clear()
g.cache.caches[0].flush_all()
cc()
lid = 42
@ketralnis
ketralnis / psort.py
Created January 3, 2011 19:58
simple parallel sort
#!/usr/bin/env python
import os
import re
import sys
import tempfile
import multiprocessing
from optparse import OptionParser
from subprocess import Popen, PIPE, STDOUT
#!/usr/bin/env python2.7
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt # For plotting graphs.
from contextlib import contextmanager
from collections import namedtuple
import urllib
import json
#!/Users/dking/src/pypy/pypy/translator/goal/pypy-c
#!/usr/bin/env python2.7
import sys
import math
import bisect
import sqlite3
import os.path
import itertools
package com.hipmunk.pig.udfs;
import org.apache.pig.EvalFunc;
import org.apache.pig.backend.executionengine.ExecException;
import org.apache.pig.data.BagFactory;
import org.apache.pig.data.DataBag;
import org.apache.pig.data.DefaultBagFactory;
import org.apache.pig.data.Tuple;
import org.apache.pig.data.TupleFactory;
@ketralnis
ketralnis / keybase proof
Created April 6, 2014 07:07
keybase proof
### Keybase proof
I hereby claim:
* I am ketralnis on github.
* I am ketralnis (https://keybase.io/ketralnis) on keybase.
* I have a public key whose fingerprint is 2847 BF11 A0AA 81FA 5902 B4D9 5ACB 6846 FBDD 29B3
To claim this, I am signing this object:
void* l_alloc_restricted (void *ud, void *ptr, size_t osize, size_t nsize) {
_Executor* self = (_Executor*)ud;
if(ptr == NULL) {
/*
* <http://www.lua.org/manual/5.2/manual.html#lua_Alloc>:
* When ptr is NULL, osize encodes the kind of object that Lua is
* allocating.
*
* Since we don't care about that, just mark it as 0