Skip to content

Instantly share code, notes, and snippets.

💨 💨

Enzzo souenzzo

💨 💨
View GitHub Profile
souenzzo /
Created Mar 9, 2019
Run with java --source 11
import java.util.Objects;
public class Main {
public static void main(String[] args) {
var foo = new Object() {
String x = "aa";
Thread t;
t = new Thread(() -> {
if (Objects.nonNull(foo.x)) {
souenzzo / deps.edn
Last active Feb 21, 2019
lacinia HTTP API with generators
View deps.edn
{:paths ["."]
:deps {org.clojure/clojure {:mvn/version "1.10.0"}
com.walmartlabs/lacinia {:mvn/version "0.32.0"}
io.pedestal/pedestal.service {:mvn/version "0.5.5"}
io.pedestal/pedestal.jetty {:mvn/version "0.5.5"}
com.walmartlabs/lacinia-pedestal {:mvn/version "0.11.0"}
org.clojure/test.check {:mvn/version "0.10.0-alpha3"}
com.rpl/specter {:mvn/version "1.1.2"}}}
souenzzo / deps.edn
Last active Jan 9, 2019
core.async cljs bug. Run 'clj -m cljs.main --repl-env node -m hack'
View deps.edn
;; clj -Srepro -Sdeps '{:deps {cljs-bug {:git/url "" :sha "eded47447764e7eb8d4cb25be1d77640e9c50aaf"}}}' -m hack ## works!
;; clj -Srepro -Sdeps '{:deps {cljs-bug {:git/url "" :sha "eded47447764e7eb8d4cb25be1d77640e9c50aaf"}}}' -m cljs.main --repl-env node -m hack ## Can't recur here at line 44 hack.cljc
{:paths ["."]
:deps {org.clojure/clojure {:mvn/version "1.10.0"}
org.clojure/clojurescript {:mvn/version "1.10.439"}
org.clojure/core.async {:mvn/version "0.4.490"}}}
use std::ops::Add;
use std::ops::Div;
trait IAverage<T> {
fn new(a: T) -> Self;
fn combine(self, b: Self) -> Self;
fn result(self) -> T;
// trait Number: Sized
souenzzo /
Last active Nov 20, 2018
Clara issue demo

Run with

clj -Sdeps '{:deps {clara-demo {:git/url "" :sha "e08684d9b24e9ea91a9922b2f512bcf0a3eb7a7e"}}}' -m clara-demo

Will print:

[:rule1 :mk-session]
[:rule2 :fire-rules]
["rule1" :a]
["rule2" :a]
View drop-between.clj
(defn drop-between [start? pred? stop?]
(fn [rf]
(let [drop? (volatile! false)]
([] (rf))
([result] (rf result))
([result input]
(when (stop? input)
(vreset! drop? false))
(when (start? input)
souenzzo /
Created Oct 2, 2018
cria uma VM com arch linux descartavel em menos de 1 min. Requer ~3Gb de RAM livre (para criar disco+RAM)
#!/usr/bin/env sh
set -x
set -e
TEMPDIR="$(dirname "${TEMPDISK}")"
View core.clj
(defn distinct-by
"Like clojure.core/distinct, but applys f"
(fn [rf]
(let [seen (volatile! #{})]
([] (rf))
([result] (rf result))
([result input]
(let [id (f input)]
View parser.clj
(defmulti ast->clj first)
(defmethod ast->clj :S
[[_ _ body]]
(into [] cat (ast->clj body)))
(defmethod ast->clj :AE
[[_ b]]
(ast->clj b))
souenzzo / error.clj
Last active Sep 5, 2018
nice error form org.clojure/clojure 1.10.0-alpha7
View error.clj
#error {
:cause Call to clojure.core/ns did not conform to spec.
:data #:clojure.spec.alpha{:problems [{:path [], :reason Extra input, :pred (clojure.spec.alpha/cat :docstring (clojure.spec.alpha/? clojure.core/string?) :attr-map (clojure.spec.alpha/? clojure.core/map?) :ns-clauses :clojure.core.specs.alpha/ns-clauses), :val ((:import [org.agrona.concurrent UnsafeBuffer] [java.nio.ByteOrder])), :via [:clojure.core.specs.alpha/ns-form], :in [1]}], :spec #object[clojure.spec.alpha$regex_spec_impl$reify__2509 0x3a4444c4 clojure.spec.alpha$regex_spec_impl$reify__2509@3a4444c4], :value (onyx.state.serializers.windowing-key-encoder (:import [org.agrona.concurrent UnsafeBuffer] [java.nio.ByteOrder])), :args (onyx.state.serializers.windowing-key-encoder (:import [org.agrona.concurrent UnsafeBuffer] [java.nio.ByteOrder]))}
[{:type clojure.lang.Compiler$CompilerException
:message Syntax error macroexpanding clojure.core/ns at (onyx/state/serializers/windowing_key_encoder.clj:1:1).
:data #:clojure.error{:
You can’t perform that action at this time.