Skip to content

Instantly share code, notes, and snippets.

View alts's full-sized avatar

Stephen Altamirano alts

View GitHub Profile
#!/bin/sh
# Fetch and install the latest Chromium mac nightly build, but only
# if it's different from the currently installed version. An existing
# Chromium.app is backed up to .Chromium.app in the same directory.
#
# Install with:
# $ curl -L http://bit.ly/night-chrome > ~/bin/nightly-chromium
# $ chmod +x ~/bin/nightly-chromium
#
# To upgrade to latest chromium version:
#!/usr/bin/env python
# encoding: utf-8
"""
Reads the image URIs for the various graphs in Google's webmaster tools crawl
stats page, and pulls some data estimates from it.
$ python gwc_decode.py 'https://www.google.com/chart?...'
"""
@alts
alts / dbref.py
Created March 8, 2011 00:10
New __getattr__ definition
# New __getattr__ definition for bson/dbref.py to support pickling
def __getattr__(self, key):
# checking for the mangled name. ugly.
if '_DBRef__kwargs' in self.__dict__:
try:
return self.__kwargs[key]
except KeyError:
pass
def _element_to_bson(key, value, check_keys):
if not isinstance(key, basestring):
raise InvalidDocument("documents must have only string keys, "
"key was %r" % key)
if check_keys:
if key.startswith("$"):
raise InvalidDocument("key %r must not start with '$'" % key)
if "." in key:
raise InvalidDocument("key %r must not contain '.'" % key)
@alts
alts / notes.txt
Created April 17, 2012 20:30
playforge python class
# numbers
>>> 1
1
>>> 1 + 1
2
>>> 1 - 5
-4
>>> 8 * 9
72
>>> 4 / 2
@alts
alts / mutabledict.m
Created May 30, 2012 08:14
investigate how mutable dictionaries grow.
//
// main.m
// nsmutabledict
//
// Created by Stephen Altamirano on 5/29/12.
//
#import <Foundation/Foundation.h>
NSMutableArray* dict_keys(NSMutableDictionary* d)
($>) = flip ($)
-- this defintion is wrong, but is sufficient for our time range
leap_year y = y /= 1900 && y `mod` 4 == 0
month_days m y
| m == 2 && leap_year y = 29
| m == 2 = 28
| m `elem` [4, 6, 9, 11] = 30
| otherwise = 31
#!/usr/bin/env node
var util = require('util');
process.stdin.resume();
process.stdin.setEncoding('utf8');
var chunks = [];
function unique_chars(str) {
var seen = {},
\documentclass{article}
\usepackage{geometry}
\usepackage{fancyhdr}
\usepackage{amsmath ,amsthm ,amssymb}
\usepackage{graphicx}
\usepackage{hyperref}
\begin{document}
Problem 28 can be solved analytically. It's certainly not the most efficient route,
@alts
alts / swizzler.m
Created August 16, 2012 22:37
swizzling class for oBj-c
//
// Swizzler.m
// ZombieFarm
//
// Created by Stephen Altamirano on 8/16/12.
// Copyright (c) 2012 playforge. All rights reserved.
//
#import <objc/runtime.h>
#import "Swizzler.h"