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 / Gemfile
Last active September 11, 2019 14:05
main entrypoint.js to use with a GitHub Action to run action written in ruby
# .github/actions/my-action/Gemfile
# frozen_string_literal: true
source 'https://rubygems.org'
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
gem 'json'
@1stvamp
1stvamp / user.js
Created September 4, 2019 10:53
Open GitHub issue description links in a new tab when rendering on app.zenhub.com
var mutationObserver = new MutationObserver(function(mutations) {
mutations.forEach(function(mutation) {
Array.prototype.forEach.call(document.querySelectorAll('.zhc-markdown a'), function(el, i) {
el.setAttribute('target', '_blank')
})
})
})
mutationObserver.observe(document.documentElement, {
childList: true,
@1stvamp
1stvamp / detect_zoom_active_call.scpt
Created July 11, 2019 12:13
Detect zoom window on mac
on subListsToOneList(l)
set newL to {}
repeat with i in l
set newL to newL & i
end repeat
return newL
end subListsToOneList
tell application "System Events"
set windowList to name of window 1 of (processes whose name is "Zoom")
#!/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 / 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 / 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 / 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