Skip to content

Instantly share code, notes, and snippets.

View kragen's full-sized avatar

Kragen Javier Sitaker kragen

View GitHub Profile
this is the content

Here are the top few things I learned about Git, mostly in the first few hours I used it. This is the document I wished I had had, on top of the various introductions floating around. Maybe it will be useful to somebody else.

  1. Git handles 400MB of HTML crawl data less gracefully than it handles 700K of Python. But it handles that data more gracefully than cp and rsync do.

  2. Don't git push to a repository that actually has a work area.

new content
/* produce the cyclic shifts of each input line -*- coding: utf-8 -*- */
/* A sort of rebuttal to “Yannis’s Law”. Yannis quotes from [Parnas
* 1972] (http://sunnyday.mit.edu/16.355/parnas-criteria.html):
*
* > The KWIC index system accepts an ordered set of lines, each line
* > is an ordered set of words, and each word is an ordered set of
* > characters. Any line may be "circularly shifted" by repeatedly
* > removing the first word and appending it at the end of the
* > line. The KWIC index system outputs a listing of all circular
* > shifts of all lines in alphabetical order. This is a small
<type 'exceptions.AttributeError'>
Python 2.5: /usr/bin/python2.5
Sun Dec 14 15:58:45 2008
A problem occurred in a Python script. Here is the sequence of
function calls leading up to the error, in the order they occurred.
/home/kragen/devel/watchdog-git/import/parse/fec_crude_csv.py in <module>()
535 destdir = sys.argv.pop(1)
536 pattern = sys.argv[1] if len(sys.argv) > 1 else None
#!/usr/bin/python
"Second-order Markov-chain text generator."
import sys, random
def words(infile):
for line in infile:
for word in line.split(): yield intern(word)
freqs = {}
state = [None, None]
for word in words(sys.stdin):
>>> def f():
... a = 1
... b = 2
... a, b = b, a
...
>>> import dis
>>> dis.dis(f)
2 0 LOAD_CONST 1 (1)
3 STORE_FAST 0 (a)
From 9c421b3e3a771f015f300aa6439aa7028500b2fa Mon Sep 17 00:00:00 2001
From: kragen <kragen@ubuntu.cpe.telecentro.net.ar>
Date: Mon, 19 Jan 2009 10:49:47 -0200
Subject: [PATCH] fixing error where a single 2.x file would raise StopIteration and kill the whole zipfile
---
import/parse/fec_crude_csv.py | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/import/parse/fec_crude_csv.py b/import/parse/fec_crude_csv.py
Here is weakmaina.c:
#include <stdio.h>
int main(int argc, char **argv) __attribute__((weak, alias("maina")));
int maina(int argc, char **argv) {
printf("in A main\n");
return 0;
}
#!/usr/bin/python
import time
def compute_perms(str):
if len(str) == 2:
return [ str, "%s%s" % (str[1], str[0]) ]
else:
accum = []
char = str[-1]