Skip to content

Instantly share code, notes, and snippets.

View borkdude's full-sized avatar

Michiel Borkent borkdude

View GitHub Profile
@borkdude
borkdude / find-unused-clj.sh
Created September 22, 2017 17:44 — forked from joelittlejohn/find-unused-clj.sh
Very quick and dirty command to find unused functions and vars in a Clojure project
#!/bin/bash
for f in $(egrep -o -R "defn?-? [^ ]*" * --include '*.clj' | cut -d \ -f 2 | sort | uniq); do
echo $f $(grep -R --include '*.clj' -- "$f" * | wc -l);
done | grep " 1$"
@borkdude
borkdude / README.md
Last active November 9, 2017 21:53 — forked from couchand/README.md
Link nodes to avoid node/link overlap

This gist demonstrates the inserting of link nodes to avoid node/link overlap.



This simple force-directed graph shows character co-occurence in *Les Misérables*. A physical simulation of charged particles and springs places related characters in closer proximity, while unrelated characters are farther apart. Layout algorithm inspired by [Tim Dwyer](http://www.csse.monash.edu.au/~tdwyer/) and [Thomas Jakobsen](http://web.archive.org/web/20080410171619/http://www.teknikus.dk/tj/gdc2001.htm). Data based on character coappearence in Victor Hugo's *Les Misérables*, compiled by [Donald Knuth](http://www-cs-faculty.stanford.edu/~uno/sgb.html).
@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 []
@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 / 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 / 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 / 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 / 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 / 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 / gallery.cljs
Last active March 30, 2024 17:36 — forked from yogthos/gallery.cljs
script to download walpapers from windowsonearth.org, adapted for nbb