Skip to content

Instantly share code, notes, and snippets.

@sc68cal
sc68cal / level.py
Created March 28, 2011 15:22
Recursive algorithm test
class level(object):
def __init__(self, date):
self.children = []
self.date = date
def addchild(self,child):
self.children.append(child)
def latest_date(self):
if not self.children:
return self.date
QR Libraries for Python:
http://code.google.com/p/pyqrnative/
https://github.com/hcvst/pyqr
http://pyqrcode.sourceforge.net/
GeoDjango:
http://docs.djangoproject.com/en/1.3/ref/contrib/gis/
diff --git a/helix/hiv/forms.py b/helix/hiv/forms.py
index cbf4a56..5938603 100644
--- a/helix/hiv/forms.py
+++ b/helix/hiv/forms.py
@@ -4,7 +4,7 @@ from django.http import HttpResponseRedirect
from django import forms
from helix.hiv.models import *
from django.contrib.formtools.wizard import FormWizard
-from datetime import datetime
+import time
@sc68cal
sc68cal / main.py
Created April 23, 2011 20:41
Dynamsoft Issue -> Github Issues
from github2.client import Github
import csv
import sys
import re
project = sys.argv[4]
github = Github(username=sys.argv[2], api_token=sys.argv[3],requests_per_second=.25)
data = csv.reader(open(sys.argv[1]))
@sc68cal
sc68cal / map.py
Created April 23, 2011 20:41
MapReduce example
#!/usr/bin/env python
import sys
import re
prog = re.compile("From.*\S{3}\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s\d{2}\s\d{2}:\d{2}:\d{2}\s\d{4}")
for line in sys.stdin:
res = prog.search(line.strip())
if res:
res = res.group().split(" ")
print '%s %s %s %s\t%s' % (res[2],res[3],res[4],res[6],1)
c:\Program Files (x86)\Git\bin\git.exe push "origin" master:master
Done
remote: Push worked, but post-receive failed: Connection reset by peer
remote: /data/github/current/vendor/gems/ruby/1.8/gems/redis-2.2.0/lib/redis/client.rb:234:in `ensure_connected'
remote: /data/github/current/vendor/gems/ruby/1.8/gems/redis-2.2.0/lib/redis/client.rb:114:in `process'
remote: /data/github/current/vendor/gems/ruby/1.8/gems/redis-2.2.0/lib/redis/client.rb:183:in `logging'
remote: /data/github/current/vendor/gems/ruby/1.8/gems/redis-2.2.0/lib/redis/client.rb:113:in `process'
remote: /data/github/current/vendor/gems/ruby/1.8/gems/redis-2.2.0/lib/redis/client.rb:38:in `call'
remote: /data/github/current/vendor/gems/ruby/1.8/gems/redis-2.2.0/lib/redis.rb:428:in `sadd'
remote: /usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
@sc68cal
sc68cal / gist:1095392
Created July 20, 2011 17:16
Python Async
import websocket
import sys
import select
import json
"""
Pulls trading data from MtGox bitcoin exchange,
prints the trading price.
Written to brush up on async programming
@sc68cal
sc68cal / main.m
Created September 28, 2011 17:51
#import <Foundation/Foundation.h>
#import <dirent.h>
int main(){
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
DIR *dp = opendir("/usr/share/man/man3");
struct dirent *dpr;
NSFileManager *manager = [NSFileManager defaultManager];
NSArray *output = [NSArray arrayWithObjects:
[NSMutableArray array],
git command: Starting process: git log --no-color --pretty=medium HEAD
git command: Starting process: git config --list
git command time: [00:00:00.9687562] config --list
git command time: [00:00:01.1562574] log --no-color --pretty=medium HEAD
git command: Starting process: git diff-index --name-status -M HEAD
git command time: [00:00:00.0468753] diff-index --name-status -M HEAD
Fetching changes from TFS to minimize possibility of late conflict...
git command: Starting process: git log --no-color --pretty=medium refs/remotes/tfs/default
git command time: [00:00:00.2031263] log --no-color --pretty=medium refs/remotes/tfs/default
info: refs/remotes/tfs/default: Getting changesets from 26154 to current ...
@sc68cal
sc68cal / tps.sh
Created December 1, 2011 19:11
Time reporting script for HR bean counters
git log --author=\"Collins, Sean\" --reverse --since=`date -d 'yesterday' +%Y/%m/%d` --pretty=format:%s tfs/default | sed "s/$/\r/" > /dev/clipboard