Skip to content

Instantly share code, notes, and snippets.

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

Wes Mason 1stvamp

:shipit:
View GitHub Profile
@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
# standard wsgi middleware
def some_wsgi_middleware(app):
def middleware(environ, start_response)
def custom_start_response(status, headers, exc_info):
# they get overwritten here from func args
custom_start_response._status = status
custom_start_response._headers = headers
custom_start_response._status = custom_start_response._headers = None
# standard wsgi middleware
def some_wsgi_middleware(app):
def middleware(environ, start_response)
def custom_start_response(status, headers, exc_info):
# they get overwritten here from func args
custom_start_response._status = status
custom_start_response._headers = headers
response = app(environ, custom_start_response)
@1stvamp
1stvamp / tictactoe.py
Created March 2, 2016 19:12
Cooperatively made tic tac toe game - OLS MVD '16 sprint
board = {
'A': [' ', ' ', ' '],
'B': [' ', ' ', ' '],
'C': [' ', ' ', ' '],
}
def print_board():
for i in "ABC":
print(" | {} | {} | {} |".format(*board[i]))
@1stvamp
1stvamp / zip.py
Created February 23, 2016 11:31
Allow zip in templates in Ansible 1.x
# filter_plugins/zip.py
class FilterModule(object):
def filters(self):
return {'zip': zip}
@1stvamp
1stvamp / main.py
Last active December 17, 2015 22:11
Scrape Jenkins build failures from an IMAP box and post to a web service
from __future__ import unicode_literals
import os
import re
import requests
from imapclient import IMAPClient
fail_subject_re = re.compile('(Subject: )(Build failed in Jenkins: .+? )')
plugins_repos:
- https://github.com/juju/plugins.git
- https://github.com/bloodearnest/plugins.git#juju-local-dns
- https://github.com/bloodearnest/plugins.git#juju-add-local-env