Skip to content

Instantly share code, notes, and snippets.

View hospadar's full-sized avatar

Luke Hospadaruk hospadar

View GitHub Profile
@hospadar
hospadar / ultimate_prompt.sh
Last active March 15, 2018 18:00
Luke's Ultimate Prompt v3
#Luke's Ultimate Prompt
#displays shortened time, username, shortened absolute path, git branch status colored red if dirty, colored smiley face indicating return code of previous command
#also includes a colored mortal kombat PS2 for those long commands.
#Written by Luke Hospadaruk with lots of help from the internet
find_git_branch() {
# Based on: http://stackoverflow.com/a/13003854/170413
local branch
if branch=$(git rev-parse --abbrev-ref HEAD 2> /dev/null); then
if [[ "$branch" == "HEAD" ]]; then
echo -n ' detached*'
@hospadar
hospadar / generate_ngrams.py
Created February 25, 2015 20:08
DFR Tokenizer example
from __future__ import print_function
import re, sys
from nltk import ngrams, tokenize, download
from argparse import ArgumentParser
"""
#USAGE:
#This python file illustrates the techniques that Data For Research (http://dfr.jstor.org/) uses to tokenize raw text and generate n-grams
#DFR uses the NLTK 'punkt' tokenizer which needs to be downloaded separately from the nltk package.
@hospadar
hospadar / counter.py
Created November 25, 2014 03:57
Python script to count keypresses. Used for winding pickups.
from __future__ import print_function
import sys, time
from collections import deque
import curses, traceback
'''
Simple counter script
Originally used for counting pickup windings for an electric violin pickup.
Of course it would work well for any pickup winding activity.