Skip to content

Instantly share code, notes, and snippets.

@narma
narma / diag.scala
Last active March 23, 2021 11:27 — forked from jsfwa/diag.scala
//Any - because everything in zio is private even diagnostic trait
class StreamDiagnostics(val queue: Queue[Any]) extends LogSupport {
val map = TrieMap.empty[String, Promise[Throwable, Unit]]
def runWithMonitor[R](tp: TopicPartition, stream: ZStream[R, Throwable, _]): ZIO[R, Throwable, Unit] =
for {
p <- Promise.make[Throwable, Unit]
_ <- queue.offer(StreamControl(tp, p))
fb <- stream
@narma
narma / Gemfile
Created June 24, 2020 22:52 — forked from dhh/Gemfile
HEY's Gemfile
ruby '2.7.1'
gem 'rails', github: 'rails/rails'
gem 'tzinfo-data', '>= 1.2016.7' # Don't rely on OSX/Linux timezone data
# Action Text
gem 'actiontext', github: 'basecamp/actiontext', ref: 'okra'
gem 'okra', github: 'basecamp/okra'
# Drivers
(use 'clojure.core.async)
(defn req [server query]
(go
(<! (timeout (rand-int 100)))
(str query " from " server)))
(defn fastest [query & servers]
(let [c (chan)]
(doseq [server servers]
@narma
narma / gist:3667979
Created September 7, 2012 17:32 — forked from marekjelen/gist:3256675
New PostgreSQL on OpenShift
POSTGRESQL_VERSION="9.2.1"
# Installing DB (one-time)
cd $OPENSHIFT_DATA_DIR
wget http://ftp.postgresql.org/pub/source/v${POSTGRESQL_VERSION}/postgresql-${POSTGRESQL_VERSION}.tar.gz
tar xf postgresql-${POSTGRESQL_VERSION}.tar.gz
rm postgresql-${POSTGRESQL_VERSION}.tar.gz