Skip to content

Instantly share code, notes, and snippets.

Andrew Brookins abrookins

Block or report user

Report or block abrookins

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@abrookins
abrookins / gist:3440646
Created Aug 23, 2012
Set the path of an ImageField in Django
View gist:3440646
from django.db import models
# Assuming this model.
class Example(models.Model):
image = models.ImageField(upload_to="somewhere/special")
# You want to set this field to point to an existing image (in a script, or a view, etc.).
example = Example.objects.get(id=1)
View cVimrc
set smoothscroll
let blacklists = ["https://mail.google.com/*", "*://mail.google.com/*", "@https://mail.google.com/mail/*"]
View sVimrc
let mapleader = ","
let newtaburl = "https://google.com"
let blacklists = ["*://safari.atlassian.net/*", "*://mail.google.com/*", "*://inbox.google.com/*", "*://calendar.google.com/*", "*://*.slack.com/*"]
let scrollstep = 20
map "<Leader> m" zoomPageIn
@abrookins
abrookins / init.lua
Last active Mar 30, 2017
Restart fastkit with Hammerspoon when DNS changes
View init.lua
local network = hs.network.configuration.open()
local fastkitPath = '~/.rbenv/shims/fastkit'
local home = '/Users/andrew'
function fastkitCompleted(exitCode, stdOut, stdErr)
if exitCode ~= 0 then
hs.alert.show("Fastkit failed to reload")
log.d(stdOut)
end
end
@abrookins
abrookins / gist:1933635
Created Feb 28, 2012
A Sublime Text 2 Django project file with a test runner build system
View gist:1933635
{
"folders":
[
{
"path": "django_project_dir"
},
{
"path": "lib/python2.7"
}
],
@abrookins
abrookins / gist:5479607
Last active Dec 16, 2015
Example code for in-memory proximity search with Python (2).
View gist:5479607
import flask
from flask.ext.cache import Cache
from siren import util, crime_tracker
from siren.decorators import jsonp
app = flask.Flask(__name__)
app.config.from_envvar('SIREN_SETTINGS', silent=True)
cache = Cache(app)
crime_db = crime_tracker.PortlandCrimeTracker()
@abrookins
abrookins / gist:5478445
Last active Dec 16, 2015
Example code for in-memory proximity search with Python (1).
View gist:5478445
from scipy.spatial import cKDTree
from scipy import inf
# ... Some code removed for clarity ...
class PortlandCrimeTracker(object):
DEFAULT_DATABASE_NAME = 'db'
def __init__(self, db_filename=DEFAULT_DATABASE_NAME):
crime_db = self.load_crimes_db(db_filename)
View gist:301d3e0212d682413bb0
@-webkit-keyframes fadein {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
#sVim-command {
@abrookins
abrookins / gist:3553655
Created Aug 31, 2012
Add django_notebook extension to IPython config
View gist:3553655
c.InteractiveShellApp.extensions = [
'django_notebook'
]
@abrookins
abrookins / gist:3553617
Created Aug 31, 2012
Install django_notebook extension from within IPython
View gist:3553617
%install_ext https://raw.github.com/abrookins/django_notebook/master/django_notebook.py
You can’t perform that action at this time.