Skip to content

Instantly share code, notes, and snippets.

View runejuhl's full-sized avatar
💻
[runejuhl is typing]

Rune Juhl Jacobsen runejuhl

💻
[runejuhl is typing]
View GitHub Profile
@runejuhl
runejuhl / scoring.clj
Created October 15, 2021 09:28
scoring and summation
(defn scoring
[[s1 s2]]
(cond
(= s1 s2) [1 1]
(zero? s1) [3 0]
(pos? s1) [3 1]
:else [0 0]))
(def sum-points
(partial reduce (partial merge-with +)))
function test() {
$a = notify { "hi it's me": }
{asd => 42,}
}
$b = test()
# Error: Could not parse for environment production: Expression is not valid as a resource, resource-default, or resource-override (file: /tmp/function_bug.pp, line: 2, column: 8) on node managua.lan
@runejuhl
runejuhl / timetest.clj
Created February 20, 2020 10:53
Simple function benchmark comparison
(defn time*
[fs iterations]
(map-indexed
(fn [idx f]
(let [t (with-out-str
(time
(run! f (range iterations))))]
{:idx idx
:f f
:time t}))
[user]
name = Rune Juhl Jacobsen
email = runejuhl@petardo.dk
signingkey = 0ACCEE0203A154E7
[push]
default = simple
followTags = true
[advice]
detachedHead = false
[grep]
@runejuhl
runejuhl / demo.clj
Created September 11, 2018 15:58
Compile CLJS to JS from Clojure
(with-out-str
(let [ env (merge (cljs.analyzer/empty-env) '{:ns {:name some.ns}})]
(cljs.compiler/emit (cljs.analyzer/analyze env '(+ 1 2)))))
;; "((1) + (2));\n"
@runejuhl
runejuhl / notmuch-hello-unread.el
Created January 24, 2018 14:33
notmuch functions to show unread count in hello buffer
(defun notmuch-hello-insert-buttons (searches)
"Insert buttons for SEARCHES.
SEARCHES must be a list of plists each of which should contain at
least the properties :name NAME :query QUERY and :count COUNT,
where QUERY is the query to start when the button for the
corresponding entry is activated, and COUNT should be the number
of messages matching the query. Such a plist can be computed
with `notmuch-hello-query-counts'."
(let* ((widest (notmuch-hello-longest-label searches))
(defvar *default-groups*
;; index, name, optionally key binding
'((1 "www")
(2 "irc")
(3 "mail")
(4 "emacs")
(5 "enableit")
(6 "projects")
(7 "stuff")
(8 "repl")
;; -*-lisp-*-
;;
;; Here is a sample .stumpwmrc file
(in-package :stumpwm)
(set-prefix-key (kbd "C-t"))
;;; log to debug output
(redirect-all-output (data-dir-file "debug" "log"))
@runejuhl
runejuhl / push.bash
Created April 3, 2017 09:22
push extension for password-store
#!/bin/bash
set -o errexit
p=${PASSWORD_STORE_DIR:-~/.password-store}
for d in $(find -L $p -type d -name '.git' | xargs dirname); do
cd "$d"
( git fetch && git rebase )
git push
- Welcome keynote
https://fosdem.org/2017/schedule/event/keynotes_welcome/
- Puppet catalog diffs in TheForeman
https://fosdem.org/2017/schedule/event/puppet_catalog_diffs/
- Using graph databases in popular open source CMSs
https://fosdem.org/2017/schedule/event/graph_drupal_cms_neo4j/
- Jockeying the Jigsaw
https://fosdem.org/2017/schedule/event/jigsaw1/
- From 0 to 6 GHz in 30 minutes: Bootstrapping your SDR experience
https://fosdem.org/2017/schedule/event/introtosdr/