Skip to content

Instantly share code, notes, and snippets.

View bsiver's full-sized avatar
🌚

Ben Siver bsiver

🌚
View GitHub Profile
@bsiver
bsiver / zshrc
Created November 14, 2021 23:35
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
export PYENV_VIRTUALENVWRAPPER_PREFER_PYVENV="true"
export LIBRARY_PATH=$LIBRARY_PATH:/usr/local/opt/openssl/lib/
export PATH=$PATH:/usr/local/opt/mysql\@5.6/bin/:/usr/local/opt/openssl/bin/
export JAVA_HOME=`/usr/libexec/java_home -v 1.8`
PROMPT='%(?.%F{green}√.%F{red}?%?)%f %B%F{240}%1~%f%b %# '
@bsiver
bsiver / denorm_log.py
Last active June 23, 2016 16:40
content checksum computation
def compute_checksum(content):
""" Computes an md5 hash for a partial content object based on the fields in CHECKSUM_COMPARISON_FIELDS """
comparison_dict = {k : content[k] for k in CHECKSUM_COMPARISON_FIELDS}
return hashlib.md5(json.dumps(comparison_dict, sort_keys=True)).hexdigest()
------------------------------------------------------
2016-01-27 13:37:23,125 [ 199] INFO - #com.intellij.idea.Main - IDE: IntelliJ IDEA (build #IC-143.1184.17, 07 Dec 2015 00:00)
2016-01-27 13:37:23,125 [ 199] INFO - #com.intellij.idea.Main - OS: Mac OS X (10.11.3, x86_64)
2016-01-27 13:37:23,125 [ 199] INFO - #com.intellij.idea.Main - JRE: 1.8.0_40-release-b105 (JetBrains s.r.o)
2016-01-27 13:37:23,125 [ 199] INFO - #com.intellij.idea.Main - JVM: 25.40-b25 (OpenJDK 64-Bit Server VM)
2016-01-27 13:37:23,130 [ 204] INFO - #com.intellij.idea.Main - JVM Args: -Dfile.encoding=UTF-8 -XX:+UseConcMarkSweepGC -XX:SoftRefLRUPolicyMSPerMB=50 -ea -Dsun.io.useCanonCaches=false -Djava.net.preferIPv4Stack=true -XX:+HeapDumpOnOutOfMemoryError -XX:-OmitStackTraceInFastThrow -Xverify:none -Xbootclasspath/a:../lib/boot.jar -Xms128m -Xmx750m -XX:MaxPermSize=350m -XX:ReservedCodeCacheSize=240m -XX:+UseCompressedOops -Djb.vmOptionsFile=/Applications/IntelliJ IDEA
@bsiver
bsiver / facebook.py
Last active December 21, 2015 21:12
facebook = oauth.remote_app(
'facebook',
base_url='https://graph.facebook.com/v2.5',
request_token_url=None,
access_token_url='/oauth/access_token',
authorize_url='https://www.facebook.com/dialog/oauth',
consumer_key=config.FACEBOOK_APP_ID,
consumer_secret=config.FACEBOOK_APP_SECRET,
request_token_params={'scope': 'email'},
)
@bsiver
bsiver / garminExport.js
Created June 10, 2015 20:23
naive script for retrieving garmin activities from their service, only currently runnable from the classic activities page
activityServiceUrl = "https://connect.garmin.com/proxy/activity-service-1.1/tcx/activity"
activityIds = $('.activityNameLink').map(function() {
return this.href.substr(this.href.lastIndexOf('/') + 1)
});
urls = activityIds.map(function() {
return activityServiceUrl + this + ".tcx";
});
urls.map(function() { downloadURI(this); } )
@bsiver
bsiver / LinkedList.java
Last active December 10, 2015 21:38
Coding Interview Practice: Linked Lists
import java.util.HashSet;
import java.util.Set;
public class LinkedList {
private Node head;
private int size;
public LinkedList(Node head) {
this.head = head;