Skip to content

Instantly share code, notes, and snippets.

@devn
Created March 24, 2010 07:06
Show Gist options
  • Select an option

  • Save devn/342052 to your computer and use it in GitHub Desktop.

Select an option

Save devn/342052 to your computer and use it in GitHub Desktop.
(set! *print-length* 50)
(set! *warn-on-reflection* true)
;; psykotic's trace-seq functions
(defn trace-seq* [name xs printer]
(for [x xs]
(do (println name "->" (printer x))
x)))
(defmacro trace-seq [xs & [printer]]
`(trace-seq* ~(str xs) ~xs ~(or printer identity)))
(defn find-lines-in-file [#^String text file]
(filter (fn [#^String line]
(< 0 (.indexOf line text)))
(line-seq (reader file)))) ;took out flatten here
(defn parse-outside-ips [coll]
(remove empty?
(pmap
#(rest (re-find #"Deny tcp src outside:(\d+\.\d+\.\d+\.\d+)" %))
coll)))
; => (("127.0.0.1") ("127.0.0.1") ("123.456.789.0")...)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment