This file contains hidden or 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 java.io.File; | |
import java.util.regex.Pattern; | |
import java.util.Scanner; | |
import com.google.common.collect.ArrayListMultimap; | |
/** create in-memory mappings from words to the files that contain them */ | |
public class Indexer { | |
public static ArrayListMultimap<String,String> buildIndex(String dirName) throws java.io.IOException { | |
ArrayListMultimap<String,String> map = ArrayListMultimap.create(); | |
for (File f : new File(dirName).listFiles()) { |
This file contains hidden or 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
(ns closearch.words | |
(:use [clojure.string :only (split)])) | |
(def dict (split (slurp "/usr/share/dict/words") #"\n")) | |
(defn -main[& args] | |
(dotimes [n (#(Integer/parseInt %) (first args))] | |
(spit (str "text/file." n) (apply str (interpose " " (take 5000 (shuffle dict))))))) |
This file contains hidden or 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 java.io.File; | |
import java.util.regex.Pattern; | |
import java.util.Scanner; | |
import com.google.common.collect.ArrayListMultimap; | |
/** create in-memory mappings from words to the files that contain them */ | |
public class Indexer { | |
public static ArrayListMultimap<String,String> buildIndex(String dirName) throws java.io.IOException { | |
ArrayListMultimap<String,String> map = ArrayListMultimap.create(); | |
Pattern p = Pattern.compile("[\\s#&!:,;\\.\\\\+-]+"); |
This file contains hidden or 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 java.io.File; | |
import java.util.regex.Pattern; | |
import java.util.Scanner; | |
import com.google.common.collect.ArrayListMultimap; | |
/** create in-memory mappings from words to the files that contain them */ | |
public class Indexer { | |
public static ArrayListMultimap<String,String> buildIndex(String dirName) throws java.io.IOException { | |
ArrayListMultimap<String,String> map = ArrayListMultimap.create(); | |
Pattern p = Pattern.compile("[\\s#&!:,;\\.\\\\+-]+"); |
This file contains hidden or 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
;; Create in-memory mappings from each word to a set of files that contain it. | |
(defn build-index[dirname] | |
(def idx (com.google.common.collect.ArrayListMultimap/create)) | |
(doseq [file (map #(.getName %) (.listFiles (java.io.File. dirname)))] | |
(doseq [token (-> (str dirname "/" file) slurp tokenize)] | |
(.put idx token file))) | |
idx) |
This file contains hidden or 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
;; Create in-memory mappins from each word to a set of files that contain it. | |
;; If you kill the server, you'll have to reindex everything. | |
(defn build-index[dirname] | |
(loop [files (map #(.getName %) (.listFiles (java.io.File. dirname))) idx (transient {})] | |
(if (empty? files) (persistent! idx) | |
(recur | |
(rest files) | |
(loop [tokens (-> (str dirname "/" (first files)) slurp tokenize) | |
iidx idx] | |
(if (empty? tokens) iidx |
This file contains hidden or 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
#!/usr/bin/env ruby | |
%w(open-uri json time).each { |dependency| require dependency } | |
#quick hack to see the ADN Global Timeline scrolling on your terminal | |
#by @dbasch - modify at will | |
toSleep = 3 | |
color = 0 | |
start = Time.now | |
ids, old_ids = [], [] |
This file contains hidden or 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
restless | |
software | |
tools | |
check | |
twist | |
flaptor | |
trend | |
charts | |
blablaautora |
This file contains hidden or 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
2011-06-13T03:07:19+00:00 app[web.1]: /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/runtime.rb:64:in `require': /app/.bundle/gems/ruby/1.8/bundler/gems/tanker-2a9dd6877820/lib/tanker.rb:295: syntax error, unexpected ')', expecting '=' (SyntaxError) | |
2011-06-13T03:07:19+00:00 app[web.1]: /app/.bundle/gems/ruby/1.8/bundler/gems/tanker-2a9dd6877820/lib/tanker.rb:326: module definition in method body | |
2011-06-13T03:07:19+00:00 app[web.1]: /app/.bundle/gems/ruby/1.8/bundler/gems/tanker-2a9dd6877820/lib/tanker.rb:402: syntax error, unexpected kEND, expecting $end | |
2011-06-13T03:07:19+00:00 app[web.1]: from /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/runtime.rb:64:in `require' | |
2011-06-13T03:07:19+00:00 app[web.1]: from /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/runtime.rb:62:in `each' | |
2011-06-13T03:07:19+00:00 app[web.1]: from /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/runtime.rb:62:in `require' | |
2011-06-13T03:07:19+00:00 app[web.1]: |
This file contains hidden or 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
require 'rubygems' | |
require 'indextank' | |
url = 'http://:[email protected]' | |
api = IndexTank::Client.new url | |
index = api.indexes('test') | |
threads = [] | |
text = "this /as3<<<<!>#!$%!$<<lis a test ta<Q@#L$#<!!!34lkj 431<!//1lkj4> lskfj o...43lk1j 988181<,G$?5ly?H>>>5//2\\\4\33...43''''/////ke it "# * 2000 |
NewerOlder