Skip to content

Instantly share code, notes, and snippets.

View leewardbound's full-sized avatar

Leeward Bound leewardbound

View GitHub Profile
# In .vimrc
" ipython integration
autocmd FileType python map <F5> :w<CR>:!screen -x ipython -X stuff $'\%reset\ny\n\%cd %:p:h\n\%run %:t\n'<CR><CR>
# In .bashrc
function vips() {
# A named screen session attached to ipython
# so it can be sent commands (from vim)
screen -D -R -S ipython ipython
@leewardbound
leewardbound / bootstrap.sh
Created June 2, 2011 20:50 — forked from anonymous/bootstrap.sh
Django on Heroku with Celery and Sentry
virtualenv --no-site-packages .
source bin/activate
bin/pip install Django psycopg2 django-sentry
bin/pip freeze > requirements.txt
bin/django-admin.py startproject mysite
cat >.gitignore <<EOF
bin/
include/
lib/
EOF

Development Journal

9/13/11 --- I have finished the research

PHP:

New Visitors:

Time elapsed: 0.56040978431702

def curry_instance_attribute(attr, func_name, instance):
""" Curries the named attribute to the named function
>>> class Person():
... def __init__(self, name):
... self.name = name
... curry_instance_attribute('name', 'print_record', self)
... @classmethod
... def print_record(cls, name):
... print 'Person',name
>>> Person.print_record('bob')
@leewardbound
leewardbound / redis-server.init.d
Created June 13, 2012 19:26
Ubuntu Redis init.d file
#! /bin/sh
### BEGIN INIT INFO
# Provides: redis-server
# Required-Start: $syslog $remote_fs
# Required-Stop: $syslog $remote_fs
# Should-Start: $local_fs
# Should-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: redis-server - Persistent key-value db
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(function() {
$('#Table_03a').hide();
changeCheckBox(137);
});
var internal = 0;
@leewardbound
leewardbound / jquery-bridge.js
Created September 19, 2012 21:11
jquery-bridge.js
var link = "http://YOUR_SITE_HERE";
var top_loc = window.top.location;
var qs = top_loc.search || window.location.search || "?";
var rand_seed = Math.floor((Math.random()*100)+1);
link = link + qs;
var redir = function() {
document.write ('<center><br /><br /><a href="'+link+'">Click here if you are not redirected</a></center>');
if(window.top && window.top.location)
window.top.location = link;
@leewardbound
leewardbound / bltbot.py
Last active December 12, 2015 00:48
Quits all group chatrooms with IlyaBLT in them. We don't trust him, and a ghost is bad for communities like ours. Read the install instructions at the top of the file below.
#!/usr/bin/env python
"""
Needs 2 dependencies --
+ Install python 2.6-2.8 (Only necessary on windows, because OS-X and linux have it)
+ Install Skype4Py library
download it from here: https://github.com/awahlig/Skype4Py
then from a command line:
class CustomIDModel(models.Model):
named_id = models.CharField(max_length=128, primary_key=True, blank=True, editable=False)
def save(self, *args, **kwargs):
named_stub = '{0:6d}'.format(self.id).replace(' ', '0')
self.named_id = 'DS-' + named_stub[:3] + '-' + named_stub[3:3]
return super(CustomIDModel, self).save(*args, **kwargs)
@leewardbound
leewardbound / CIDR.php
Last active August 29, 2015 14:19 — forked from jonavon/CIDR.php
<?php
/**
* CIDR.php
*
* Utility Functions for IPv4 ip addresses.
* Supports PHP 5.3+ (32 & 64 bit)
* @author Jonavon Wilcox <[email protected]>
* @revision Carlos Guimarães <[email protected]>
* @version Wed Mar 12 13:00:00 EDT 2014
*/