Skip to content

Instantly share code, notes, and snippets.

View dakrone's full-sized avatar

Lee Hinman dakrone

View GitHub Profile
[2:hinmanm@Xanadu:~]% ruby -v
ruby 1.9.1p243 (2009-07-16 revision 24175) [i386-darwin10.0.0]
[2:hinmanm@Xanadu:~]% rvm system
[2:hinmanm@Xanadu:~]% sudo gem install rvm
Successfully installed rvm-0.0.28
1 gem installed
Installing ri documentation for rvm-0.0.28...
Installing RDoc documentation for rvm-0.0.28...
[2:hinmanm@Xanadu:~]% rvm default
[2:hinmanm@Xanadu:~]% rvm-update
[2:hinmanm@Xanadu:~]% rvm reset
[2:hinmanm@Xanadu:~]% ruby -v
ruby 1.8.7 (2008-08-11 patchlevel 72) [universal-darwin10.0]
[2:hinmanm@Xanadu:~]% rvm-update
<i> Updating rvm source ~/.rvm/scripts/rvm ...
<w> Ensuring that rvm script location in /Users/hinmanm/.zshrc is scripts/rvm not bin/rvm
<i> There have been a great many updates since previous releases, please:
(ns bibly.servlet
(:gen-class :extends com.google.wave.api.AbstractRobotServlet)
(:import
[com.google.appengine.api.users UserServiceFactory]
[com.google.wave.api Blip Event EventType RobotMessageBundle TextView Wavelet])
(:require [clojure.contrib.str-utils :as str-utils]
[clojure.contrib.str-utils2 :as str-utils2]))
(defn blip-submitted-events
[events]
#!/Users/hinmanm/bin/clj
; Index of Coincidence
(use '[clojure.contrib.duck-streams :only (reader file-str)])
(use '[clojure.contrib.str-utils2 :only (join)])
(defn ioc-base
"Returns the Index of Coincidence for a given shift and list of
numbers as a percentage."
[s n]
(let [pairs (partition s 1 n)
#!/usr/bin/env ruby -w
# encoding: UTF-8
#
# A simply `p4 diff` output colorizer.
FILE_R = /^====\s+([\s\S]+)(#\d+) - ([\s\S]+) ====$/
POS_R = /^(\d+[ad]\d+)$/
OUT_R = /^< /
IN_R = /^> /
(use 'opennlp) ; http://github.com/dakrone/clojure-opennlp
(use 'clojure.contrib.pprint)
(use 'clojure.contrib.duck-streams)
(use 'clojure.contrib.seq-utils)
(defn strip-html-tags
"Messily strip html tags from a web page"
[string]
(.replaceAll
(.replaceAll
(defn score-words
"Score a list of words linearly based on how far they are from the
term. Base score is optional and is 1 by default. Case sensitive."
([term words]
(score-words term words 1))
([term words basescore]
(let [index (.indexOf words term)]
(if (= -1 index)
(map #(vector % 0) words) ; no matches
(map
import os
import sys
from os.path import join, getsize, walk
fileNames1 = []
fileNames2 = []
fullNames1 = []
fullNames2 = []
returnValue = 0
; This example is very crazy and may be broken right now. Attempt to
; use at your own risk. Eventually it will be documented.
(ns contextfinder
(:use [opennlp.nlp])
(:use [opennlp.tools.filters])
(:use [clojure.contrib.seq-utils])
(:use [clojure.contrib.pprint])
(:use [clojure.contrib.math]))
(ns contextfinder
(:use [opennlp.nlp])
(:use [opennlp.tools.filters])
(:use [clojure.contrib.seq-utils])
(:use [clojure.contrib.pprint])
(:use [clojure.contrib.math]))
; Requires you to run this from the root opennlp directory or have the
; models downloaded into a "models" folder