Skip to content

Instantly share code, notes, and snippets.

Avatar

Bryan Bischof BBischof

View GitHub Profile
View norcal_series.csv
local_date_id ferry_bfstba_aprict_pre ferry_bfstba_aprict_post mint_bfstba_aprict_pre mint_bfstba_aprict_post linden_bfstba_aprict_pre linden_bfstba_aprict_post webster_bfstba_aprict_pre webster_bfstba_aprict_post morse_bfstba_aprict_pre morse_bfstba_aprict_post palo_alto_bfstba_aprict_pre palo_alto_bfstba_aprict_post market_sq_bfstba_aprict_pre market_sq_bfstba_aprict_post sansome_bfstba_aprict_pre sansome_bfstba_aprict_post instagram_bfstba_aprict_pre instagram_bfstba_aprict_post berkeley_bfstba_aprict_pre berkeley_bfstba_aprict_post south_park_bfstba_aprict_pre south_park_bfstba_aprict_post pacific_heights_bfstba_aprict_pre pacific_heights_bfstba_aprict_post old_oak_bfstba_aprict_pre old_oak_bfstba_aprict_post ferry_bfstba_stlmar_pre ferry_bfstba_stlmar_post mint_bfstba_stlmar_pre mint_bfstba_stlmar_post linden_bfstba_stlmar_pre linden_bfstba_stlmar_post webster_bfstba_stlmar_pre webster_bfstba_stlmar_post morse_bfstba_stlmar_pre morse_bfstba_stlmar_post palo_alto_bfstba_stlmar_pre palo_alto_bfstba_stlmar_
@BBischof
BBischof / coffee_ICO_location.csv
Last active Apr 12, 2018
Coffee ISO Code Location Lookup
View coffee_ICO_location.csv
Exporting Member Country code Certifying Agent Port code Port name Lat Long
Angola 158 Instituto Nacional do Café de Angola (INCA) 1 Cabinda -5.5775197 12.1927103
Angola 158 Instituto Nacional do Café de Angola (INCA) 4 Luanda -8.839987599999999 13.2894368
Angola 158 Instituto Nacional do Café de Angola (INCA) 5 Porto Amboin -10.7330115 13.7694692
Angola 158 Instituto Nacional do Café de Angola (INCA) 7 Porto Lobito -12.3477219 13.5473065
Benin 22 Société nationale pour la promotion agricole (SONAPRA) 1 Cotonou 6.3702928 2.3912362
Bolivia 1 Cámara Nacional de Exportadores de Bolivia (CANEB) 1 Arica -17.9769831 -67.1036668
Bolivia 1 Cámara Nacional de Exportadores de Bolivia (CANEB) 2 Antofagasta -17.371468 -66.27724289999999
Bolivia 1 Cámara Nacional de Exportadores de Bolivia (CANEB) 3 Matarani - Bolivia -17.8032338 -65.800331
Bolivia 1 Cámara Nacional de Exportadores de Bolivia (CANEB) 4 Villazón -22.0853991 -65.5975218
@BBischof
BBischof / isprime_variants_2-999.csv
Created Jan 14, 2018
four variations of isprime for the first thousand integers, shuffled and rotated counts don't include original in their counts, but require it
View isprime_variants_2-999.csv
num isprime shuffledprime_count rotatedprime_count reversedprime
2 1 0 0 1
3 1 0 0 1
4 0 0 0 0
5 1 0 0 1
6 0 0 0 0
7 1 0 0 1
8 0 0 0 0
9 0 0 0 0
10 0 0 0 0
@BBischof
BBischof / create_kernel.sh
Created Jan 1, 2018
create a kernel from a pip_reqs
View create_kernel.sh
experiment_name=$1
pip_reqs_file=$2
mkdir $experiment_name
cd $experiment_name
cp $pip_reqs_file .
venv_name="venv_"$experiment_name
virtualenv -p python $venv_name
source $venv_name/bin/activate
pip install -r ../$pip_reqs_file
pip install ipykernel
@BBischof
BBischof / update_dict.py
Created Dec 18, 2017
Finally a clean way to update dictionaries in python if you're unsure all keys exist
View update_dict.py
your_dict = {}
for i in some_iterator:
your_dict[i] = new_value if i not in your_dict else your_dict[i]+new_value
'''a version with the new value coming from a new dict'''
your_dict = {}
for i in some_iterator:
your_dict[i] = new_values[i] if i not in your_dict else your_dict[i]+new_values[i]
'''a kinda dumb example; letter frequencies'''
@BBischof
BBischof / BBCDevOpsChallenge.md
Last active Oct 30, 2017
Work-at-home Challenge for Blue Bottle Coffee DevOps Engineer
View BBCDevOpsChallenge.md

