Skip to content

Instantly share code, notes, and snippets.

Keith Irwin zentrope

Block or report user

Report or block zentrope

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View temp20140130.clj
(loop [sec 0
good 0]
(let [{:keys [out exit] :as result} (ping! host)]
(print (if (zero? exit) "#" "."))
(let [new-sec (inc sec)
clear? (= new-sec 60)
new-good (if (zero? exit) (inc good) good)]
(when clear?
(println (summarize good)))
zentrope / loopy.clj
Last active Aug 29, 2015
two async loops for pinging a host
View loopy.clj
(ns cping.core
(:require [ :as shell :refer [sh]]
[clojure.core.async :refer [queue go-loop timeout chan <! put!]]))
(defn- ping!
"Use the shell to ping the given host"
(sh "ping" "-W" "1" "-c" "1" host))
zentrope /
Created Feb 25, 2014
Postgres sandbox control script sort of.
function is_alive() {
result=$(pg_ctl status -p ${port} -D ${db} | grep "server is running")
zentrope / shared.cljs
Last active Aug 29, 2015
get-shared not working?
View shared.cljs
(ns tag.main
[om.core :as om :include-macros true]
[om.dom :as dom :include-macros true]))
(defn- header-component
[state owner]
(dom/section nil
(dom/h1 nil "Hello!")
View login.cljs
(defn- handle-change
[e owner field]
(om/set-state! owner field (value! owner (name field))))
(defn- handle-submit
[state owner]
(om/set-state! owner :error-msg "")
(let [{:keys [user pass]} (om/get-state owner)
creds {:user user :pass pass}
response (chan)]
View related.clj
View build.boot
:src-paths #{"src" "src-cljs"}
:rsc-paths #{"resources"}
:dependencies '[[org.clojure/clojure "1.7.0-alpha3"]
[org.clojure/core.async "0.1.346.0-17112a-alpha"]
[compojure "1.2.1"]
[http-kit "2.1.19"]
[org.clojure/data.json "0.2.5"]
[org.clojure/tools.logging "0.3.1"]
[ch.qos.logback/logback-classic "1.1.2"]
View build.boot.clj
;; -*- mode: clojure; -*-
:src-paths #{"src/clj" "src/cljs"}
:rsc-paths #{"resources"}
:update :always
:dependencies '[[org.clojure/clojure "1.7.0-alpha4"]
[org.clojure/core.async "0.1.346.0-17112a-alpha"]
[com.taoensso/timbre "3.3.1-1cd4b70"]
[http-kit "2.1.19"]
zentrope / fs.clj
Created Jan 14, 2015
file system utils
View fs.clj
(ns lib.fs
;; File system utilities
[clojure.string :refer [lower-case join trim]]
[ :as io])
[ ZipInputStream]))
View file-backed-atom.clj
(ns afile.core
[clojure.edn :as edn]
[clojure.pprint :refer [pprint]]
[clojure.test :refer [deftest is run-tests]]))
(defn- load-file!
[fname init-value]
(let [f ( fname)]
(if (.exists f)
You can’t perform that action at this time.