Skip to content

Instantly share code, notes, and snippets.

View geekosaur's full-sized avatar

brandon s allbery kf8nh geekosaur

View GitHub Profile
commands to create histogram data set:
perl6 -e '.put for (^0x10ffff).map(&uniname)' | sort -u | sed '/^</s/ /_/g' | tr ' ' '\n' | sort | uniq -c | sort -k1nr,1 > hist.ucs
awk -F\; '$0 != "" && !/^#/ {print $2}' NameAliases.txt | tr ' ' '\n' | sort | uniq -c | grep -v '/^$/' | sort -k1nr,1 > hist.alias
awk '{w[$2] += $1} END {for (s in w) {print w[s] "\t" s}}' hist.alias hist.ucs | sort -k1nr,1 >hist.all
command to compute packing:
awk '{t += $1} n < 183 && $2 !~ /^.$/ {c += $1; n++} $1 == 1 {s++} $2 ~ /^.$/ {u += $1} END {print "tot", t, "cpr", c, "sing", s, "chr", u}' hist.all
output:
tot 120240 cpr 72165 sing 9571 chr 4133
@geekosaur
geekosaur / xmonad.hs
Created December 16, 2017 04:11
Gratin xmonad.hs
import XMonad
import qualified XMonad.StackSet as W
import XMonad.Util.EZConfig
import XMonad.Hooks.SetWMName
import Data.Bits ((.|.))
import System.Exit (exitSuccess)
main = xmonad $ defaultConfig {
terminal = "xfce4-terminal",
modMask = mod4Mask,
import XMonad
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.ManageDocks
import XMonad.Util.Run(spawnPipe)
import System.IO
main = do
xmproc <- spawnPipe "xmobar"
xmonad $ docks defaultConfig
{logHook = dynamicLogWithPP $ xmobarPP
scratchpads :: NamedScratchpads
scratchpads = [ NS "scratchpad" scratchpad (role =? "scratchpad") nonFloating
, NS "volume" "pavucontrol" (className =? "Pavucontrol") nonFloating
]
where
scratchpad = "urxvt -r scratchpad"
tile_full_screen = true
show_player_species = true
# See options_guide.txt for the options
# cset, feature, mon_glyph, item_glyph
display_char += explosion : x263c
display_char += cloud : x2637
# @@@ use feature to customize per god?
display_char += altar : x1030e
display_char += fired_zap : x26a1
mylayoutHook = avoidStruts $
layoutHook defaultConfig |||
Accordion |||
Grid |||
simpleTabbed |||
Circle |||
spiral (6/7) |||
ThreeCol 1 (3/100) (1/2) |||
ThreeColMid 1 (3/100) (1/2) |||
(...)
@geekosaur
geekosaur / lc.txt
Created January 20, 2019 20:35
lambda calculus example - DukeDrake
(\g.\f.\x. g f (f x)) (\f.\x. x)
(\g. \f0. \x0. g f0 (f0 x0)) (\f1. \x1. x1) -- alpha rename to avoid collisions
\f0. \x0. (\f1. \x1. x1) f0 (f0 x0) -- apply parameter for g
g = (\f1. \x1. x1)
\f0. \x0. f0 x0 -- apply parameters to inner lambda and reduce
f1 = f0
x1 = f0 x0
, ((0 .|. modMask, xK_question), windows $ W.greedyView "1")
, ((shiftMask .|. modMask, xK_question), windows $ W.shift "1")
@geekosaur
geekosaur / dcss-er?
Created August 4, 2019 19:56
I thought this wasn't supposed to be possible
This is Dungeon Crawl Stone Soup 0.24-a0-528-g98e85ec62a
Game seed: 14789942687155141024
Welcome, zvx the Gargoyle Fighter.
The bosom of this dungeon contains the fabled artefact, the Orb of Zot.
Press ? for a list of commands and other information.
Found a scroll labeled NUQ SEBLE and a robe.
Found a staircase leading out of the dungeon.
A jackal and a giant cockroach come into view.
There is a staircase leading out of the dungeon here.
import System.IO
import XMonad
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.ManageDocks
import XMonad.Util.Run (spawnPipe)
import XMonad.Util.EZConfig (additionalKeys)
main = do
xmproc <- spawnPipe "xmobar"
xmonad $ docks