Skip to content

Instantly share code, notes, and snippets.

View nicwaller's full-sized avatar

Nic Waller nicwaller

View GitHub Profile
@nicwaller
nicwaller / teamcity.py
Created May 30, 2019 19:06
Build script interaction with TeamCity using Service Messages
'''Build script interaction with TeamCity using Service Messages
https://confluence.jetbrains.com/display/TCD9/Build+Script+Interaction+with+TeamCity
'''
import time
import re
import os
from contextlib import contextmanager
@nicwaller
nicwaller / bash-logstash.sh
Last active January 16, 2017 07:12
Structured log output from JSON scripts
#!/bin/bash
# ------BEGIN LOGSTASH------
application_tag="bash"
if [ -z "$LOGFILE" ]; then
[ -d ~/log ] || mkdir ~/log
export LOGFILE=~/log/${application_tag}-logstash.log
fi
@nicwaller
nicwaller / install_graphite_statsd.sh
Last active January 12, 2017 18:22
[CURRENTLY NOT WORKING] Install Graphite in a virtualenv on macOS Sierra (10.12)
#!/bin/bash
# Install Graphite
mkdir graphite && cd graphite
virtualenv venv
venv/bin/pip install Django==1.8 django-tagging
# You might need to do this instead: venv/bin/pip install --user Django==1.8
venv/bin/pip install carbon whisper graphite-web Twisted==15.2
# Configure Graphite
@nicwaller
nicwaller / ubuntu-14.04-chef.sh
Created December 17, 2016 18:44
Complete build script for ubuntu-14.04-chef vagrant box
#!/bin/bash
vagrant box add bento/ubuntu-14.04
vagrant init bento/ubuntu-14.04
vagrant up --no-provision
vagrant ssh
# Enter shell inside vagrant box
wget -O - https://omnitruck.chef.io/install.sh | sudo bash -s -- -v 12.14.89
rm /tmp/chef*{rpm,deb}
exit
# Exit shell inside vagrant box
@nicwaller
nicwaller / forbes-cloud-100-2016.txt
Last active September 9, 2016 18:36
Forbes Cloud 100 (2016) -- only private companies
Slack
Dropbox
DocuSign
Stripe
Cloudera
SurveyMonkey
MailChimp
Squarespace
AppDynamics
Adyen
@nicwaller
nicwaller / slowlog_all.sh
Created March 21, 2016 19:33
Output the worst SLOWLOG entry from each Redis instance on a server, in descending order from slowest to fastest.
#!/bin/bash
# Example output:
# ~$ ./slowlog_all.sh
# 1779.2 ms /etc/redis/reports.conf
# 65.934 ms /etc/redis/actions.conf
for file in $(ls -1 /etc/redis/*.conf); do
name=$(basename $file);
port=$(awk '/^port/ {print $2}' $file);
@nicwaller
nicwaller / gist:9cf1986bb5c1d02cb2e3
Last active March 20, 2016 19:38 — forked from jtimberman/gist:3088517
Replace $VAGRANTBOX with box names that should be repackaged with updates. Don't specify it for up, ssh, and package if you're not using a multi-VM vagrantfile
% vagrant box add ubuntu/trusty64
% vagrant box update
% vagrant init ubuntu/trusty64
% vagrant up --no-provision
% vagrant ssh
vagrant$ wget -O - https://omnitruck.chef.io/install.sh | sudo bash
vagrant$ rm /tmp/chef*{rpm,deb}
vagrant$ exit
% vagrant package --output nicwaller-trusty64-chef12.box
% vagrant box add nicwaller/trusty64-chef12 nicwaller-trusty64-chef12.box
@nicwaller
nicwaller / keybase.md
Created March 2, 2016 03:27
keybase.md

Keybase proof

I hereby claim:

  • I am nicwaller on github.
  • I am nicwaller (https://keybase.io/nicwaller) on keybase.
  • I have a public key whose fingerprint is C052 64EF DDBA 7728 5A4E A89F 3686 0D5E 0CD7 E579

To claim this, I am signing this object:

@nicwaller
nicwaller / runsets.md
Created February 24, 2016 16:39
Run Sets. A new way of thinking about Chef runs.

Environment workflow

Problem

The status quo today is that we do not use dependency constraints on our internal cookbooks. This inhibits our ability to make changes because all changes must be backward-compatible. And even when our changes are backward-compatible, sometimes we promote cookbooks in the wrong order and end up with a failure.

Solution

We need to use two kinds of constraint.

@nicwaller
nicwaller / email_routing.yml
Last active January 26, 2016 22:34
example configuration for an imaginary service that handles inbound mail routing
---
# The key ideas of integration tools is that the entire routing solution should be implemented
# between the input/output borders. This provides some nice properties: for any input, you can
# determine where it will go. For any output, you can trace back all the possible inputs.
# If you have a service that will only send to exactly one email address (eg. AWS) then you
# can set up fan-out rules. If you are deprecating a service (eg. Slack) then you can identify
# and redirect all emails that have Slack as a destination. Unlike a forwarding rule on an
# Exchange account, you end up with version history. And unlike an Exchange forwarding rule,
# you always know where the email is coming from, so you can shut it down at its source.