Skip to content

Instantly share code, notes, and snippets.

@robbieh
robbieh / gist:4171210
Created November 29, 2012 19:15
How do you read this?
(reduce (fn [accum x]
(assoc accum
(keyword x)
(str x \- (rand-int 100))))
{}
["hi" "hello" "bye"])
@robbieh
robbieh / sv.bash
Created November 12, 2017 22:18 — forked from WoodenDoors/sv.bash
/etc/bash_completion.d/sv
_runit_sv() {
local cur prev commands opts services
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
commands="status up down once \
pause cont hup alarm interrupt quit 1 2 term kill exit \
start stop reload restart shutdown \
(def f (new Frame "AWT test"))
(. f setSize 400 400)
(. f setLayout (new GridLayout 3 1))
(class f) ;;java.awt.Frame
(supers (class f));; #{java.awt.Container java.io.Serializable java.awt.Window java.awt.image.ImageObserver java.awt.Component java.awt.MenuContainer java.lang.Object javax.accessibility.Accessible}
(r/reflect (.getAccessibleContext f) )
(def acc (AWTAccessor/getComponentAccessor))
@robbieh
robbieh / babel-distance.clj
Last active December 24, 2022 16:23
Manhattan distance like walk, but across a hex grid
;Named "Babel distance" after the Borges story "The Library of Babel"
(def bearings
{:E [120 240 0 360
:NE [60 180 300]
:NW [120 240 0 360
:W [60 180 300]
:SW [120 240 0 360
:SE [60 180 300]})
@robbieh
robbieh / bash_banner.sh
Created October 11, 2024 21:08
bash banner
#!/bin/bash
#
# An easily-extensible "login banner". Put it in your $PATH and call it from your .bashrc.
# Mainly it shows tmux sessions.
# A "full" view with decorations is given on first run. After that a compact view is
# printed. After an hour has passed the next new terminal will give the full view agian.
columns=$( tput cols )
color1='\033[38;5;036m'
color2='\033[38;5;046m'