Skip to content

Instantly share code, notes, and snippets.

View 1stvamp's full-sized avatar
:shipit:

Wes Mason 1stvamp

:shipit:
View GitHub Profile
#!/bin/bash
set -euo pipefail
PN_PKG='pneumatic-tubes'
mkdir -p "/tmp/${PN_PKG}"
cd "/tmp/${PN_PKG}" || exit 1
if [ ! -e node_modules/.bin/npx ]
then
# merge master changes into branch
git -c "user.name=Circle CI" -c "user.email=example@example.com" pull --no-edit --no-ff origin refs/heads/master
# Get changed directories, assuming each dir is an app, you could also do a for loop after to check for certain files which define those directories as apps, e.g. if [ -f "$APP/app.json" ]
CHANGED_APPS=$(git diff --name-status master..$(git symbolic-ref --short HEAD) | awk '{print $2}' | xargs basename)
# run builds for $CHANGED_APPS
@1stvamp
1stvamp / terraform_json.py
Last active August 17, 2017 15:49
Methods for reading and writing terraform JSON that uses multiple object with the same key string
#!/usr/bin/env python3
import json
def list_hook(pairs):
result = {}
for name, value in pairs:
if name in ('data', 'module', 'resource', 'provider', 'backend'):
result.setdefault(name, []).append(value)
else:
@1stvamp
1stvamp / parse_honcho_log.py
Last active June 22, 2017 09:37
Crappy script to parse a honcho log and get a sorted list of services that took the longest time before serving a request.
#!/usr/bin/env python
import dateutil.parser
import operator
import pprint
import sys
with open(sys.argv[1]) as f:
log = f.readlines()
define file_array() {
file { $name:
path => "$name",
ensure => file,
mode => '0644',
owner => 'root',
group => 'nagios',
}
}
@1stvamp
1stvamp / heroku.sh
Last active September 4, 2017 23:54
Script to test subprocess running heroku, outputs blank JSON object for config command
#!/bin/sh
if [ "$1" = "config" ]; then
echo '{}'
fi
>&2 echo "$*"
exit 0
@1stvamp
1stvamp / heroku.sh
Created May 17, 2017 17:02
Script to test subprocess running heroku, outputs blank JSON object for config command
#!/bin/sh
if [ "$1" = "config" ]; then
echo '{}'
fi
exit 0
@1stvamp
1stvamp / git.sh
Last active May 17, 2017 17:06
Script for testing subprocess running git, with random failure
#!/bin/bash
if (( $RANDOM % 2 )); then
>&2 echo 'Random failure'
exit 1
fi
exit 0
git diff --name-status master..$(git symbolic-ref --short HEAD)|awk '{print $2}'
diff --git a/Dockerfile.j2 b/Dockerfile.j2
index 09f09f9..7ebbaad 100644
--- a/Dockerfile.j2
+++ b/Dockerfile.j2
@@ -9,4 +9,6 @@ COPY . /srv/helloworld/code
RUN echo "{{ BUILD_REVISION }}" > version-info.txt
RUN rm -rf env
RUN pip install -U .
-CMD bin/confd -confdir etc/confd/ -log-level info -backend etcd -node http://etcd-client:2379
+ENV HELLOWORLD_DB_HOST localhost