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
(ns irc-parser | |
(:use clojure.contrib.duck-streams | |
clojure.contrib.str-utils | |
clojure.contrib.seq-utils)) | |
(def dates (file-seq (java.io.File. "./clojure"))) | |
(defn parse-irc-log | |
[logfile] | |
(line-seq (reader 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
(ns irc-parser.core | |
(:use clojure.contrib.duck-streams | |
clojure.contrib.str-utils | |
clojure.contrib.seq-utils)) | |
(def dates (file-seq (java.io.File. "./clojure"))) | |
(defn parse-irc-log | |
[logfile] | |
(line-seq (reader 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
(defn walton [#^String s] | |
(let [result (walton-doc s)] | |
(map (fn [text] | |
(if (>= (count text) 457) | |
(apply str (take 457 text) "...") | |
text)) (nth result (rand-int (count result)))) |
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 truncate [t coll] | |
(map (fn [ct] | |
(if (>= (count ct) t) | |
(apply str (take t ct) "...") | |
ct)) coll)) | |
(defn walton* | |
[#^String s t m?] | |
(let [result (walton-doc s)] |
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 answer-with [irc-data reply] | |
(let [{:keys [irc channel nick]} irc-data] | |
(ircb/send-message irc channel | |
(str nick ": " reply))) | |
(defplugin | |
(:dict | |
"Takes a word and look's up it's definition via the Wordnik dictionary API." | |
["dict"] | |
[{:keys [irc channel nick args] :as data}] |
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
(frame :title "A Button Example" | |
:layout (FlowLayout.) | |
:size [220 90] | |
:show true | |
[b1 (button "First") | |
;b1 (button "First" :action ([e] (println "First"))) | |
b2 (button "Second") | |
lab (label "Press a button")] | |
(add-action-listener b1 ([e] (println "listener called")))) |
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
## haproxy.cfg | |
global | |
user haproxy | |
group haproxy | |
daemon | |
maxconn 16384 | |
pidfile /var/run/haproxy.pid | |
defaults |
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
use std::io::{Read, Seek, SeekFrom, Write}; | |
use std::slice; | |
use std::time::Instant; | |
use std::{fs::OpenOptions, io::Result}; | |
use std::ptr; | |
use std::mem::forget; | |
const BUF_SIZE: usize = 1024 * 32; | |
const FILE_SIZE: usize = 1024 * 1024 * 512; | |
const QUEUE_DEPTH: usize = 32; |