Skip to content

Instantly share code, notes, and snippets.

View BRonen's full-sized avatar
:shipit:
ora et labora

Brenno Rodrigues BRonen

:shipit:
ora et labora
View GitHub Profile
@BRonen
BRonen / arithmetic.jq
Created August 16, 2025 16:56
Reverse polish notation arithmetic interpreter in JQ
def tokens:
split(" ") | map(select(length > 0));
def isnum:
test("^-?([0-9]+(\\.[0-9]+)?)$");
def evaluate:
def eval($tokens):
if ($tokens | length) == 0 then
error("ending unexpected")
@BRonen
BRonen / infix_math_dsl.clj
Created October 4, 2025 00:58
infix math dsl macro to clojure
(defmacro infix-math-dsl [form]
(letfn [(parse [x]
(cond
(number? x)
{:node :number :value x}
(symbol? x)
(let [s (str x)]
(if (contains? #{"+" "-" "*" "/"} s)
{:node :op :value x}
@BRonen
BRonen / atom_cas.clj
Created November 21, 2025 05:26
Compare-and-Swap invalidation experiment using clojure atoms
(ns atom-cas
(:require [clojure.core.async :as async]))
(def a (atom 0))
(defn updater [current-value]
(prn "Thread: " (Thread/currentThread))
(prn "Current: " current-value)
(Thread/sleep 500)
(inc current-value))
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include <assert.h>
#define WIDTH 1000
#define DEPTH 5
struct CountMinSketch {