Skip to content

Instantly share code, notes, and snippets.

View borkdude's full-sized avatar

Michiel Borkent borkdude

View GitHub Profile
@borkdude
borkdude / deploy.sh
Created March 18, 2022 11:04 — forked from jackrusher/deploy.sh
Writing and deploying Google Cloud Functions in Clojure using NBB
# command line to deploy the project
gcloud functions deploy hello --runtime nodejs14 --trigger-http
@borkdude
borkdude / analyze.clj
Created October 25, 2021 16:28 — forked from roman01la/analyze.clj
analyzing unused and undefined re-frame subscriptions via clj-kondo
(ns analyze.core
(:require [clj-kondo.core :as clj-kondo]
[clojure.set :as set]))
;; checks re-frame's :<- syntax
;; to mark dependency subscriptions as used
(def analyze-reg-sub
"(require '[clj-kondo.hooks-api :as api])
(fn [{node :node}]
(let [[_ kw & children] (:children node)
@borkdude
borkdude / gallery.cljs
Last active March 30, 2024 17:36 — forked from yogthos/gallery.cljs
script to download walpapers from windowsonearth.org, adapted for nbb
@borkdude
borkdude / DynamicJava.java
Created June 15, 2021 08:52 — forked from mukel/DynamicJava.java
Compiling Java code dynamically and running it in Espresso.
import java.lang.reflect.Method;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import org.graalvm.polyglot.Context;
import org.graalvm.polyglot.Value;
@borkdude
borkdude / klein.clj
Last active September 23, 2021 12:39
#!/usr/bin/env bb
;; Ported from https://gist.github.com/pyr/d5e17af9c572b681a57de52895437298 to babashka
;; klein aims to be a small joker script to mimick
;; most of leiningen's default behavior while minimizing
;; divergence from standard facilities provided by
;; tools.deps
;; This is built as a single file script to simplify
;; deployment and will avoid requiring any code beyond
@borkdude
borkdude / lint.clj
Created September 26, 2020 18:51 — forked from hansbugge/lint.clj
Code Quality report for Clojure projects in Gitlab using babashka and clj-kondo.
#!/usr/bin/env bb
(ns script
"Make a 'Code Quality' report from clj-kondo for use in GitLab CI.
JSON issue format:
https://docs.gitlab.com/ee/user/project/merge_requests/code_quality.html#implementing-a-custom-tool
Usage:
Add the following job in .gitlab-ci.yml:
@borkdude
borkdude / pod-bb-python-sqlite.py
Created May 5, 2020 15:01 — forked from lispyclouds/pod-bb-python-sqlite.py
A simple example for a SQLIte pod for Babashka
import json
import sqlite3
import sys
from bcoding import bencode, bdecode
def read():
return dict(bdecode(sys.stdin.buffer))
@borkdude
borkdude / http-socket-server.clj
Last active May 3, 2021 22:59 — forked from souenzzo/http-socket-server.clj
tiny http server via java sockets in babashka
#!/usr/bin/env bb
(import (java.net ServerSocket))
(require '[clojure.string :as string] '[clojure.java.io :as io])
(with-open [server-socket (new ServerSocket 8080)
client-socket (.accept server-socket)]
(loop []
(let [out (io/writer (.getOutputStream client-socket))
in (io/reader (.getInputStream client-socket))
@borkdude
borkdude / .gitattributes
Last active September 9, 2018 14:26 — forked from gfredericks/frobnicate.clj
Self-contained clojure file with deps
*.clj linguist-language=Clojure
*.cljs linguist-language=Clojure
@borkdude
borkdude / build.boot
Created November 25, 2017 12:01 — forked from yannvanhalewyn/build.boot
Boot node cljs repl
(set-env!
:target-path "target"
:source-paths #{"src"}
:dependencies '[[org.clojure/clojure "1.9.0-RC1"]
[org.clojure/clojurescript "1.9.946"]
[figwheel-sidecar "0.5.14"]])
(require '[figwheel-sidecar.repl-api :as ra])
(deftask cljs-repl []