Skip to content

Instantly share code, notes, and snippets.

Hugues Demers hdemers

Block or report user

Report or block hdemers

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
hdemers /
Created Jan 10, 2017 - GitHub ownership proof

Keybase proof

I hereby claim:

  • I am hdemers on github.
  • I am hdemers ( on keybase.
  • I have a public key whose fingerprint is D2D0 47F8 1BFD D447 2400 FCA1 FC21 2198 8E36 D320

To claim this, I am signing this object:

hdemers / hdemers-gpg-pubkey
Last active Jun 24, 2016
Hugues Demers GnuPG public key
View hdemers-gpg-pubkey
Version: GnuPG v1.4.9 (GNU/Linux)
View Thinkful.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
# Connect to database
import os
import pandas as pd
from sqlalchemy import create_engine
hostname = ""
username = os.environ['DB_USERNAME']
db_name = os.environ['DB_NAME']
password = os.environ['MYSQL_PWD']
View factorplot bug
"metadata": {
"name": "",
"signature": "sha256:b558204f751fde84d16bf429dd76b6bd17dc0901bd51c746c7dbfc3e3a09f71e"
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
"cells": [
View weights.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
hdemers /
Created Apr 14, 2013
I never remember how to convert to/from UTC datetime and epoch. Now I don't have to.
"""UTC time conversion functions.
from calendar import timegm
from datetime import datetime
def utcdt2epoch(utcdatetime):
"""Convert a datetime object expressed in UTC to a Unix timestamp expressed
in seconds since the epoch (Jan 1st 1970).
hdemers /
Created Apr 10, 2013
Python decorator cheat sheet.
from functools import wraps
def decorator(fn):
"""A function that *is* a decorator.
Use it like so:
def foobar(arg):
return arg
hdemers /
Created Apr 8, 2013
A Python generator yielding a list in chunks. Cf.
def chunks(l, n):
""" Yield successive n-sized chunks from l.
for i in xrange(0, len(l), n):
yield l[i:i+n]
hdemers /
Last active Dec 19, 2017
Installation instructions for doing data science in a Python environment on Ubuntu. We'll install base packages like numpy, scipy, scikit-learn and pandas. We also install the IPython Notebook interactive environment. This is a best practice recommendation for doing research-type work. We make use of virtualenvwrapper, but don't show how to inst…
mkvirtualenv datascience
sudo apt-get install python-scipy libblas-dev liblapack-dev gfortran
sudo apt-get install libffi-dev # for cryptography from scrapy
sudo apt-get install libxslt-dev # for libxml from scrapy
export BLAS=/usr/lib/
export LAPACK=/usr/lib/
pip install numpy
pip install scipy
pip install scikit-learn
pip install pandas
You can’t perform that action at this time.