Skip to content

Instantly share code, notes, and snippets.

View BBischof's full-sized avatar

Bryan Bischof BBischof

  • current: Hex | prev: Weights and Biases, Stitch Fix, Blue Bottle, QuasiCoherent Labs, IBM
  • Berkeley, California
  • X @bebischof
View GitHub Profile
@BBischof
BBischof / compute_product.py
Last active May 18, 2017 02:08
All the i's, j's, and k's from Finnegan's Wake
quats = {"ii":"-1",
"jj":"-1",
"kk":"-1",
"ij":"k",
"ji":"-k",
"ik":"-j",
"ki":"j",
"jk":"i",
"kj":"-i"
}
@BBischof
BBischof / .block
Last active May 7, 2017 02:29
Horsey Race
license: mit
@BBischof
BBischof / exceptions.py
Created April 27, 2017 18:19
A nice python coding question
class B(Exception):
pass
class C(B):
pass
class D(C):
pass
for cls in [B, C, D]:
@BBischof
BBischof / f_nulls.py
Created February 22, 2017 01:56
ternary applied to fix a np.column with some nulls based on index
'''does something to an i'''
def f:
return i
s = pd.Series([f(i) for i in df.index])
df['A'] = np.where(df['A'].notnull(), df['A'],s)
@BBischof
BBischof / .block
Last active November 10, 2016 17:10
Multi-Line Voronoi.find() w/ speech data
license: gpl-3.0
@BBischof
BBischof / .block
Last active September 28, 2016 23:04
sentiment time-series mouseover
license: mit
@BBischof
BBischof / .block
Last active October 19, 2022 19:51
Beeswarm (Most Broken)
license: gpl-3.0
height: 200
@BBischof
BBischof / .block
Last active September 17, 2016 07:36
Beeswarm (With Flying Bees)
license: gpl-3.0
height: 200
@BBischof
BBischof / pathlike_dict_access_class.py
Created August 29, 2016 02:27
another iteration on the path-like dictionary access. This makes it into a class and uses getters and setters, a much more elegant solution
import sys, json
#inspired by http://stackoverflow.com/questions/14692690/access-python-nested-dictionary-items-via-a-list-of-keys
# Testing dictionary
D = {
"a": {
"aa": {
"aaa": 1,
"aab": 2
},
@BBischof
BBischof / op_controller.py
Created August 29, 2016 02:19
A simple model of how to make a op controller in Python; convenient for data processing scripts with multiple functions.
'''
A simple example of how to use an operation controller
(note, this doesn't run, all the functions are missing)
'''
'''
operation controller
'''
def controller(op_code, data, data2):
ops = {