This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn dumb-split [#^String s c #^"[Ljava.lang.String;" tokens] | |
(loop [i (int 0) | |
start (int 0) | |
end (int 0)] | |
(cond (>= end (.length s)) | |
(do (aset tokens i (.substring s start end)) | |
tokens) | |
(= (.charAt s end) c) | |
(do (aset tokens i (.substring s start end)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; now even dumber :P | |
(defn dumbest-split [#^String s c #^"[Ljava.lang.String;" tokens] | |
(loop [start (int 0) | |
i (int 0)] | |
(let [idx (int (.indexOf s (int c) (int start)))] | |
(if (neg? idx) | |
(do (aset tokens i (.substring s start)) | |
tokens) | |
(do (aset tokens i (.substring s start idx)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(with-open [r (BufferedReader. (java.io.InputStreamReader. | |
(FileInputStream. "/home/mst/updates.xml") | |
"US-ASCII") | |
131072)] | |
(loop [#^String line (.readLine r) | |
remaining (- end-byte start-byte)] | |
(when (and (>= remaining 0) line) | |
(recur (.readLine r) | |
(- remaining (.length line)))))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn count-ips [logfile] | |
(remove empty? | |
(persistent! (reduce | |
#(assoc! %1 %2 (inc (get %1 %2 0))) | |
(transient {}) | |
(of-IPs | |
(find-lines "Deny tcp src outside" logfile)))))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Not the nicest code we ever wrote... */ | |
<?php | |
require_once 'HTTP/Request.php'; | |
require_once 'Text/Wiki/Mediawiki.php'; | |
class Wikipedia | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(import '(org.apache.solr.core CoreContainer CoreContainer$Initializer)) | |
(import '(org.apache.solr.client.solrj.embedded EmbeddedSolrServer)) | |
(import '(org.apache.solr.client.solrj SolrQuery)) | |
(import '(org.apache.solr.common SolrInputDocument)) | |
(System/setProperty "solr.solr.home" | |
"/home/mst/projects/nyu/sakai/upstream/solr-debugging") | |
(def core (.initialize (new CoreContainer$Initializer))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<fieldtype name="initials" class="solr.TextField"> | |
<analyzer> | |
<tokenizer class="solr.WhitespaceTokenizerFactory"/> | |
<filter class="solr.LowerCaseFilterFactory"/> | |
<filter class="solr.EdgeNGramFilterFactory" minGramSize="1" maxGramSize="1" side="front"/> | |
</analyzer> | |
</fieldtype> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ rlwrap telnet localhost 4010 | |
Trying 127.0.0.1... | |
Connected to localhost. | |
Escape character is '^]'. | |
Type ':eof' to exit | |
>>> scr = reference("org.apache.felix.scr.ScrService") | |
>>> components = scr.getComponents("org.sakaiproject.nakamura.http.usercontent.ServerProtectionServiceImpl") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version='1.0' encoding='utf-8'?> | |
<marcstats record_count='9285'> | |
<leader> | |
<position index='6'> | |
<value count='7971'>a</value> | |
<value count='111'>c</value> | |
<value count='1'>d</value> | |
<value count='1059'>e</value> | |
<value count='2'>f</value> | |
<value count='3'>g</value> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# init script for Cassandra. | |
# chkconfig: 2345 90 10 | |
# description: Cassandra | |
# script slightly modified from | |
# http://blog.milford.io/2010/06/installing-apache-cassandra-on-centos/ | |
# | |
# And further tweaked for Apereo OAE | |
# | |
. /etc/rc.d/init.d/functions |
OlderNewer