I hereby claim:
- I am onemouth on github.
- I am onemouth (https://keybase.io/onemouth) on keybase.
- I have a public key whose fingerprint is 5D66 A6A0 FE35 6D9F 8B23 B353 FE3B 5F5A BD4B 4820
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
| (defn take-odd [input] | |
| (apply str | |
| (->> (partition 2 2 nil (apply list input)) | |
| (mapcat #(take 1 %))))) | |
| (let [line (read-line)] | |
| (println (take-odd line))) |
| ; swap Caps Lock and Left Ctrl. | |
| Capslock::Ctrl | |
| LCtrl::Capslock | |
| `::Esc | |
| Esc::` |
L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns
Compress 1K bytes with Zippy ............. 3,000 ns = 3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns = 20 µs
SSD random read ........................ 150,000 ns = 150 µs
Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs
| from itertools import ifilter | |
| from itertools import islice | |
| def sieve_worker(numbers, table): | |
| head = next(numbers) | |
| if head not in table: | |
| yield head | |
| table[head+head] = [head] | |
| else: |
| (require '[clojure.string :as str]) | |
| (defn parse-str-to-cells [str-cells] | |
| (->> (str/split str-cells #"\s+") | |
| (mapv #(Integer. %)))) | |
| (defn is-end-by-num-of-cell [n] | |
| #(= (dec n) %)) | |
| (defn step [wheel cells is-end?] |
| (require '[clojure.string :as str]) | |
| (defrecord Coffee [water ground]) | |
| (defn return-monad-coffee [water ground] | |
| (fn [] | |
| (Coffee. water ground))) | |
| (defn bind-monad-coffee [m-coffee f] | |
| (f (m-coffee))) |
| (defn decreasing-from-last [v] | |
| (loop [start (dec (.length v))] | |
| (let | |
| [prev-start (dec start)] | |
| (cond | |
| (< prev-start 0) 0 | |
| (neg? (compare (get v prev-start) (get v start))) start | |
| :else (recur (dec start)))))) | |
| (defn next-permutation [v] |
| (defn veckey-to-set [veckey] | |
| (reduce (fn [[column set-key] k] | |
| (if (contains? set-key k) | |
| [column set-key] | |
| [(conj column k) (conj set-key k)])) | |
| [[] #{}] | |
| veckey)) | |
| (defn handle-rest-char [set-key] | |
| (let [char-seq (map char (range (int \A) (inc (int \Z))))] |
| import timeit | |
| t1 = timeit.default_timer() | |
| # run a long long time | |
| t2 = timeit.default_timer() | |
| print(t2 - t1) |