DevOps Coding Challenge (Allot at least 2 hours)

s3 manipulation

  • Clone the read-only bucket https://s3-us-west-2.amazonaws.com/bbc-devops-challenge/, and its contents into your personal s3 account. Read through each JSON file located on this your copy of this bucket. If the key "bump_waste_threshold" is not present in any .json files, add this key with a default value of '.23' and replace the old file.

Directory microservice

Generate a web application in a framework of your choice that does the following:

  • Connects to the s3 bucket cloned above, and stores a text representation of the subdirectories of the bucket in Redis (or a similar key-value store). This text representation should match the output format of the unix command tree. Additionally, store the json files as the values with keys given by their paths from the root of this bucket.
  • Serves the plain text of the directory tree from the root path of the application.
  • All non-root paths must return a sample of poetry(any
@BBischof
BBischof / BBCEngManagerChallenge.md
Last active Jan 9, 2019
Work-at-home Challenge for Blue Bottle Coffee Engineering Manager
View BBCEngManagerChallenge.md

Engineering Manager Challenge (Allot at least 2 hours)

Note: Don’t feel constrained by the time limits.

Consider the following scenario:

You have 2 scheduled roasts of Hayes Valley Espresso totaling 50lbs. (For simplicity, assume that all batches are maximum of 30lbs for physical reasons).

Roast A, 20lbs available. 
Roast B, 30lbs available. 
@BBischof
BBischof / numbers_middle_letter.py
Created Sep 15, 2017
writing the numbers 1-100 in order and seeing the middle letter
View numbers_middle_letter.py
number_list=["one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "nineteen", "twenty", "twenty-one", "twenty-two", "twenty-three", "twenty-four", "twenty-five", "twenty-six", "twenty-seven", "twenty-eight", "twenty-nine", "thirty", "thirty-one", "thirty-two", "thirty-three", "thirty-four", "thirty-five", "thirty-six", "thirty-seven", "thirty-eight", "thirty-nine", "forty", "forty-one", "forty-two", "forty-three", "forty-four", "forty-five", "forty-six", "forty-seven", "forty-eight", "forty-nine", "fifty", "fifty-one", "fifty-two", "fifty-three", "fifty-four", "fifty-five", "fifty-six", "fifty-seven", "fifty-eight", "fifty-nine", "sixty", "sixty-one", "sixty-two", "sixty-three", "sixty-four", "sixty-five", "sixty-six", "sixty-seven", "sixty-eight", "sixty-nine", "seventy", "seventy-one", "seventy-two", "seventy-three", "seventy-four", "seventy-five", "seventy-six", "seventy-seven", "seventy-eig
@BBischof
BBischof / excel_split.py
Created Sep 13, 2017
A `.split()` function for excel—assumes 0 index, "-" delimiter, and reference cell "A2" but are all customizable. Outputs a string representation of the formula
View excel_split.py
def recurse(remaining_steps, delimiter='"-"', reference_cell="A2"):
if remaining_steps==0:
return 'SEARCH('+delimiter+','+reference_cell+')+1'
else:
return 'SEARCH('+delimiter+','+reference_cell+','+recurse(remaining_steps-1, delimiter, reference_cell)+')+1'
def build(i, delimiter='"-"', reference_cell="A2"):
if i<0:
raise ValueError
elif i==0:
@BBischof
BBischof / output
Last active May 22, 2017
Arithmetic Billiards Racks
View output
row 4: [5]
row 3: [4, 9]
row 2: [7, 11, 2]
row 1: [8, 1, 12, 10]
row 0: [6, 14, 15, 3, 13]
Remaining: []
row 4: [5]
row 3: [9, 4]
row 2: [2, 11, 7]
row 1: [10, 12, 1, 8]