Skip to content

Instantly share code, notes, and snippets.

Avatar

Brandon Bradley blbradley

View GitHub Profile
@blbradley
blbradley / docker-compose.yml
Last active Mar 2, 2017
docker-compose file for kafka-cryptocoin
View docker-compose.yml
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 Feb 2, 2017
ardnew wants to see my primes solution and help
View primes.py
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 / parameterize.py
Created Jan 5, 2016
Date parameterization - Python vs Bash
View parameterize.py
from datetime import date, datetime
from dateutil.relativedelta import relativedelta
from six import print_
exchanges = {
'bitfinex': 'btcusd',
'bitstamp': 'btcusd',
'okcoin': 'btccny',
}
@blbradley
blbradley / pandas_test_fast
Created Feb 19, 2015
./test_fast results for using NotImplemented in Period.__richcmp__ - pandas #9504
View pandas_test_fast
======================================================================
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 << ---------------------
@blbradley
blbradley / 01-vb_suite.log
Created Feb 17, 2015
vbench results for pandas #9504
View 01-vb_suite.log
Invoked with :
--ncalls: 5
--repeats: 5
-------------------------------------------------------------------------------
Test name | head[ms] | base[ms] | ratio |
-------------------------------------------------------------------------------
period_setitem | 8.4562 | 9.3834 | 0.9012 |
@blbradley
blbradley / 01-vb_suite.log
Created Feb 17, 2015
vbench results for pandas #9440
View 01-vb_suite.log
Invoked with :
--ncalls: 5
--repeats: 5
-------------------------------------------------------------------------------
Test name | head[ms] | base[ms] | ratio |
-------------------------------------------------------------------------------
timeseries_with_format_no_exact | 447.1206 | 467.2980 | 0.9568 |
@blbradley
blbradley / pandas_compare.py
Last active Aug 29, 2015
pandas 'Is a Timestamp within a Period?'
View pandas_compare.py
from pandas.core.api import Timestamp, Period
time_in_seconds = Timestamp('2013-03-31 22:11:19')
one_year_period = Period('2013')
time_in_seconds.to_period(one_year_period.freq) == one_year_period
# True
@blbradley
blbradley / build.gradle
Last active Aug 29, 2015
gradle file for running Apache Storm locally
View build.gradle
apply plugin: 'java'
repositories {
mavenCentral()
maven {
url 'http://clojars.org/repo/'
}
}
dependencies {
@blbradley
blbradley / runapp.py
Created Nov 6, 2014
WebOb middleware to force ssl on Heroku
View runapp.py
import os
from webob.dec import wsgify
from webob.exc import HTTPMovedPermanently
from paste.deploy import loadapp
from waitress import serve
@wsgify.middleware
def ForceSSLMiddleware(req, app):
@blbradley
blbradley / gist:6105639
Created Jul 29, 2013
Start a x11vnc view-only screen at 1080p for use over ssh
View gist:6105639
#!/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