Skip to content

Instantly share code, notes, and snippets.

@mozillalives
mozillalives / Dockerrun.aws.json
Created Sep 25, 2018
Elastic Beanstalk Docker run config
View Dockerrun.aws.json
{
"AWSEBDockerrunVersion": 2,
"volumes": [
{
"name": "shark-cat-app",
"host": {
"sourcePath": "/var/app/current"
}
}
],
@mozillalives
mozillalives / Django_unsignedBigint.py
Last active May 18, 2018 — forked from pinfort/Django_unsignedBigint.py
Django database fields for using unsigned bigint column
View Django_unsignedBigint.py
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 / Toggle Hot Corners.scpt
Created Sep 1, 2017
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
View Toggle Hot Corners.scpt
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
View search.py
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 / gist:1655083
Created Jan 22, 2012
Improved notify for long running terminal tasks
View gist:1655083
#!/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
You can’t perform that action at this time.