Skip to content

Instantly share code, notes, and snippets.

View Ramblurr's full-sized avatar

Casey Link Ramblurr

View GitHub Profile
@Ramblurr
Ramblurr / log.txt
Last active April 20, 2025 13:24
Inaccessible `(ex-data ..)` in datahike exceptions
2025-04-20T13:18:30.410Z quine DEBUG [datahike.connector:149] - Using config {:keep-history? true, :search-cache-size 10000, :index :datahike.index/persistent-set, :store {:path "/tmp/example", :scope "127.0.0.2", :backend :file}, :store-cache-size 1000, :attribute-refs? false, :writer {:backend :self}, :crypto-hash? false, :schema-flexibility :write, :branch :db}
2025-04-20T13:18:30.423Z quine DEBUG [datahike.writing:296] - Transacting 1 objects
2025-04-20T13:18:30.454Z quine DEBUG [datahike.writing:296] - Transacting 1 objects
2025-04-20T13:18:30.476Z quine DEBUG [datahike.writing:296] - Transacting 1 objects
2025-04-20T13:18:30.476Z quine ERROR [datahike.db.transaction:231] - Cannot add #datahike/Datom [3 :name "Alice" 536870915 true] because of unique constraint: #datahike/Datom [2 :name "Alice" 536870914 true] {:error :transact/unique, :attribute :name, :datom #datahike/Datom [3 :name "Alice" 536870915 true]}
2025-04-20T13:18:30.478Z quine ERROR [datahike.writer:73] - Error during invocation {:op tra
const pattern = /\(\s*((function)\s*\(\s*\)|(\(\s*\))\s*=>)\s*(?:\{[\s\S]*?\}|[^;)\{]*)\s*\)\s*\(\s*\)/g;
const showPassed = false;
const test = (input, expected) => {
const actual = input.match(pattern) || [];
const passed = JSON.stringify(actual) === JSON.stringify(expected);
if(showPassed || !passed) {
console.log(passed ? 'PASSED' : 'FAILED');
console.log(`Input:${input}`);
console.log(`Expected: ${JSON.stringify(expected)}`);
// a simple widget for positioning HTML popovers using a vendored floating ui (because I can't use css anchor positioning yet)
const { computePosition, flip } = window.FloatingUIDOM;
export function ActionMenuPopover(container) {
const trigger = container.querySelector("[popovertarget]");
const popover = container.querySelector("[popover]");
const update = () => {
computePosition(trigger, popover, {
placement: "bottom",
middleware: [flip()],
@Ramblurr
Ramblurr / tab_state.clj
Created April 10, 2025 11:18
a quicky example of per-tab session state with datastar when using hyperlith style page rendering
;; a quicky example of per-tab session state with datastar
;; when using hyperlith style page rendering
(:require
[clojure.core.async :as a]
[chime.core :as chime])
(def !page-state (atom {}))
@Ramblurr
Ramblurr / gist:b26b2d649ef44e827ed6a624ffffbb3b
Created February 5, 2025 13:17
systemd networkd [RoutingPolicyRule] Section Options
[RoutingPolicyRule] Section Options
An [RoutingPolicyRule] section accepts the following settings. Specify several [RoutingPolicyRule] sections to configure several rules.
TypeOfService=
This specifies the Type of Service (ToS) field of packets to match; it takes an unsigned integer in the range 0…255. The field can be used to specify precedence (the first 3 bits) and ToS (the next 3 bits). The field can be also used to specify Differentiated Services Code Point (DSCP) (the first 6 bits) and Explicit Congestion Notification (ECN) (the last 2 bits). See Type of Service and Differentiated services for more details.
Added in version 235.
From=
@Ramblurr
Ramblurr / dynamic-wallpaper.nix
Created March 27, 2024 07:50
nixfmt breaking this file
# Source: https://github.com/b3nj5m1n/dotfiles/blob/1da98eb2745ea4b0e4b789c38a037080bbf8347f/nix/modules/nixos/dynamic-wallpaper.nix#L8
# (C) https://github.com/b3nj5m1n
# License: AGPL v3
{
pkgs,
config,
lib,
...
}:
with lib; let
@Ramblurr
Ramblurr / browser.clj
Created October 6, 2023 09:00
Refresh a chrome tab from your clj repl
(ns browser
(:require [etaoin.api :as eta] ;; https://clojars.org/etaoin
[clojure.core.async :as async]))
(defn debounce [in timeout-atom]
(let [out (async/chan)]
(async/go-loop [last-val nil]
(let [val (if (nil? last-val) (async/<! in) last-val)
ms @timeout-atom
timer (async/timeout ms)
@Ramblurr
Ramblurr / raspberry-pi-zero-2.nix
Created September 3, 2023 16:25 — forked from plmercereau/raspberry-pi-zero-2.nix
Nix module to create SD images for Rasperry Pi Zero 2 W
{ config, lib, pkgs, ... }:
{
imports = [
<nixpkgs/nixos/modules/installer/sd-card/sd-image-aarch64-installer.nix>
./sd-image.nix
];
system.stateVersion = "23.11";
# Pi Zero 2 struggles to work without swap
sdImage.swap.enable = true;
@Ramblurr
Ramblurr / secret_box.clj
Created January 19, 2023 09:22
Simple encrypt/decrypt functions in clojure using AES GCM and argon2id key derivation.
(ns secret-box
(:import
org.bouncycastle.crypto.generators.Argon2BytesGenerator
org.bouncycastle.crypto.params.Argon2Parameters
org.bouncycastle.crypto.params.Argon2Parameters$Builder)
(:require
[taoensso.nippy :as nippy]
[buddy.core.crypto :as crypto]
[buddy.core.codecs :as codecs]
[buddy.core.nonce :as nonce]))
@Ramblurr
Ramblurr / probenplan.py
Last active June 4, 2022 09:55
a quick script to generate a reherseal schedule for a street band
from itertools import cycle
from datetime import date, timedelta
import random
import math
from tabulate import tabulate
# How many weeks should we generate a probenplan for?
weeks = 6
# What date does the first probe start on?