Skip to content

Instantly share code, notes, and snippets.

View blbradley's full-sized avatar

Brandon Bradley blbradley

  • Nashville, TN
View GitHub Profile
@blbradley
blbradley / docker-compose.yml
Last active March 2, 2017 16:54
docker-compose file for kafka-cryptocoin
version: '3'
services:
zookeeper:
image: "confluentinc/cp-zookeeper:3.0.1"
ports:
- '2181'
environment:
ZOOKEEPER_CLIENT_PORT: 2181
broker:
@blbradley
blbradley / primes.py
Last active February 2, 2017 17:40
ardnew wants to see my primes solution and help
from math import floor, ceil, sqrt
p = int(input().strip())
for a0 in range(p):
n = int(input().strip())
if n == 1:
print('Not prime')
continue
@blbradley
blbradley / sed-citi.sh
Last active November 18, 2016 14:01
Using sed to clean my credit card data from Citibank PDFs
# Example data line:
# 06/01 06/01 Bestbuy.com 00009944 888-237-8289 MN -$49.26
echo '06/01 06/01 Bestbuy.com 00009944 888-237-8289 MN -$49.26' \
| sed 's:[0-9]\+/[0-9]\+:&,:g' \
| sed 's: -\?\$[0-9]\+:,&:'
@blbradley
blbradley / parameterize.py
Created January 5, 2016 04:05
Date parameterization - Python vs Bash
from datetime import date, datetime
from dateutil.relativedelta import relativedelta
from six import print_
exchanges = {
'bitfinex': 'btcusd',
'bitstamp': 'btcusd',
'okcoin': 'btccny',
}
@blbradley
blbradley / gist:6105639
Created July 29, 2013 16:36
Start a x11vnc view-only screen at 1080p for use over ssh
#!/usr/bin/env bash
# Taken from Karl Runge's FAQ on x11vnc
# http://www.karlrunge.com/x11vnc/faq.html#faq-xinerama
x11vnc -safer -localhost -nopw -once -viewonly -clip 1920x1080+0+0 -display :0
@blbradley
blbradley / git-sftp-deploy.sh
Created July 28, 2013 23:32
Deploy over SFTP, for those moments when your host tells you to go fuck yourself.
#!/bin/sh
# Requirements:
# Install expect and make sure it's on your path
# sftp with working '-r' option
GIT_DIR=$1
HOST=$2
PASSWORD=$3
@blbradley
blbradley / git-list-dirs.sh
Created July 28, 2013 22:43
List all directories tracked by a git repo
#!/bin/sh
# Run in the project's root
git ls-files | sed 's:[^/]*$::'| sed '/^$/d' | sort -u
@blbradley
blbradley / post-receive-puppetbranches
Last active December 14, 2015 23:38
git post-receive hook for tracking puppet environments on the same machine
#!/bin/sh
read oldrev newrev refname
REPO="/my/repo.git"
BRANCH=`echo $refname | sed -n 's/^refs\/heads\///p'`
BRANCH_DIR="/etc/puppet/environments"
#Unset GIT_DIR and GIT_WORK_DIR so git chooses them by current directory
#Based on behaviour of git post-receive hook, undocumented
unset GIT_DIR
@blbradley
blbradley / xmlurls.sh
Created February 8, 2013 19:43
Print a list of URLs from an XML sitemap to stdout
#Print a list of URLs from sitemap.xml to stdout
xpath -q -e '/*/*/*/text()' sitemap.xml
@blbradley
blbradley / pandas_test_fast
Created February 19, 2015 16:49
./test_fast results for using NotImplemented in Period.__richcmp__ - pandas #9504
======================================================================
FAIL: test_greaterEqual_Raises_Value (pandas.tseries.tests.test_period.TestComparisons)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/brandon/src/coins/pandas/pandas/tseries/tests/test_period.py", line 2825, in test_greaterEqual_Raises_Value
print(self.january1 >= 1)
File "/home/brandon/src/coins/pandas/pandas/util/testing.py", line 1644, in __exit__
raise AssertionError("{0} not raised.".format(name))
AssertionError: TypeError not raised.
-------------------- >> begin captured stdout << ---------------------