Skip to content

Instantly share code, notes, and snippets.

View ConstantineLignos's full-sized avatar

Constantine Lignos ConstantineLignos

View GitHub Profile
@ConstantineLignos
ConstantineLignos / openblas_ubuntu_compilation.txt
Last active March 22, 2021 00:43
Set up OpenBLAS with NO_AFFINITY=1 to make it most useful for applications such as R.
1. Check out OpenBlas from https://github.com/xianyi/OpenBLAS and check out the master branch.
2. Build and install to /opt:
a.) Multi-threaded:
make NO_AFFINITY=1
b.) Single-threaded:
sudo make PREFIX=/opt install
3. Configure it as your BLAS of choice:
sudo update-alternatives --install /usr/lib/libblas.so.3gf libblas.so.3gf /opt/lib/libopenblas.so.0 50
4. Check the configuration to make sure it's selected
update-alternatives --config libblas.so.3gf
@ConstantineLignos
ConstantineLignos / cmudict_triphones.py
Created September 15, 2011 16:42
Getting triphones from CMUDict pronunciations in NLTK
import re
from collections import defaultdict
import nltk
from nltk.corpus import cmudict
def clean_pron(pron):
"""Remove stress from pronunciations."""
return re.sub(r"\d", "", pron)
@ConstantineLignos
ConstantineLignos / picosat_additions.h
Last active March 12, 2018 23:20
Building picosat on Windows.
/* Turn off features that will not work on Windows.
*/
#define NGETRUSAGE
#define NALLSIGNALS
@ConstantineLignos
ConstantineLignos / Presidential Ratings Stub.ipynb
Last active October 23, 2016 14:00
Python Bootcamp Notebook Examples
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ConstantineLignos
ConstantineLignos / freqsampler.py
Created March 22, 2013 20:36
Sample items (i.e., words) from a list of items based on their frequencies. Assumes the input file contains lines of the form "<count> <item>".
#!/usr/bin/env python
"""Randomly sample items from a list of items with their frequencies."""
import sys
import random
from operator import itemgetter
def parse_countword_line(line):
@ConstantineLignos
ConstantineLignos / show_ignored_untracked.sh
Created March 5, 2013 12:40
Make git list untracked files that have been ignored. Useful if you want to verify that there's nothing you care about in your ignores.
git ls-files -oi --exclude-standard
@ConstantineLignos
ConstantineLignos / oneref.tex
Created December 18, 2012 09:51
Info for fixing whitespace parsing issue in checkcites.
\documentclass{article}
\begin{document}
This is a test \cite{foo2012}.
\bibliographystyle{plain}
\bibliography{tworef}
\end{document}
@ConstantineLignos
ConstantineLignos / viewtsv.sh
Created August 3, 2012 13:34
View TSVs nicely in the terminal
#!/usr/bin/env bash
column -t -s $'\t' $1 | less -S
@ConstantineLignos
ConstantineLignos / gist:2929803
Created June 14, 2012 11:42
Bash PS1 with user@host, full path, and git_ps1, each in their own color
GIT_PS1_SHOWDIRTYSTATE=1
PS1='[\[\e[1;32m\]\u@\h \[\e[1;36m\]\w\[\e[1;35m\]$(__git_ps1 " (%s)")\[\e[0m\]]\$ '