Skip to content

Instantly share code, notes, and snippets.

View smee's full-sized avatar

Steffen Dienst smee

View GitHub Profile
;;=============== play with flow ==============
(require '[clojure.core.async :as async]
'[clojure.core.async.flow :as flow]
'[clojure.pprint :as pp]
'[clojure.datafy :as d])
(set! *warn-on-reflection* true)
(defn monitoring [{:keys [report-chan error-chan]}]
(prn "========= monitoring start")
@panzi
panzi / export_local_storage.js
Created March 6, 2024 18:51
Bookmarklets to export/import localStorage. Import does *not* clean localStorage, only sets the loaded values.
// bookmarklet:
// javascript:(function()%7Bconst%20blob%3Dnew%20Blob(%5BJSON.stringify(localStorage)%5D%2C%7Btype%3A'application%2Fjson'%7D)%3Bconst%20link%3Ddocument.createElement('a')%3Bconst%20url%3DURL.createObjectURL(blob)%3Blink.href%3Durl%3Blink.download%3D'local_storage.json'%3Blink.style.display%3D'none'%3Bdocument.body.appendChild(link)%3Blink.click()%3BsetTimeout(()%3D%3E%7BURL.revokeObjectURL(url)%3Bdocument.body.removeChild(link)%3B%7D%2C250)%3B%7D)()%3B
function exportLocalStorage(){
const blob = new Blob([JSON.stringify(localStorage)],{type:'application/json'});
const link = document.createElement('a');
const url = URL.createObjectURL(blob);
link.href = url;
link.download = 'local_storage.json';
link.style.display='none';
document.body.appendChild(link);
@noone2k
noone2k / bc2500-ble-idf.yaml
Last active September 30, 2025 16:16
bc2500 info/control with esphome
bin dann auch erstmal wech ...
gibt hier wieder einen, der ein ungutes gefühl verbreitet und das muss ich mir nicht antun.
wenn ich auf hassprediger stehen würde, würde ich bsw, afd oder den IS wählen 😁
abgesehen davon, ist das hier sogut wie abgeschlossen und ich bin nicht hierauf angewiesen 😁
vllt später nochmal öffnen, falls ich doch mal wieder nen antreib/grund finde ... 😁
abschließend verweise ich noch auf folgendes:
@rutenkolk
rutenkolk / upgrade_zig.clj
Created September 16, 2021 22:35
upgrading zig to the latest version with Babashka
#!/usr/bin/env bb
(ns script
(:require [clojure.java.io :as io]
[clojure.string :as s]
[clojure.pprint :as pprint]
[clojure.java.shell :refer [sh with-sh-dir]]
[cheshire.core :as json]))
(defn prsh
([sh]
@holyjak
holyjak / http-server.bb
Last active May 20, 2025 08:49
Babashka HTTP server for serving static files, similar to `python -m http.server` but more flexible :)
#!/usr/bin/env bb
#_" -*- mode: clojure; -*-"
;; Based on https://github.com/babashka/babashka/blob/master/examples/image_viewer.clj
(ns http-server
(:require [babashka.fs :as fs]
[clojure.java.browse :as browse]
[clojure.string :as str]
[clojure.tools.cli :refer [parse-opts]]
[org.httpkit.server :as server]
@henrik42
henrik42 / clojurescript-on-a-microcontroller.md
Last active April 21, 2024 18:53
Clojurescript auf einem Microcontroller

ClojureScript auf einem Mikrocontroller

Vor einiger Zeit haben ich den HuCon-Roboter-Bausatz erhalten. Der HuCon wird mit Blockly und Python programmiert. Ich programmiere schon lange auf PCs (vor allem Java und Clojure), aber mit Microcontrollern habe ich nur wenig Erfahrung. Als erstes habe ich mich mit der Installation von OpenWrt

@ericnormand
ericnormand / 00 Digit search.md
Last active December 21, 2022 00:45
399 - PurelyFunctional.tv Newsletter

Digit search

This is one of those weird programming puzzles with no real point except practice. But it's considered Very Hard in JavaScript. Let's see how we do in Clojure.

Write a function that takes a sequence of integers. You're trying to get all 10 digits by looking through the numbers sequentially. When you have found one instance of every decimal digit, return whatever number you were on when you found the last one. If you get to the end of the sequence without finding all the digits (for instance, maybe there was no 9), then just return nil.

Example

(digit-search [5175 4538 2926 5057 6401 4376 2280 6137]) ;=> 5057
DROP TABLE IF EXISTS pgbench_generic_log;
CREATE TABLE pgbench_generic_log (
mtime timestamptz not null default now(),
action char not null check (action in ('I', 'U', 'D')),
username text not null,
table_name text not null,
row_data jsonb not null
);
CREATE INDEX ON pgbench_generic_log USING brin (mtime);
@cldwalker
cldwalker / spike-day-02-03-20.md
Last active June 19, 2024 04:24
GraalVM dive in Clojure at work

Spike

I looked into the state of GraalVM and Clojure and wrote some small work-related scripts.

GraalVM Build Tools

@jjttjj
jjttjj / deps.edn
Last active March 4, 2023 19:03 — forked from jdf-id-au/transit-connection.cljc
Sketch for connecting henryw374/time-literals to transit
{:paths ["."]
:deps {time-literals/time-literals {:mvn/version "0.1.5"}
com.cognitect/transit-clj {:mvn/version "0.8.319"}
com.cognitect/transit-cljs {:mvn/version "0.8.256"}
}}