This file contains hidden or 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
| ;; Trident state persisted in redis. | |
| ;; Implemented in clojure using marceline lib. | |
| ;; Based on https://github.com/kstyrc/trident-redis | |
| (ns state.redis | |
| (:require [marceline.storm.trident :as t] | |
| [clj-redis.client :as redis]) | |
| (:import [storm.trident.state.map CachedMap TransactionalMap NonTransactionalMap OpaqueMap SnapshottableMap])) | |
| (defn- get-type-map |
This file contains hidden or 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
| (ns extend-core-logic.core | |
| (:require [clojure.core.logic :refer :all] | |
| [clojure.core.logic.protocols :refer [walk]] | |
| [clojure.java.io :as jio] | |
| [clojure.string :as string]) | |
| (:import [java.io BufferedReader StringReader])) | |
| ;; from: http://federalgovernmentzipcodes.us/ | |
| (defn load-db [] | |
| (let [data (java.io.BufferedReader. (java.io.StringReader. (slurp "/Users/tim/Downloads/free-zipcode-database.csv"))) |
This file contains hidden or 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
| #!/bin/bash | |
| set -x | |
| # | |
| # Grab verified boot utilities from ChromeOS. | |
| # | |
| mkdir -p /usr/share/vboot | |
| mount -o ro /dev/sda3 /mnt | |
| cp /mnt/usr/bin/vbutil_* /usr/bin |
This file contains hidden or 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
| -- show running queries (pre 9.2) | |
| SELECT procpid, age(clock_timestamp(), query_start), usename, current_query | |
| FROM pg_stat_activity | |
| WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%' | |
| ORDER BY query_start desc; | |
| -- show running queries (9.2) | |
| SELECT pid, age(clock_timestamp(), query_start), usename, query | |
| FROM pg_stat_activity | |
| WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%' |
This file contains hidden or 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
| (ns lucenalog.core | |
| "Lucenalog = Datalog interface to Lucene in 10 lines. | |
| Simple but powerful. | |
| Use | |
| (db/add (index) {:a \"foo\" :b \"bar\"}) | |
| to index a map with Lucene. Then you can use the relation |
This file contains hidden or 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
| (ns playmatch | |
| (:use [clojure.core.match.core :only (match)])) | |
| (defn len [coll] | |
| "calc the length of a sequence" | |
| (match [coll] | |
| [[]] 0 | |
| [[f & r]] (inc (len r)))) |
NewerOlder