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
(->> (.split text "\n") | |
(remove #(re-find #"^#" %)) | |
(map #(count (.split % " "))) | |
(filter #(= 1 (mod % 2))) | |
(reduce (fn [sum i] (+ sum i)) 0)) |
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
((comp | |
#(reduce (fn [sum i] (+ sum i)) 0 %) | |
(fn [s] (filter #(= 1 (mod % 2)) s)) | |
(fn [s] (map #(count (.split % " ")) s)) | |
(fn [s] (remove #(re-find #"^#" %) s)) | |
#(.split % "\n")) | |
text) |
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
((comp | |
(partial reduce (fn [sum i] (+ sum i)) 0) | |
(partial filter #(= 1 (mod % 2))) | |
(partial map #(count (.split % " "))) | |
(partial remove #(re-find #"^#" %)) | |
#(.split % "\n")) | |
text) |
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
(if (and masculine plural) | |
"i" | |
(if plural | |
"le" | |
(if masculine | |
"il" | |
"la"))) |
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
(({true {true "i" false "il"} | |
false {true "le" false "la"}} | |
masculine) plural) |
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 multibool [& args] | |
(let [offset ({6 2, 11 3, 20 4} (count args))] | |
(if-not offset | |
(throw | |
(IllegalArgumentException. | |
"Illegal number of arguments (expected: 2 + 4, 3 + 8, 4 + 16)"))) | |
(nth args | |
(+ offset | |
(reduce (fn [sum i] (+ sum (if (nth args i) | |
(bit-shift-left 1 (- (dec offset) i)) |
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
(multibool masculine plural "la" "le" "il" "la") |
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
;variants of the code from point #2 of: | |
; http://www.tbray.org/ongoing/When/200x/2009/12/01/Clojure-Theses | |
;original | |
(apply merge-with + | |
(pmap count-lines | |
(partition-all *batch-size* | |
(line-seq (reader filename))))) |
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
;;; Number of arguments expected: 2 + 4, 3 + 8, 4 + 16 | |
(defmacro multibool [& args] | |
(let [offset ({6 2, 11 3, 20 4} (count args))] | |
(assert offset) | |
`(condp = (+ ~@(map (fn [i] `(if ~(nth args i) | |
~(bit-shift-left 1 (- (dec offset) i)) | |
0)) | |
(range 0 offset))) | |
~@(reduce (fn [memo i] (into memo (list (nth args (+ 2 i)) i))) | |
'() |
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
1) COPY SSH KEYS TO USER@HOST TO ENABLE PASSWORD-LESS SSH LOGINS. (NOT ON MAC) | |
ssh-copy-id user@host | |
To generate the keys use the command ssh-keygen | |
2) START A TUNNEL FROM SOME MACHINE’S PORT 80 TO YOUR LOCAL POST 2001 | |
ssh -N -L2001:localhost:80 somemachine |