Skip to content

Instantly share code, notes, and snippets.

View andrewyates's full-sized avatar

Andrew Yates andrewyates

View GitHub Profile
@andrewyates
andrewyates / ggplot-light.rc
Created February 1, 2014 04:47
ggplot-light style for mpltools
# modified ggplot style with a white background
# from https://github.com/tonysyu/mpltools/blob/master/mpltools/style/ggplot.rc
# which was based on http://www.huyng.com/posts/sane-color-scheme-for-matplotlib/
patch.linewidth = 0.5
patch.facecolor = '#348ABD' # blue
patch.edgecolor = '#EEEEEE'
patch.antialiased = True
font.size = 14.0

Keybase proof

I hereby claim:

  • I am andrewyates on github.
  • I am andrewyates (https://keybase.io/andrewyates) on keybase.
  • I have a public key whose fingerprint is 1765 4D54 3003 9503 FAA9 4095 6F4F FCDD 6B40 34AA

To claim this, I am signing this object:

@andrewyates
andrewyates / gist:f988fa8c69ce8503d2b0
Created March 11, 2015 20:36
set the screen window title to the currently running (or last run) command
# set the screen window title to the currently running (or last run) command
preexec () {
local CMD=${1[(wr)^(*=*|sudo|-*)]}
print -Pn "\ek$CMD $a\e\\"
}
def avg_vec(terms):
vecs = [word2vec_model[term] for term in terms if term in word2vec_model]
if len(vecs) == 0:
print("WARNING: sequence of UNKs")
return np.zeros(word2vec_model.vector_size)
else:
return unitvec(np.mean(vecs, axis=0))
os.mkdir(context_outdir)
qid_contexts = {}
@andrewyates
andrewyates / rmxiv.py
Last active March 29, 2018 09:08
Downloads arxiv papers and adds them to reMarkable's cloud storage. Requires https://github.com/lukasschwab/arxiv.py and https://github.com/juruen/rmapi
#!/usr/bin/env python
import os
import sys
from subprocess import Popen, PIPE
import arxiv
def download_paper(url, outdir="/home/andrew/.arxiv/"):
if not os.path.exists(outdir):
@andrewyates
andrewyates / conda-tutorial.md
Created October 13, 2020 11:17
Guide to installing Python with Conda

Installing Python 3 via Conda

This tutorial describes how to install Python 3 into your home directory using the Conda package manager. We'll use the Miniconda variant, which is just Anaconda with fewer packages installed by default.

  1. Download: wget https://repo.anaconda.com/miniconda/Miniconda3-py37_4.8.3-Linux-x86_64.sh
  2. Make executable: chmod +x Miniconda3-py37_4.8.3-Linux-x86_64.sh
  3. Run installer: ./Miniconda3-py37_4.8.3-Linux-x86_64.sh When prompted, say yes when asked if you want to initialize Miniconda.
  4. Close and re-open your shell in order for the installation to take effect. (e.g., close your terminal or SSH connection and then re-open)