Skip to content

Instantly share code, notes, and snippets.

View gaqzi's full-sized avatar

Björn Andersson gaqzi

View GitHub Profile
while process.returncode is None:
process.poll()
self._log_from_process(process, 1)
else:
self._log_from_process(process)
@gaqzi
gaqzi / cli.py
Last active September 24, 2016 04:15
class CLI(object):
# […snip…]
def run(self, command_name, paths):
if isinstance(command_name, Command):
command = command_name
else:
command = self.find_command(command_name)
with concurrent.futures.ThreadPoolExecutor(max_workers=1) as pool_executor:
futures = self._schedule_command(command, paths, pool_executor)
@gaqzi
gaqzi / test_views.py
Last active March 12, 2021 08:29
SNS subscription and handler for django
import re
from django.core.urlresolvers import reverse
import responses
AWS_URL = re.compile('.*amazonaws.com.*')
class TestSNSSubscription(object):
### Keybase proof
I hereby claim:
* I am gaqzi on github.
* I am gaqzi (https://keybase.io/gaqzi) on keybase.
* I have a public key whose fingerprint is 984A 69AE 5426 A004 6260 DB2B 8CC4 FC67 C6D6 8BE7
To claim this, I am signing this object:
function if-error() {
local exit_status="$1"
local error_code="$2"
local error_message="${@:3}"
if [ "$exit_status" -ne 0 ] ; then
log-message "(error: $error_code) $error_message"
exit $error_code
fi
}
@gaqzi
gaqzi / bump-it.sh
Last active August 29, 2015 14:10
#!/bin/bash
#
# Usage: bump-it.sh [major|minor|patch|nobump]
# Default: patch
#
# This script uses the gem `bump` to do most of the heavy lifting:
# https://rubygems.org/gems/bump
#
# The updating of the Gemfile is really dump, it expects the gem to be
# specified in the following format exactly: gem 'gem-name', 'version-number'
------------------------------------------------------------
/home/deploy/.virtualenvs/test/bin/pip run on Tue Mar 11 03:39:48 2014
Downloading/unpacking phonenumbers
Getting page https://pypi.python.org/simple/phonenumbers/
URLs to search for versions for phonenumbers:
* https://pypi.python.org/simple/phonenumbers/
Analyzing links from page https://pypi.python.org/simple/phonenumbers/
Found link https://pypi.python.org/packages/source/p/phonenumbers/phonenumbers-3.3a1.tar.gz#md5=72e333619c45d768ab3090f8fdee23fd (from https://pypi.python.org/simple/phonenumbers/), version: 3.3a1
Found link https://pypi.python.org/packages/source/p/phonenumbers/phonenumbers-3.5b1.tar.gz#md5=fe3287722dacdd5c8c8230f1e2e492ce (from https://pypi.python.org/simple/phonenumbers/), version: 3.5b1
@gaqzi
gaqzi / upload-archive-to-phonegap-build.sh
Created September 4, 2013 17:29
Takes a zip/tar.gz and uploads it to PhoneGap build while showing a progress bar.
#!/bin/bash
TOKEN=phonegap-build-access-token
APP_ID=phonegap-build-app-id
PROGRESS_FILE=/tmp/$TOKEN-progress
echo "" > $PROGRESS_FILE
tail -f $PROGRESS_FILE &
curl -X PUT -F file=@$1 https://build.phonegap.com/api/v1/apps/$APP_ID?auth_token=$TOKEN -o /tmp/$TOKEN-progress --progress-bar
kill $!
class Migration(DataMigration):
def forwards(self, orm):
if settings.DEBUG:
app, _ = FacebookApplication.objects.get_or_create(
id=123456,
secret='sssh',
default_scope='user_likes,email'
)
# Yet another test page
page, _ = FacebookPage.objects.get_or_create(id=123456)
*.rb diff=ruby