Skip to content

Instantly share code, notes, and snippets.

View MichaelDrogalis's full-sized avatar

Michael Drogalis MichaelDrogalis

  • Confluent
  • Seattle, WA
View GitHub Profile
(when-let [x <value>]
(when (not= x ::poison-pill)
<body using x>))
(def conn (start-datomic! (str "datomic:mem://" (java.util.UUID/randomUUID)) (schema)))
(def data
[{:db/id (d/tempid :com.mdrogalis/people)
:user/name "Mike"}
{:db/id (d/tempid :com.mdrogalis/people)
:user/name "Dorrene"}
{:db/id (d/tempid :com.mdrogalis/people)
:user/name "Benti"}
{:db/id (d/tempid :com.mdrogalis/people)
(defn run-query [q]
(info "Executing query: " q)
(try
(if-not (nil? q)
(let [result (database/query *db* q)]
(metrics/record-db-hit)
{:error :nil-query})
(catch Exception e
(warn "Error issuing query" q)
{:error :database-error})))
@MichaelDrogalis
MichaelDrogalis / node-1-hornetq-beans.xml
Last active August 29, 2015 14:03
node-1-hornetq-configuration.xml
<?xml version="1.0" encoding="UTF-8"?>
<deployment xmlns="urn:jboss:bean-deployer:2.0">
<!-- MBean server -->
<bean name="MBeanServer" class="javax.management.MBeanServer">
<constructor factoryClass="java.lang.management.ManagementFactory"
factoryMethod="getPlatformMBeanServer"/>
</bean>
user=> (def a 4984967348648376483967984674386738947648397848673468943796984937)
#'user/a
user=> (type a)
clojure.lang.BigInt
user=> (def b 9347683768743769834764843787348967496747698)
#'user/b
user=> (type b)
clojure.lang.BigInt
user=> (- a b)
4984967348648376483958636990617995177813633004886119976300237239N
[{:onyx/name :partition-datoms
:onyx/ident :datomic/partition-datoms
:onyx/type :input
:onyx/medium :datomic
:onyx/consumption :sequential
:onyx/bootstrap? true
:datomic/uri db-uri
:datomic/t t
:datomic/datoms-per-segment batch-size
:datomic/partition :com.mdrogalis/people
(ns ^:no-doc onyx.logging-configuration
(:require [com.stuartsierra.component :as component]
[taoensso.timbre :refer [info] :as timbre]))
(defrecord LoggingConfiguration [file config]
component/Lifecycle
(start [component]
(if config
(timbre/set-config! [] config)
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC7eL3odqmRYCJmIDqGuSs9mArMhfTlY+0tjaTk7taP6eOFh40YmvIQi3j1zYoQeTEbsrU/JmkxOe42u8Gpp+GA2kOCWdyKTqJOpzlTkkK3FDK5V9B1m3EaNDA8Gu8Bld/4qg4VNauRUilZHktOjKJqtsEI3CmoSvTbkJG3znUAKy7xg07934iSU36HVR3vGS3HR+lMdVhfYmhHv0HR7+TbOihWlfVXQhkKWliCUivibAh/73sgA5ayTLlxnkCThV/jyx7uTL+uVV1wWXeRsUFGaGNkQ7Fl11H69KOB0RNx+L/zgGr1QtfDwmFt6JtpxvmbHBN1BYVROLnA9hpSH373 mjd3089@rit.edu
(def xform
(comp (map inc)
(filter even?)
(dedupe)))
(def data (vec (interleave (range 18) (range 18))))
;; lazily transform the data
(sequence xform data)
@MichaelDrogalis
MichaelDrogalis / gist:0a18c2c6eee0fbd16df7
Created September 21, 2014 16:34
Converting multi-input streams to Onyx trees.
(defn graph-to-onyx-tree [graph]
(reduce
(fn [workflow root]
(if (set? root)
(reduce (fn [result input] (assoc result input (get graph root))) workflow root)
(assoc workflow root (get graph root))))
{}
(keys graph)))
(graph-to-onyx-tree {#{:A :B :C} {:D :E} :F {:G :H}})