Skip to content

Instantly share code, notes, and snippets.

View danse's full-sized avatar

frances danse

  • Internet
View GitHub Profile
@danse
danse / gist:1646450
Created January 20, 2012 09:39
python super
class C(B):
def method(self, arg):
super(C, self).method(arg)
@danse
danse / gist:1670750
Created January 24, 2012 15:41
Add autocompletion to python shell
To add autocompletion to the python shell, add the following export into your .bashrc file:
export PYTHONSTARTUP=/home/<user>/.pythonstartup
Where <user> is your username, and .pythonstartup is a file containing the following two lines:
import rlcompleter, readline
readline.parse_and_bind('tab: complete')
To test if the change worked, start a python shell and type
@danse
danse / gist:1683323
Created January 26, 2012 15:41
Generate a random password with a precise starting sequence
# paste this on the shell
startgen () { while ! pwgen -nyc | grep "^$1"; do :; done }
# then use it like
# startgen B
@danse
danse / gist:2481178
Created April 24, 2012 16:23
revert commit
svn merge --dry-run -rHEAD:2650 .
exec(compile(open(__file__).read(), __file__, 'exec'))
from https://github.com/pypa/pip/issues/45
>>> from dateutil import parser
>>> f['2011-07-02T00:00:00']=f['2011-07-02T00:00:00'].map(parser.parse)
@danse
danse / gist:3931532
Created October 22, 2012 13:32
insert control characters
Ctrl-V Ctrl-<Char>
""" Blame All for svn, like p4 annotate -a.
Ned Batchelder.
http://nedbatchelder.com/code/utilities/blameall.html
Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
"""
from difflib import SequenceMatcher
import optparse, re, subprocess, sys
@danse
danse / git reminder.md
Last active December 9, 2015 17:08
git reminder
push origin --delete <branchName>
git push origin --tags
merge -s recursive -Xtheirs upstream/master
reset --soft HEAD^
git rebase --ignore-date
git add --all <path>

reset a branch to its origin

@danse
danse / force.html
Last active December 10, 2015 00:48
trying to go closer to collision detection
<!DOCTYPE html>
<html>
<head>
<title>Force-Directed Graph</title>
<!--
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/d3/3.0.1/d3.v3.min.js"></script>
-->
<script type="text/javascript" src="d3.v3.min.js"></script>
</head>
<body>