Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@cordarei
cordarei / index-sentences.py
Created March 24, 2014 07:32
Index sentences in Penn Treebank by file/length
#!/usr/bin/env python
"""
Usage: index-sentences.py FILE
print an index of the parsed sentences in FILE
"""
import re
import sys
@cordarei
cordarei / init.el
Created March 23, 2014 05:51
Emacs init file version 2
;; setup for requiring and installing packages
(require 'cl)
(require 'package)
;; add extra ELPA archives
(add-to-list 'package-archives
'("melpa" . "http://melpa.milkbox.net/packages/") t)
;; initialize package system
@cordarei
cordarei / init.el
Created March 17, 2014 14:27
Emacs init file version 1
(require 'cl)
(require 'package)
(add-to-list 'package-archives
'("melpa" . "http://melpa.milkbox.net/packages/") t)
(package-initialize)
(defun ensure-package (package)
@cordarei
cordarei / doc2ann.py
Created October 8, 2013 08:15
Converting annotations to brat format
#!/usr/bin/env python
"""
Convert a document in the corpus to the brat ANN format.
Call like 'doc2ann.py <path>/<document id>'. Outputs two files in the current
directory <file>.txt and <file>.ann, where <file> is names from the command-line
argument.
"""
@cordarei
cordarei / test-dbus-notify.py
Created March 4, 2013 07:06
testing to see where (which workspace) the dbus notifications show up
#!/usr/bin/env python
import dbus
import time
bus = dbus.SessionBus()
obj = bus.get_object("org.freedesktop.Notifications",
"/org/freedesktop/Notifications")
ni = dbus.Interface(obj, "org.freedesktop.Notifications")
@cordarei
cordarei / main.cc
Created August 22, 2012 05:37
Simple(?) C++ wrapper around libncurses! Check out the awesome NetHack ripoff^W clone^W homage in main()!
/*
* Compile with "g++ -std=c++0x main.cc -lncurses && ./a.out" to check it out!
*/
#include <curses.h>
#undef getch
#undef border
#undef hline
#undef addch
#include <exception>