Skip to content

Instantly share code, notes, and snippets.

jiaaro /
Last active Dec 10, 2015
Magical, automatic super class caller in python (a terrible idea)
import inspect
def magicsuper(*args, **kwargs):
frame = inspect.currentframe().f_back
first_arg_name = frame.f_code.co_varnames[0]
self = frame.f_locals[first_arg_name]
super_klass = super(self.__class__, self)
return getattr(super_klass, frame.f_code.co_name)(*args, **kwargs)
jiaaro / simpleTarget.js
Last active Dec 16, 2015
Partially de-obfuscated simpleTarget() from
View simpleTarget.js
// library function…
// o.lib.targeting.simpleTarget(ship, pos)
// mostly deobfuscated/deminified
function simpleTarget(ship, pos) {
var i, r, h,
torque = 0,
thrust = 0,
dir = o.lib.targeting.dir(ship, pos);
jiaaro /
Created Jun 4, 2013
solution to the homework in "Machine Learning for Humans: K Nearest-Neighbor" at (
from collections import Counter
K = 3
dataset = [
# weight, color, # seeds, type
[303, 3, 1, "banana"],
[370, 1, 2, "apple"],
[298, 3, 1, "banana"],
[277, 3, 1, "banana"],
[377, 4, 2, "apple"],
# add new database to addons before running this
# fill in the blank
heroku maintenance:on
heroku scale web=0
heroku pgbackups:capture --expire
jiaaro / sub.js
Last active Dec 27, 2015
v1 of implementing xkcd substituions:
View sub.js
function replace(txt) {
txt = txt.replace(/witnesses/gi, "dudes I know");
txt = txt.replace(/allegedly/gi, "kinda probably");
txt = txt.replace(/new study/gi, "tumblr post");
txt = txt.replace(/rebuild/gi, "avenge");
txt = txt.replace(/space/gi, "spaaace");
txt = txt.replace(/google glass/gi, "virtual boy");
txt = txt.replace(/smartphone/gi, "pokédex");
txt = txt.replace(/electric/gi, "atomic");
txt = txt.replace(/senator/gi, "elf-lord");
jiaaro /
Last active Jan 2, 2016
add audioop.max() to pypy? twitter: @jiaaro - email:
import struct
import math
from ctypes import create_string_buffer
class error(Exception):
# this module redefines the names of some builtins that are used
max_ = max
jiaaro /
Last active Jan 4, 2016
NOTE: belongs in a directory "breeder"
#!/usr/bin/env python
import ast
from os.path import isfile
from hashlib import md5
from random import randint, choice
from glob import glob
import re
# scratch area
jiaaro /
Last active Mar 16, 2016
Calculate the value of your investments and savings at some point in the future
class Investment(object):
def cash_invested_by_month(self, month):
raise NotImplementedError
def value_in_month(self, month):
raise NotImplementedError
class SingleInvestment(Investment):
def __init__(self, amount, monthly_interest_rate, month=0):

Keybase proof

I hereby claim:

  • I am jiaaro on github.
  • I am jiaaro ( on keybase.
  • I have a public key ASAmjWlR2gGlcJGuKzzPQ4UDqxXW0WeP-NDoJACLKWKo7go

To claim this, I am signing this object:

View App Revenue

If you've ever wondered what it's be like to "go indie" here is a script with some assumptions that might help you project your income.


  • You will make a new app every month
  • Apps have a useful life of 3 years (after that they stop earning money)
  • Apps will earn $250 in their launch month
  • Apps will earn $100/mo at first (starting month 2), but that revenue will slowly decline (~50% each year)
  • As you make more apps your brand/mailing list will start to pay dividends (after 4 apps you'll see the numbers above double, after 8 they'll 3x, and so on)

So how would that work out?