Skip to content

Instantly share code, notes, and snippets.

@alichaudry
alichaudry / uninstall_pip_conda.sh
Created May 3, 2018 21:59
Uninstall all `pip` packages from a `conda` env
((conda list | grep \<pip\>) | awk '{print $1;}') | xargs pip uninstall -y
@alichaudry
alichaudry / encrypt_decrypt.sh
Created November 14, 2016 20:23
one-liners to encrypt and decrypt data using openssl (aes256)
# encrypt
openssl enc -aes-256-cbc -salt -a -in twn.csv -out twn.csv.enc
# decrypt
openssl enc -aes-256-cbc -d -a -in twn.csv.enc -out twn.csv
@alichaudry
alichaudry / fixing_openssl_psycopg2.sh
Created April 26, 2016 18:16
Fixing errors where `psycopg2` needs openssl (libssl and libcrypto) versions 1.0.0
# export this environment variable to the appropriate path containing
# `libssl` and `libcrypto` versions 1.0.0 (and not 0.9.7/0.9.8!!!)
export DYLD_FALLBACK_LIBRARY_PATH=/Users/ali/miniconda2/envs/lms/lib:$DYLD_FALLBACK_LIBRARY_PATH
# OR try this without mucking around with environment variables!
# My StackOverflow solution:
# http://stackoverflow.com/a/36872624/5076471
brew install --upgrade openssl
brew unlink openssl && brew link openssl --force
@alichaudry
alichaudry / plot_multi_hist.py
Last active March 30, 2016 16:42
Plot multiple histograms on single chart
"""
Code to plot multiple histograms on a single chart.
Inspired by:
http://stackoverflow.com/questions/6871201/plot-two-histograms-at-the-same-time-with-matplotlib
"""
from __future__ import division
import random