This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/zsh | |
# Global virtualenvwrapper postactivate, lives in $WORKON_HOME/postactivate | |
# Remove virtual env from start of PS1 as it's in RPROMPT instead | |
PS1="$_OLD_VIRTUAL_PS1" | |
PROJECT_DIR="$HOME/projects/$(basename $VIRTUAL_ENV)" | |
if [ -d $PROJECT_DIR ]; then | |
# If we aren't already within the project dir, cd into it |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from mongoengine import * | |
from mongoengine.queryset import QuerySet | |
class PostQuerySet(QuerySet): | |
def delete(self, safe=False): | |
ids = [post.id for post in self] | |
Comment.objects(post__in=ids).delete(safe=safe) | |
super(PostQuerySet, self).delete(safe=safe) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name GitHub Contributor Compare | |
// @description Adds a compare link to forked repo commit pages | |
// @match http://github.com/*/commit/* | |
// @match https://github.com/*/commit/* | |
// ==/UserScript== | |
var onLoad = function(callback) { | |
var script = document.createElement("script"); | |
var src = "http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
"""Script that I keep in a Git repository along with my dotfiles. In the | |
repository, the files don't have the dot prefix so I can see them more easily. | |
Running the script symlinks all the files to ~/.<filename>, checking allowing | |
you to cancel if the file exists. | |
""" | |
import os | |
import glob |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import mongoengine | |
from mongoengine.document import Document | |
from mongoengine.fields import StringField, ListField | |
import time | |
from contextlib import contextmanager | |
from random import sample, randint | |
def create_data(): | |
words = unicode(open('/usr/share/dict/words').read(), 'utf8').split() |
NewerOlder