Skip to content

Instantly share code, notes, and snippets.

vagrant@ubuntu-12:~$ netstat -an | grep LISTEN
tcp 0 0 0.0.0.0:39084 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:38287 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN
tcp 0 0 10.0.2.15:9042 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN
tcp 0 0 10.0.2.15:7000 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:7199 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:60453 0.0.0.0:* LISTEN
tcp 0 0 10.0.2.15:9160 0.0.0.0:* LISTEN
@sw1nn
sw1nn / core.clj
Last active August 29, 2015 13:56
(ns koobar.core
(:require [clj-kafka.core :refer (with-resource)]
[clj-kafka.zk :refer (brokers topics)]
[clj-kafka.consumer.zk :as kc]
[clj-kafka.producer :as kp]
[clojure.string :as str]))
(def config {"zookeeper.connect" "localhost:2181"
"group.id" "clj-kafka.consumer"
"auto.offset.reset" "smallest"
@sw1nn
sw1nn / sw1nn.el
Last active August 29, 2015 13:57
;;Treat hyphens as a word character when transposing words
;; based on https://github.com/overtone/emacs-live/blob/a7951de9bad6153537f6ee8af46d18bbc2bf0166/packs/dev/clojure-pack/config/clojure-conf.el#L39
(defvar sw1nn-clojure-mode-with-hyphens-as-word-sep-syntax-table
(let ((st (make-syntax-table clojure-mode-syntax-table)))
(modify-syntax-entry ?- "w" st)
st))
(defun sw1nn-transpose-words-with-hyphens (arg)
"Treat hyphens as a word character when transposing words"
(interactive "*p")
(require '[qbits.hayt :refer :all])
(require '[clj-time.core :refer (date-time)])
;; Assume this column family definition
;;
;; create table meta_data (
;; "a-b" text,
;; "b-c" timestamp,
;; primary key ("a-b"))
;;
@sw1nn
sw1nn / csv.clj
Last active August 29, 2015 14:01
(def season-09-10
"/home/neale/Downloads/09-10.csv")
(def cols {"Date" :date
"HomeTeam" :home-team
"AwayTeam" :away-team
"FTHG" :home-score
"FTAG" :away-score
"B365H" :home-win-odds
"B356D" :draw-odds
; CIDER 0.7.0alpha (package: 20140615.908) (Java 1.7.0_55, Clojure 1.5.1, nREPL 0.2.3, cider-nrepl 0.7.0-snapshot)
WARNING: The following required nREPL ops are not supported:
classpath complete info inspect-start inspect-refresh inspect-pop inspect-push inspect-reset macroexpand macroexpand-1 macroexpand-all stacktrace toggle-trace
Please, install (or update) cider-nrepl 0.7.0-snapshot and restart CIDER
clojure.test.mode>
; CIDER 0.7.0 (Java 1.7.0_55, Clojure 1.5.1, nREPL 0.2.3, cider-nrepl 0.7.0)
WARNING: The following required nREPL ops are not supported:
classpath complete info inspect-start inspect-refresh inspect-pop inspect-push inspect-reset macroexpand macroexpand-1 macroexpand-all resource stacktrace toggle-trace
Please, install (or update) cider-nrepl 0.7.0 and restart CIDER
user>

Keybase proof

I hereby claim:

  • I am sw1nn on github.
  • I am sw1nn (https://keybase.io/sw1nn) on keybase.
  • I have a public key whose fingerprint is 00C0 A76D 017E 8E14 FA93 D16B 5273 932C A25D 0ABF

To claim this, I am signing this object:

user> *clojure-version*
{:major 1, :minor 7, :incremental 0, :qualifier "alpha2"}
user> (defn colsum [f1]
(let [acc (atom (repeat 0))]
(fn
([] (f1))
([result] (f1 (vec @acc)))
([result input]
(swap! acc #(map + %1 %2) input)
result))))
weave 2014/12/11 13:19:55.012864 Attempting connection to 10.23.1.192:6783
weave 2014/12/11 13:19:55.013569 dial tcp4 10.23.1.192:6783: connection refused
weave 2014/12/11 13:19:57.635682 Attempting connection to 10.23.1.185:6783
weave 2014/12/11 13:19:57.636172 dial tcp4 10.23.1.185:6783: connection refused
weave 2014/12/11 13:20:07.710553 ->[10.23.1.189:40351] encountered error during handshake: Already have connection to 7a:17:f8:60:65:d1 at 10.23.1.189:6783
weave 2014/12/11 13:20:16.088137 Attempting connection to 10.23.1.188:6783
weave 2014/12/11 13:20:16.088690 dial tcp4 10.23.1.188:6783: connection refused
weave 2014/12/11 13:20:19.231901 ->[10.23.1.193:43468] encountered error during handshake: Already have connection to 7a:79:89:9f:94:1d at 10.23.1.193:6783
weave 2014/12/11 13:20:21.558148 Attempting connection to 10.23.1.192:6783
weave 2014/12/11 13:20:21.558796 dial tcp4 10.23.1.192:6783: connection refused