Skip to content

Instantly share code, notes, and snippets.

View emidln's full-sized avatar

Brandon Adams emidln

  • Chicago, IL
View GitHub Profile
@svard
svard / redis-state
Created April 27, 2014 20:33
Trident redis state using marceline
;; 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
@halgari
halgari / gist:7160778
Created October 25, 2013 19:47
Using core.logic to query custom data sources.
(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")))
@mrflip
mrflip / tuning_storm_trident.asciidoc
Last active October 8, 2024 15:18
Notes on Storm+Trident tuning

Tuning Storm+Trident

Tuning a dataflow system is easy:

The First Rule of Dataflow Tuning:
* Ensure each stage is always ready to accept records, and
* Deliver each processed record promptly to its destination
@carletes
carletes / ubuntu-kernel-for-acer-c7.sh
Last active November 22, 2018 03:51
Script to create Ubuntu kernel packages for an Acer C7 Chromebook running ChrUbuntu
#!/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
@rgreenjr
rgreenjr / postgres_queries_and_commands.sql
Last active March 14, 2026 17:03
Useful PostgreSQL Queries and Commands
-- 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%'
@jsmorph
jsmorph / logicrels-lucene.clj
Created July 6, 2012 14:01
Lucenalog: Datalog interface to Lucene in 10 lines
(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
@CampingScorpion
CampingScorpion / defmatch.clj
Created October 3, 2011 01:53
macro to define match-based functions
(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))))