Skip to content

Instantly share code, notes, and snippets.

View aljp's full-sized avatar

Adam Jacquier-Parr aljp

  • GalaBid
  • Australia
View GitHub Profile
@aljp
aljp / .env
Last active May 24, 2016 05:25
Given a .env file in the working directory with lines in the format ENV_NAME=ENV_VALUE, it will assign these environment variables
MY_ENV=MY_VAL
MY_ENV_2=MY_VAL_2
MY_ENV_3=MY_VAL_3
MY_ENV_WITH_EQUAL=MY_VAL=BROKEN
# Pycharm formatting, incorrect indentation after start of .format(...
url(r'^(?P<url_name>[a-z][a-z0-9_]+)/users/'
r'(?P<username>{username_regex_pattern})/'
r'favorite-companies/$'.format(
username_regex_pattern=username_regex_pattern),
views.FavoriteCompanyList.as_view(),
name='favorite-company-list'),
# If you put the start of the regex on the next line pycharm autoformatting works properly
url(
@aljp
aljp / .bash_profile
Last active October 31, 2016 03:40 — forked from natelandau/.bash_profile
Mac OSX Bash Profile
# ---------------------------------------------------------------------------
#
# Description: This file holds all my BASH configurations and aliases
#
# Sections:
# 1. Environment Configuration
# 2. Make Terminal Better (remapping defaults and adding functionality)
# 3. File and Folder Management
# 4. Searching
# 5. Process Management
git config --global alias.st status
git config --global alias.mff "merge --no-ff"
git config --global alias.lg "log --oneline --decorate --all --graph"
@aljp
aljp / test.sh
Last active April 6, 2017 03:48
Run's tests and generates coverage reports for a Django Project, then opens the coverage reports
#!/bin/bash
# Author: Adam Jacquier-Parr
GREEN='\033[0;32m'
RED='\033[0;31m'
NC='\033[0m'
# Check script is being run with source
if [ "$0" = "$BASH_SOURCE" ]; then
echo -e "${RED}You must use 'source test.sh' to run this script.${NC}"
exit 1
@aljp
aljp / install_postgresql.sh
Created May 19, 2018 10:08 — forked from dstroot/install_postgresql.sh
Install PostgreSQL on Amazon AMI
#!/bin/bash
###############################################
# To use:
# https://raw.github.com/gist/2776351/???
# chmod 777 install_postgresql.sh
# ./install_postgresql.sh
###############################################
echo "*****************************************"
echo " Installing PostgreSQL"
echo "*****************************************"
@aljp
aljp / install-redis.sh
Created May 19, 2018 10:08 — forked from khelll/install-redis.sh
Installing Redis on Amazon Linux
#!/bin/bash
###############################################
# To use:
# chmod +x install-redis.sh
# ./install-redis.sh
###############################################
version=3.2.0
echo "*****************************************"
echo " 1. Prerequisites: Install updates, set time zones, install GCC and make"
#!/usr/bin/env python
"""
Basic SocketIO implementation that waits for orderbook changes from btcmarkets and enqueue's the ask/bid price data.
"""
import os
from decimal import Decimal
import re
import logging
import asyncio
@aljp
aljp / do-exclusive-with-vsc_tag.sh
Created July 16, 2018 05:37
Lock CircleCI builds by testing git (any vcs) tags against a regex. I use some git tag suffixes to specify deployment environment, so 1.2.3staging1 will deploy to staging, however it cannot run at the same time as 1.2.3staging2 or 1.2.4staging1.
#!/usr/bin/env bash
# I've made changes to this script so it supports a --version argument
# which can specify a regular expression for the vcs_tag property on circle
# builds.
#
# sets $branch, $tag, $rest
parse_args() {
while [[ $# -gt 0 ]]; do
@aljp
aljp / django-ssh-shell_plus.sh
Last active August 27, 2018 06:15
A bash script to start a local python shell connected to remote resources through ssh tunnels
#!/usr/bin/env bash
# THE SHELL ACTIVATOR
# Provide an "environment" name as the first argument to this script and it will open a python shell to the environment's web tier.
if [ -z $1 ]; then
echo "First argument must be the environment"
exit 1
fi
ENV_FILE=$1