Skip to content

Instantly share code, notes, and snippets.

Wes Mason 1stvamp

Block or report user

Report or block 1stvamp

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View run-npm-migration.sh
#!/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
View build_changed_apps.sh
# 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 Aug 17, 2017
Methods for reading and writing terraform JSON that uses multiple object with the same key string
View terraform_json.py
#!/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 Jun 22, 2017
Crappy script to parse a honcho log and get a sorted list of services that took the longest time before serving a request.
View parse_honcho_log.py
#!/usr/bin/env python
import dateutil.parser
import operator
import pprint
import sys
with open(sys.argv[1]) as f:
log = f.readlines()
View file_globs.pp
define file_array() {
file { $name:
path => "$name",
ensure => file,
mode => '0644',
owner => 'root',
group => 'nagios',
}
}
@1stvamp
1stvamp / heroku.sh
Last active Sep 4, 2017
Script to test subprocess running heroku, outputs blank JSON object for config command
View heroku.sh
#!/bin/sh
if [ "$1" = "config" ]; then
echo '{}'
fi
>&2 echo "$*"
exit 0
@1stvamp
1stvamp / heroku.sh
Created May 17, 2017
Script to test subprocess running heroku, outputs blank JSON object for config command
View heroku.sh
#!/bin/sh
if [ "$1" = "config" ]; then
echo '{}'
fi
exit 0
@1stvamp
1stvamp / git.sh
Last active May 17, 2017
Script for testing subprocess running git, with random failure
View git.sh
#!/bin/bash
if (( $RANDOM % 2 )); then
>&2 echo 'Random failure'
exit 1
fi
exit 0
View git-diff-file-names.sh
git diff --name-status master..$(git symbolic-ref --short HEAD)|awk '{print $2}'
View Makefile.j2.diff
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
You can’t perform that action at this time.