Skip to content

Instantly share code, notes, and snippets.

View sdbondi's full-sized avatar

Stan Bondi sdbondi

View GitHub Profile
@sdbondi
sdbondi / docker-vars.py
Created June 22, 2017 11:01
Use JQ to parse environment variables from docker container and then transform them into arguments to be passing into the docker run command.
#!/usr/bin/env python
import argparse
import json
from subprocess import check_output
def inspect(container):
return json.loads(check_output(["docker", "inspect", container]))
def prep_arg(string):
apiVersion: v1
kind: ReplicationController
metadata:
name: drone-agent
namespace: app-support
labels:
tier: support
spec:
replicas: 2
selector:
@sdbondi
sdbondi / codeship_elasticbeanstalk.sh
Last active August 29, 2015 14:21
Codeship deploy script for elasticbeanstalk
#!/bin/bash
set -e
echo "---> Installing aws cli (if neccessary)"
type aws 1>/dev/null 2>&1 || pip install awscli
echo "---> Packaging app"
@sdbondi
sdbondi / install_wkhtmltoimage.sh
Last active December 3, 2015 08:57
Install wkhtmltoimage
#!/usr/bin/env bash
set -eo pipefail
DEPS='openssl build-essential libssl-dev libxrender-dev git-core libx11-dev libxext-dev libfontconfig1-dev libfreetype6-dev fontconfig'
echo $DEPS | xargs apt-get -y install
rm -f /tmp/wkhtmltox-0.12.2.1_linux-trusty-amd64.deb
wget http://download.gna.org/wkhtmltopdf/0.12/0.12.2.1/wkhtmltox-0.12.2.1_linux-trusty-amd64.deb -P /tmp
dpkg -i /tmp/wkhtmltox-0.12.2.1_linux-trusty-amd64.deb
@sdbondi
sdbondi / install_rbenv.sh
Last active August 29, 2015 14:06
Install our development ruby environment
#!/usr/bin/env bash
set -eo pipefail
# Install rbenv
if [[ ! -d ~/.rbenv ]]; then
echo "Installing rbenv"
git clone https://github.com/sstephenson/rbenv.git ~/.rbenv
if [[ ! `grep 'eval "\$(rbenv init -)"' ~/.bashrc` ]]; then
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
@sdbondi
sdbondi / gist:1bea0d4bc60ddb9c76f8
Created September 4, 2014 12:18
Add 500ms delay to your localhost (useful for testing image upload progress)
# to add
tc qdisc add dev lo root netem delay 500ms
# to remove
tc qdisc delete dev lo root netem delay 500ms
@sdbondi
sdbondi / 0_reuse_code.js
Created June 30, 2014 07:41
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@sdbondi
sdbondi / gist:a6a9dc85c01cdf926dba
Last active August 29, 2015 14:02
Plugins for dokku
git clone https://github.com/statianzo/dokku-supervisord.git /var/lib/dokku/plugins/dokku-supervisord
dokku plugins-install
git clone https://github.com/scottatron/dokku-rebuild /var/lib/dokku/plugins/rebuild
dokku plugins-install
git clone https://github.com/musicglue/dokku-user-env-compile.git /var/lib/dokku/plugins/user-env-compile
dokku plugins-install
git clone https://github.com/mikexstudios/dokku-nginx-alt.git /var/lib/dokku/plugins/dokku-nginx-alt
@sdbondi
sdbondi / config.inc.php
Last active August 29, 2015 13:58
Use PhpPgMyAdmin to detect your docker postgres instances
<?php
# phppgmyadmin/conf/config.inc.php
(...)
// Docker postgres connections
$server_i = 1;
$containers = explode("\n", trim(`docker ps`));
array_shift($containers);
foreach ($containers as $cid) {
if (!preg_match('/postgres/', $cid)) { continue; }
AA: 'Afar'
AB: 'Abkhaz'
AE: 'Avestan'
AF: 'Afrikaans'
AK: 'Akan'
AM: 'Amharic'
AN: 'Aragonese'
AR: 'Arabic'
AS: 'Assamese'
AV: 'Avaric'