Skip to content

Instantly share code, notes, and snippets.

View mlbright's full-sized avatar

Martin-Louis Bright mlbright

  • Toronto
  • 20:08 (UTC -04:00)
View GitHub Profile
#!/usr/bin/python
# take a master css file and inject @import css files into it.
import re, os, sys
bigcss = []
path = sys.argv[1]
output = sys.argv[2]
#!/bin/bash
# remove all svn:external references
# in a bunch of numbered directories
for i in {2..17}
do
echo $i
svn propdel svn:externals package.$i/build
done
#!/usr/bin/python
# read an svn parent page and export everything
import re
import urllib2
from BeautifulSoup import BeautifulSoup
from subprocess import call
import os
subversion = 'http://subversion.tigris.org/'
#!/bin/bash
# rsync pull from remote to local
rsync -azv --rsync-path=/usr/local/bin/rsync --delete --force jira@<some ip>:attachments/ /var/jira/jira-data/attachments/
#!/usr/bin/python
# vim settings python
print "yes"
# vim: set et ts=4 sw=4 tw=72 nu:
#!/bin/bash
# better grep if you use svn
# Copyright 2004 Ben Reser <ben@reser.org>
# Licensed under the terms subversion ships under or GPLv2.
# Useful for greping in a subversion working copy.
# Essentially it behaves the same way your grep command does (in fact it
# ultimately calls the grep command on your path) with a few exceptions.
# Ignores the subversion admin directories (.svn) and vi(m) backup files.
#!/usr/bin/python
# Ou bouffer a Paris
import urllib2
import re
import time
import random
import sys
try:
import json
#!/usr/bin/python
# primes up to 10000
# Steve Krenzel's code
r,e,a = range,enumerate,all
for i,x in e(i for i in r(4,10**4) if a(i%j!=0 for j in r(3,i))):
print x
#!/usr/bin/python
# smarts from Steve Krenzel
import sys, time
from random import randint
from math import sqrt, ceil, floor, log
MAX = 20000000
def sieveOfErat(upperBound):
""" Tarjan's algorithm and topological sorting implementation in Python
by Paul Harrison, Public domain, do with it as you will"""
def strongly_connected_components(graph):
""" Find the strongly connected components in a graph using
Tarjan's algorithm.
graph should be a dictionary mapping node names to
lists of successor nodes.
"""