Skip to content

Instantly share code, notes, and snippets.

View organisciak's full-sized avatar

Peter Organisciak organisciak

View GitHub Profile
@organisciak
organisciak / map-stats.py
Created March 18, 2016 06:03
Calculate frequencies in many books
from htrc_features import FeatureReader
import argparse
import pandas as pd
import numpy as np
import random
import string
def main():
parser = argparse.ArgumentParser(description='Calculate Collection '
@organisciak
organisciak / process.py
Created February 24, 2016 19:05
Script to process a Wordpress Export for Mallet
'''
Author: Peter Organisciak
Convert Day of DH (or other Wordpress) export to Mallet import format.
[url] [user] [post text]
Use in the following way:
>> python process.py input-file output-file --split [post|author]
For the split argument, choose either post (a document representation is the words of a post) or author (a document representation is the words that an author has written).
@organisciak
organisciak / post-commit
Created December 16, 2015 00:23
githook to convert iPython README to Markdown
READPY=$(git log --name-only HEAD^.. | grep "^README.ipynb$")
READMD=$(git log --name-only HEAD^.. | grep "^README.md$")
if [ -n "$READPY" ] && [ -z "$READMD" ]; then
echo "It looks like a new README was committed, appending a Markdown version"
ipython nbconvert --to markdown README.ipynb
# Adding this file doesn't work in pre-commit hooks, which is
# why we're appending post-commit
git add README.md
@organisciak
organisciak / basic-accuser.txt
Last active October 26, 2015 17:26
Tracery Examples
{
"origin": ["I accuse #suspect# of committing the crime in the #room# with the #weapon#!"],
"suspect": ["Miss Scarlett", "Colonel Mustard", "Mrs. White", "Reverend Green", "Mrs. Peacock", "Professor Plum", "Miss Peach", "Monsieur Brunette", "Madame Rose", " Sergeant Gray"],
"room": ["kitchen", "ballroom", "conservatory", "dining room", "billiard room", "library", "study", "hall", "lounge"],
"weapon": ["candlestick", "knife", "lead pipe", "dagger", "revolver", "rope", "wrench"]
}
@organisciak
organisciak / hterm_solarized.js
Last active July 14, 2019 09:23 — forked from russelldavies/hterm_solarized.js
Solarized for Mosh Chrome
// Solarized for Mosh Chrome
// Mosh does not seem to save profiles, so this sets the default 'mosh' profile.
// To reset, evaluate term_.prefs_.resetAll()
// Run in the JavaScript console of mosh_browser.html, which can be opened
// as explained here:
// https://github.com/rpwoodbu/mosh-chrome/wiki/FAQ#how-can-i-change-the-way-the-terminal-looks-font-color-etc
var htermProfiles = {
// Solarized Dark
@organisciak
organisciak / names.txt
Created April 16, 2014 17:21
Simple way to add pseudonyms to data
Jacob
Sophia
Mason
Emma
Ethan
Isabella
Noah
Olivia
William
Ava
# Setup Git global preferences
## Aliases
### Git up: a ff-only version of merge
### See: http://stackoverflow.com/questions/15316601/in-what-cases-could-git-pull-be-harmful
git config --global alias.up '!git remote update -p; git merge^ --ff-only @{u}'
### Git wiff
### "git diff --word-diff" >always used when writing
git config --global alias.wiff 'diff --word-diff'
@organisciak
organisciak / .vimrc
Last active December 23, 2015 11:39
My .vim settings.
" Set leader to ,
let mapleader=","
" Run Vim Pathogen https://github.com/tpope/vim-pathogen
execute pathogen#infect()
" Coffee Script Indentation
au BufNewFile,BufReadPost *.coffee setl shiftwidth=2 expandtab softtabstop=2
" Coffeescript fold by indent (use 'zi' to fold)
au BufNewFile,BufReadPost *.coffee setl foldmethod=indent nofoldenable
@organisciak
organisciak / rankedngrams.json
Last active December 19, 2015 03:49
Top 10000 words in the English language, merged (case-insensitive)
{"the":569,"of":544,"in":536,"and":529,"to":516,"for":482,"on":481,"by":478,"it":468,"at":465,"with":458,"as":452,"is":452,"an":451,"from":450,"new":442,"no":437,"not":433,"a":411,"this":411,"or":410,"all":410,"they":407,"when":407,"there":406,"one":406,"if":404,"these":400,"some":399,"you":399,"but":399,"that":398,"we":398,"what":397,"after":396,"so":393,"he":393,"how":391,"while":388,"then":387,"first":385,"even":384,"two":384,"their":383,"now":382,"our":380,"his":379,"many":379,"here":377,"because":377,"before":377,"another":376,"where":374,"do":373,"most":373,"only":370,"each":369,"every":367,"more":367,"those":367,"may":366,"such":365,"both":365,"since":361,"just":361,"like":360,"other":359,"see":359,"my":358,"who":358,"three":357,"why":357,"once":357,"are":356,"without":355,"can":354,"its":352,"let":352,"during":351,"great":349,"good":348,"about":346,"she":346,"however":346,"did":345,"any":345,"well":344,"under":342,"yet":342,"again":342,"be":341,"time":340,"will":340,"still":338,"have":338,"through":33