Skip to content

Instantly share code, notes, and snippets.

@mozillalives
mozillalives / gist:1655083
Created January 22, 2012 02:05
Improved notify for long running terminal tasks
#!/usr/bin/env python
# I tried the notify script at http://www.simplicidade.org/notes/archives/2007/08/tip_use_growlno.html but
# I always received errors with it. Not being a bash guy, I wrote mine in python.
# To use this, just save it as something like "n" in your bin/, mark it as executable and prepend it to
# whatever you plan on calling. For example.
# nj rm -rf blah
import sys
@mozillalives
mozillalives / search.py
Created August 17, 2012 02:47
Search and Serve
from whoosh import index, qparser
def search(blah, page, length):
ix = index.open_dir(INDEX_DIR)
with ix.searcher() as s:
q = qparser.QueryParser("content", ix.schema).parse(blah)
r = s.search_page(q, page, pagelen=length)
t = []
for res in r:
t.append({'field1': res['field1'],
@mozillalives
mozillalives / Toggle Hot Corners.scpt
Created September 1, 2017 12:38
Just a simple applescript I wrote years ago to toggle hot corners on or off. Useful when you're about to play a game and don't want to suddenly have your display go to sleep XD
property theSavedValues : {"Put Display to Sleep", "Desktop", "Mission Control", "Application Windows"}
# or this can be something like
# property theSavedValues : {"Put Display to Sleep", "-", "-", "-"}
tell application "System Preferences"
activate
set current pane to pane id "com.apple.preference.expose"
tell application "System Events"
delay 1 # you might need to tweak this for your system
@mozillalives
mozillalives / Django_unsignedBigint.py
Last active May 18, 2018 17:45 — forked from pinfort/Django_unsignedBigint.py
Django database fields for using unsigned bigint column
from django.db import models
from django.utils.translation import ugettext
class PositiveBigIntegerRelDbTypeMixin(models.fields.PositiveIntegerRelDbTypeMixin):
def rel_db_type(self, connection):
if connection.features.related_fields_match_type:
return self.db_type(connection)
else:
return models.BigIntegerField().db_type(connection=connection)
@mozillalives
mozillalives / Dockerrun.aws.json
Created September 25, 2018 17:48
Elastic Beanstalk Docker run config
{
"AWSEBDockerrunVersion": 2,
"volumes": [
{
"name": "shark-cat-app",
"host": {
"sourcePath": "/var/app/current"
}
}
],