Skip to content

Instantly share code, notes, and snippets.

View dfarrell-bloom's full-sized avatar

Dan Farrell dfarrell-bloom

  • Bloom Health
  • Minnepolis, MN
View GitHub Profile
cd static-sites
git checkout -b tmp
git branch -D master
git checkout master
git branch -D tmp
@dfarrell-bloom
dfarrell-bloom / splunksearch.txt
Created May 12, 2014 15:04
Splunk Search for License Usage by day
index=_internal type=Usage source=*license_usage.log | eval MB=b/1024/1024 | eval n=strftime(_time , "%Y/%m/%d") | stats sum(MB) by pool, n
@dfarrell-bloom
dfarrell-bloom / ruby-escape-newlines.sh
Created April 24, 2014 14:00
Ruby replace newlines with '\n'
ruby -e 'puts $stdin.lines.map{ |l| l.gsub("\n","\\n") }.join ""'
@dfarrell-bloom
dfarrell-bloom / 32745.py
Last active August 29, 2015 13:58
heartbleed triage
#!/usr/bin/python
# Quick and dirty demonstration of CVE-2014-0160 by Jared Stafford (jspenguin@jspenguin.org)
# The author disclaims copyright to this source code.
import sys
import struct
import socket
import time
import select
@dfarrell-bloom
dfarrell-bloom / vagrant-pubkey.sh
Created February 3, 2014 19:07
add your public key to vagrant
cat .ssh/id_rsa.pub | ssh vagrant.moolb.com "cat >> .ssh/authorized_keys"
@dfarrell-bloom
dfarrell-bloom / migration-password-grep.rb
Created February 3, 2014 17:27
find migration password from ARGF if any and write it out
# read argf, find migration password if any and write it out. Grep doesn't do a great job of this beacuse we don't know the format of the file, but ruby can just read the json.
require 'json'
data = JSON.parse( ARGF.read )
id = data['id'] || "Unknown ID"
if data['database_schema'] and
data['database_schema']['grants'] and
data['database_schema']['grants']['migration'] and
@dfarrell-bloom
dfarrell-bloom / gist:8458318
Created January 16, 2014 16:41
remove branches interactively
for bspec in `git branch | grep -v postfix | grep -v develop | grep -v sftpupload | grep -v doc-update | grep -v splunk-proxy | grep -v splunk-storage-location | grep -v json-reformat | grep -v json-reformat | grep -v flex-pubkey-auth | grep -v prod_mgmt | grep -v netinfra | grep -v ami-baker | grep -v artifact-checksums | grep -v revert-s3-dependencies | grep -v bloom-base-box | grep -v singlestack-appless | grep -v develop | grep -v master`;
do
i="`echo $bspec | sed -e 's|^[ *]* ||'`";
echo $i
read j;
if [ "$j" = "y" ]; then
echo -e "\033[31;1mremoving\033[31m";
git branch -D "$i"; git push origin ":$i";
echo -e "\033[0m"
fi;
@dfarrell-bloom
dfarrell-bloom / gist:8446903
Created January 15, 2014 23:33
get an ip from a server with ipchicken
# not super awesome but it works
curl ipchicken.com | grep "[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}"
@dfarrell-bloom
dfarrell-bloom / gist:8424704
Created January 14, 2014 20:05
lst all proxy ports and hostnames from mysql proxy
rs_tag -q 'bh_mysqlproxy:port=*'| egrep '(hostname|port)='
# blarg, stupid crappy RS doc. Supports wildcards in version only would be an acceptable usage message!!!
@dfarrell-bloom
dfarrell-bloom / gist:8242613
Last active January 2, 2016 03:18
stop splunk, move data to ephemeral storage on /mnt, then symlink in and restart.
#
#
echo "This Script is deprecated. Please use the script from noctools/maintenance/splunk/ instead"
exit -1
#
#
#/opt/splunk/bin/splunk stop;
#mkdir /mnt/splunkvar;
#mv -v /opt/splunk/var/* /mnt/splunkvar;