Skip to content

Instantly share code, notes, and snippets.


Abraham Hmiel abehmiel

View GitHub Profile
abehmiel /
Last active Aug 19, 2019
Basic Python API request
import requests
headers = {"token": "API TOKEN"}
params = {"something": "SOMETHING"}
response = requests.get("", headers=headers, params=params)
json_data = response.json()
status = response.status_code

Monday, May 22


Rainy. I took the 6 from GCS to Canal St and walked about 4 blocks.



Intense! Met a lot of people!

import pandas as pd
from datetime import datetime, date
Cleaning time!
This script will clean data downloaded from the fitbit website.
A little bit of preprocessing is useful. First, Separate the activities
and sleep data into different csv files and make sure there's only
one header row in each. Multiple months may be concatenated together,
abehmiel / titlecase.js
Created May 25, 2017
Title Case in JS
View titlecase.js
function toTitleCase(str)
return str.replace(/\w\S*/g, function(txt){return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();});
abehmiel /
Created May 26, 2017
JSON concatenate, dump to CSV
import json
import csv
# open a file for writing
data = open('trumptweets.csv', 'w')
# create the csv writer object
csvwriter = csv.writer(data)
#write the header
abehmiel / exploratory_model_tpot
Created May 26, 2017
Exploratory data analysis and model selection with TPOT
View exploratory_model_tpot
# conversion rate exploratory analysis and ML algorithm hyperparameter optimization
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.model_selection import train_test_split
from tpot import TPOTClassifier
# load the data
df = pd.read_csv("conversion_data.csv")
abehmiel /
Created May 29, 2017
Confusion matrix in scikit-learn
from sklearn.metrics import confusion_matrix
#type of classifier is not important
clf = GradientBoostingClassifier(loss='deviance', learning_rate=0.075, n_estimators=150, max_depth=3)
grbfit =, y_train)
y_pred = grbfit.predict(X_test)
print(clf.score(X_test, y_test))
class_names = [0,1]
abehmiel /
Created May 29, 2017 — forked from eevee/
Python script to reconstitute music from a PICO-8 cartridge
# script to extract music from a pico-8
# requires exporting sounds from the pico-8 first!
# run as: python mygame.p8 sound%d.wav music%d.wav
# by eevee, do what you like with this code
from __future__ import print_function
import argparse
import struct
import wave
abehmiel / communic8
Created Jun 7, 2017
Pico-8 communic8 interface to JS
View communic8
---- library code
_communic8_chars = "\n\32\33\34\35\36\37\38\39\40\41\42\43\44\45\46\47\48\49\50\51\52\53\54\55\56\57\58\59\60\61\62\63\64\65\66\67\68\69\70\71\72\73\74\75\76\77\78\79\80\81\82\83\84\85\86\87\88\89\90\91\92\93\94\95\96\97\98\99\100\101\102\103\104\105\106\107\108\109\110\111\112\113\114\115\116\117\118\119\120\121\122\123\124\125\126\127\128\129\130\131\132\133\134\135\136\137\138\139\140\141\142\143\144\145\146\147\148\149\150\151\152\153"
_communic8_charindices = {}
for i = 1, #_communic8_chars do
_communic8_charindices[sub(_communic8_chars, i, i)] = 30 + i
arg_types = {
View xps-touchscreen-workaround.service
Description=Potentially dangerous fix touchscreen after resume on the XPS 13 9350
You can’t perform that action at this time.