Skip to content

Instantly share code, notes, and snippets.

View oconnoat's full-sized avatar

Alexander O'Connor oconnoat

  • Los Angeles, California, USA
View GitHub Profile
@oconnoat
oconnoat / pandas tz localize
Last active September 13, 2018 00:14
pandas tz localize
df['sent'] = pd.to_datetime(df['sent'])
df['dtz'] = df['sent'].dt.tz_localize('UTC').dt.tz_convert('US/Pacific')
%matplotlib inline
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import datetime
from pytz import timezone
https://youtu.be/oh3CUItKAIM
@oconnoat
oconnoat / powerline.md
Created February 26, 2015 17:54
Install vim-powerline fonts
git clone --recursive https://github.com/powerline/fonts/
fonts/install.sh &
fc-cache -v -f

Setting the font automatically is OS-dependent and for once it's not Windows that is the problem

if has("gui_gtk2")
    set guifont=Anonymous\ Pro\ for\ Powerline\ 11

elseif has("gui_macvim")

@oconnoat
oconnoat / cdec.md
Last active November 1, 2018 04:09
CDEC Translator

#Creating a Spanish-English Translator with CDEC

This tutorial ([1]) will guide you through the necessary steps to mostly get a translator system built. There are a few additional steps needed for an actual translation system, and I will outline those steps. There is an alternative ([2]) tutorial which will take you through the process of builting a realtime decoder, which does different sort of training.

Once you have completed the above ([1]) tutorial, you need to compile the grammar and call the decoder. This is achieved with the following steps:

  1. Concatenate the partial, zipped grammars together: cat dev.grammars/*.gz > combined_grammar.gz

  2. identify the location of the MIRA weights mira.dev.lc-tok.es-en./weights.final

@oconnoat
oconnoat / gist:dc2746595ccce7163228
Created May 26, 2014 14:42
Force git to use https
git config url."https://".insteadOf git://
@oconnoat
oconnoat / node-gyp fix
Created May 26, 2014 14:40
if node-gyp fails on OSX Mavericks with Homebrew
export PKG_CONFIG_PATH=/usr/X11/lib/pkgconfig
@oconnoat
oconnoat / pipfromsource
Last active August 29, 2015 14:00
Install from source git repo with pip
git clone the repo
python setup.py sdist
pip install --user dist/*.tgz
##If you get a file not found error, there might be a stray reference to readme.md or something in setup.py
via @talideon: https://twitter.com/talideon/status/462591048045588480
@oconnoat
oconnoat / SimpleHTTPChrome.sh
Created April 18, 2014 09:17
start a python SimpleHTTPServer on port 8000 in this directory and open chrome to the root
python -m SimpleHTTPServer & open -a "Google Chrome" http://localhost:8000
@oconnoat
oconnoat / brewinfo.sh
Created April 18, 2014 08:32
Short shell script to get the url for a homebrew package and open it in google chrome in the background
#!/bin/bash
brew info $1 | sed -n '2p' | xargs open -g -a "Google Chrome"
#Get the Package info from brew for the first argument
# and pipe it to
#sed which outputs only the second line
# and pipe it to
# xargs calling open with options to background the app, the app named "Google Chome" and the url is appended