Skip to content

Instantly share code, notes, and snippets.

View alts's full-sized avatar

Stephen Altamirano alts

View GitHub Profile
@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)
@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
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 / 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
#!/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?...'
"""
#!/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: