This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Install | |
------------------- | |
- colordiff (svn diff w/ colors) | |
- git | |
- gvim w/ python support | |
- exuberant-ctags | |
- xchat | |
- pylint |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Requires github.com/durden/frappy | |
from frappy.services.github import Github | |
g = Github() | |
sizes = 0 | |
res = g.users.durden.repos() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env sh | |
## | |
# This is script with usefull tips taken from: | |
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx | |
# | |
# install it: | |
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
""" | |
Simplified stand-alone script to mimic codrspace.com short code processing. | |
Script takes 1 optional argument, the path of your python environment. | |
The rest of the input is read directly from stdin and expected to be codrspace | |
markdown text. The output is codrspace html after all markdown and codrspace | |
specific short codes have been processed. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# NOTE: Idea for this script came from: | |
# spotify-export (https://github.com/jlund/spotify-export) | |
# To install/setup | |
# pip install -r requirements.txt | |
# python export.py <file> | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class DictDiffer(object): | |
""" | |
Calculate the difference between two dictionaries as: | |
(1) items added | |
(2) items removed | |
(3) keys same in both but changed values | |
(4) keys same in both and unchanged values | |
""" | |
def __init__(self, current_dict, past_dict): | |
self.current_dict, self.past_dict = current_dict, past_dict |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class myobject(object): | |
ATTR_CACHE = {} | |
def __init__(self, *args, **kwargs): | |
for arg in args: | |
print arg | |
super(myobject, self).__init__(*args, **kwargs) | |
def __new__(cls, *args, **kwargs): | |
# At this point cls is NOT created, it's just a string :) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def watch_variables(var_list): | |
"""Usage: @watch_variables(['myvar1', 'myvar2'])""" | |
def _decorator(cls): | |
def _setattr(self, name, value): | |
if name in var_list: | |
import traceback | |
import sys | |
# Print stack (without this __setattr__ call) | |
traceback.print_stack(sys._getframe(1)) | |
print '%s -> %s = %s' % (repr(self), name, value) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import argparse | |
import requests | |
import time | |
def _parse_args(): | |
parser = argparse.ArgumentParser(description='Zen out with github') | |
# Github api limits 60/hour for unauthenticated requests | |
parser.add_argument('--sleep', type=float, default=60.0, action='store', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Just playing around and thinking about how itertools.count might work (without # looking at source :) ) | |
# Simple version of a 'static' variable in C, just keep state internally | |
# and use next() to get values out | |
def counter(): | |
for ii in xrange(100): | |
yield ii | |
cnt = counter() | |
print cnt.next() |