Skip to content

Instantly share code, notes, and snippets.


Sean Jensen-Grey seanjensengrey

View GitHub Profile
use std::collections::VecDeque;
use std::str::FromStr;
#[derive(Debug, Clone)]
enum OperatorToken {

*** SHED SKIN Python-to-C++ Compiler *** Copyright 2005-2013 Mark Dufour; License GNU GPL version 3 (See LICENSE) perform iterative type analysis

we combine two techniques from the literature, to analyze both parametric polymorphism and data polymorphism adaptively. these techniques are agesen's cartesian product algorithm [0] and plevyak's iterative flow analysis [1] '(the data polymorphic part)'. for details about these algorithms, see ole agesen's excellent Phd thesis [2]. for details about the Shed Skin implementation, see Mark

struct Vector {
impl Vector {
fn new(x:f32,y:f32,z:f32) -> Vector {
Vector { x:x, y:y, z:z }

Java and Spatialite on Centos 6.5

All instructions/links/version are valid as of Oct 15, 2014

Here is how I got up-and running with the Xerial JDBC driver and libspatialite on a Centos 6.5 x86_64 box. This was tested on a instance of the Hortonworks Sandbox

Getting the “Native Libraries” (sqlite3/libspatialite)

Installing required YUM Repositories

seanjensengrey / tlc.lua
Created Mar 28, 2012 — forked from fjolnir/tlc.lua
LuaJIT ObjC bridge
View tlc.lua
-- TLC - The Tiny Lua Cocoa bridge
-- Note: Only tested with LuaJit 2 Beta 9 on x86_64 with OS X >=10.7.3 & iPhone 4 with iOS 5
-- Copyright (c) 2012, Fjölnir Ásgeirsson
-- Permission to use, copy, modify, and/or distribute this software for any
-- purpose with or without fee is hereby granted, provided that the above
-- copyright notice and this permission notice appear in all copies.
seanjensengrey / gist:1686149
Created Jan 27, 2012 — forked from anonymous/gist:1686070
Bash function to open a multiline text file that contains a single URL
View gist:1686149
# can split up a long url into multiple lines in a file url.txt
# and then go to it by typing "ffue url.txt"
function ffue() {
open -a FireFox $(paste -s -d '\0' $1)
seanjensengrey / mrisc.rb
Created Sep 17, 2011 — forked from pachacamac/mrisc.rb
A Simple Assembler Language and VM
View mrisc.rb
#!/usr/bin/env ruby
class MRISC
def run(code)
tokens = code.gsub(/(\*.*?\*)|[^a-z0-9,-;@\._]/,'').split(';')
@vars,stack,i = {:_pc=>-1,:_oc=>0},[],0!{|t| t.chars.first=='@' ? (@vars[t.to_sym]=i-1;nil) : (i+=1;t.split(',').map{|e|numeric?(e) ? e.to_i : e.to_sym})}.compact!
while @vars[:_pc] < tokens.size-1
@vars[:_pc] += 1
@vars[:_oc] += 1
seanjensengrey /
Created Jul 11, 2011 — forked from leegao/
JIT for dummies: JIT compiling RPN in python

If you don't care about the explanation, scroll down to find the code, it's 50 some odd lines and written by someone who doesn't know any better. You have been warned.

What it does

This is a very simple proof of concept jitting RPN calculator implemented in python. Basically, it takes the source code, tokenizes it via whitespace, and asks itself one simple question: am I looking at a number or not?

First, let's talk about the underlying program flow. Pretend that you are a shoe connoisseur with a tiny desk. You may only have two individual shoes on that desk at any one time, but should you ever purchase a new one or get harassed by an unruly shoe salesman without realizing that you have the power to say no (or even maybe?), you can always sweep aside one of the two shoes on the desk (the one on the right, because you're a lefty and you feel that the left side is always superior) onto the messy floor, put the other shoe on the right hand side, and then place your newly acquired shoe in

#!/usr/bin/env python
import optparse
import simplejson as json
import time
LONGNAME = "%s@en-US"
def load_file(filename):
Load a json file and return the resulting object