Skip to content

Instantly share code, notes, and snippets.

@noonat
noonat / cube.mtl
Created August 8, 2011 02:10
Cube OBJ and MTL file
newmtl cube
Ns 10.0000
Ni 1.5000
d 1.0000
Tr 0.0000
Tf 1.0000 1.0000 1.0000
illum 2
Ka 0.0000 0.0000 0.0000
Kd 0.5880 0.5880 0.5880
Ks 0.0000 0.0000 0.0000
@noonat
noonat / Main.hx
Created August 10, 2011 21:54
Apple property list parser in HaXe
/**
* Apple property list parser.
*
* For example, the following property list XML:
*
* <?xml version="1.0" encoding="UTF-8"?>
* <plist version="1.0">
* <dict>
* <key>foo</key>
* <integer>1</key>
$ mongo
MongoDB shell version: 2.0.0
connecting to: test
> quit
function () {
return nativeHelper.apply(quit_, arguments);
}
> quit.toString = function() { return 'Type quit() to quit.'; }
function () {
return "Type quit() to quit.";
@noonat
noonat / gist:1649543
Created January 20, 2012 21:02
Rake Quick Reference
# Rake Quick Reference
# by Greg Houston
# http://ghouston.blogspot.com/2008/07/rake-quick-reference.html
# -----------------------------------------------------------------------------
# Running Rake
# -----------------------------------------------------------------------------
# running rake from the command-line:
# rake --help
@noonat
noonat / powerset.coffee
Created February 3, 2012 22:18
Power sets
powerSet = (set) ->
p = [[]]
for val in set
for i in [0...p.length]
p[p.length] = p[i].concat([val])
p
FILES=$(echo "man1/mailq.1
man1/newaliases.1
man1/postalias.1.gz
man1/postcat.1.gz
man1/postconf.1.gz
man1/postdrop.1.gz
man1/postfix.1.gz
man1/postkick.1.gz
man1/postlock.1.gz
man1/postlog.1.gz
window.sha1 = (function() {
/*
* A JavaScript implementation of the Secure Hash Algorithm, SHA-1, as defined
* in FIPS 180-1
* Version 2.2 Copyright Paul Johnston 2000 - 2009.
* Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
* Distributed under the BSD License
* See http://pajhome.org.uk/crypt/md5 for details.
*/
@noonat
noonat / level1.py
Created January 24, 2013 20:34
Some code to solve the Colossal Cue puzzles at http://adventure.cueup.com/
m = 4294967296
a = 69069
c = 1
seed = 6
for i in range(4):
seed = (a * seed + c) % m
print "%i" % (seed % 36)
@noonat
noonat / get_subs.py
Last active December 19, 2015 10:09
#!/usr/bin/env python
from __future__ import print_function
import argparse
import os
import requests
import sys
import zlib
from pythonopensubtitles import opensubtitles, utils
// really slow: ~50s
try {
return ret.concat.apply([], ret);
} catch (e) {
if (e instanceof RangeError && ret.reduce) {
return ret.reduce(function(a, b) {
return a.concat(b);
}, [])
} else {
throw e;