Skip to content

Instantly share code, notes, and snippets.

View jaddison's full-sized avatar

James Addison jaddison

View GitHub Profile
@jaddison
jaddison / branching-strategy.md
Last active January 20, 2020 17:29
Defining a git branching strategy that works well with CI/CD

Current State

We have something like this set up at the moment; 2 repos (aws and github):

  • master (aws)
  • next (aws)
  • integation (aws)
  • master (gh)
  • next (gh)
  • integration (gh)
@jaddison
jaddison / settings_singleton_model_example.py
Created October 22, 2018 23:34
settings_singleton_model_example
# models.py
# the dev adds new fields to this as the client asks for more features
class ClientSettings(models.Model):
base_labour_rate = models.FloatField(...)
# middleware.py
class ClientSettingsMiddleware(object):
_settings = None
@jaddison
jaddison / suprnova_check.sh
Created January 10, 2018 03:59
Suprnova JSON API hash/share rate & balance script
#!/bin/bash
if [[ ! -v SUPRNOVA_KEY ]]
then
echo -e "SUPRNOVA_KEY environment variable isn't set.\n\nThis should be the API key from your Suprnova account."
exit 1
fi
if [[ ! -v SUPRNOVA_TARGET ]]
then
echo -e "SUPRNOVA_TARGET environment variable isn't set.\n\nThis should be 'zcl' if you are connecting to 'zcl.suprnova.cc'"
0x9F7863A61e3A9E4746A650D02CbBE8F1b857f09d
0x561E9A2d7cC2FfB8DcB098faD6d221d40dec509c
@jaddison
jaddison / vagrant-clean.sh
Last active August 31, 2015 18:49 — forked from jdowning/vagrant-clean.sh
Script to clean up Ubuntu Vagrant box before packaging
#!/bin/bash
# This script zeroes out any space not needed for packaging a new Ubuntu Vagrant base box.
# Run the following command in a root shell:
#
# bash <(curl -s https://gist.github.com/justindowning/5670884/raw/vagrant-clean.sh)
function print_green {
echo -e "\e[32m${1}\e[0m"
}
@jaddison
jaddison / urls.py
Last active August 29, 2015 14:28
Django URL Dispatcher example
from django.conf import settings
from django.conf.urls import include, url
from django.conf.urls.static import static
from django.contrib import admin
from django.urls import Constraint, Resolver404
"""
where the following in in the project settings.py:
SITE_DOMAIN_MY = ('http', 'my.example.com')

Keybase proof

I hereby claim:

  • I am jaddison on github.
  • I am jamesaddison (https://keybase.io/jamesaddison) on keybase.
  • I have a public key whose fingerprint is AE7B AA19 D3DE 0614 0D08 67B6 1A39 8609 930F 09DB

To claim this, I am signing this object:

@jaddison
jaddison / gist:4506070
Last active January 30, 2024 09:26
Setting up gunicorn and celery with gevent, psycogreen for Django
# gunicorn.conf.py: getting gevent and psycogreen running
bind = '127.0.0.1:1437'
accesslog = "<some-path>/logs/gunicorn-access.log"
errorlog = "<some-path>/logs/gunicorn-error.log"
workers = 5
try:
# fail 'successfully' if either of these modules aren't installed
from gevent import monkey
from psycogreen.gevent import patch_psycopg
@jaddison
jaddison / gist:4486038
Last active December 10, 2015 20:08
django-simple-templates example of using a custom assignment tag to get a signup form working in any simple template.
{% extends "base.html" %}
{% load user_tags %}
{% block head-gace-js %}
// paste your Google Analytics Content Experiment JS code here if you're running an experiment.
{% endblock %}
{% block content %}
<h2>Awesome webpage content for businesses.</h2>
{% get_signup_form as signup_form %}