Skip to content

Instantly share code, notes, and snippets.

@katef
katef / cloud.vcl
Last active May 14, 2022 19:50
HTTP Moomin delivery
sub cloud_moomin {
set resp.http.moomin00 = " %1b[38;5;237m▄%1b[38;5;235m▄%1b[49m";
set resp.http.moomin01 = " %1b[38;5;237m▄%1b[48;5;237m%1b[38;5;249m▄%1b[38;5;236m▄%1b[49m %1b[48;5;239m%1b[38;5;16m▄%1b[48;5;237m%1b[38;5;253m▄%1b[38;5;247m▄%1b[48;5;234m%1b[38;5;16m▄%1b[49m";
set resp.http.moomin02 = " %1b[38;5;233m▄%1b[48;5;253m%1b[38;5;237m▄%1b[48;5;254m%1b[38;5;255m▄%1b[38;5;251m▄%1b[38;5;239m%1b[49m▄ %1b[38;5;237m▄ %1b[48;5;254m%1b[38;5;248m▄%1b[48;5;249m%1b[38;5;254m▄%1b[48;5;235m%1b[38;5;246m▄%1b[49m";
set resp.http.moomin03 = " %1b[38;5;235m▄%1b[48;5;250m%1b[38;5;242m▄%1b[48;5;231m %1b[48;5;247m%1b[38;5;231m▄%1b[48;5;252m▄%1b[48;5;253m▄%1b[48;5;254m▄%1b[48;5;253m▄%1b[48;5;249m▄%1b[48;5;188m▄%1b[48;5;245m%1b[38;5;251m▄%1b[49m";
set resp.http.moomin04 = "
@katef
katef / life-utf8.c
Last active August 4, 2023 01:55
XBM to UTF-8 braille image things
/*
* John Conway's Game of Life.
*
* This is written for POSIX, using Curses. Resizing of the terminal is not
* supported.
*
* By convention in this program, x is the horizontal coordinate and y is
* vertical. There correspond to the width and height respectively.
* The current generation number is illustrated when show_generation is set.
*
#!/usr/bin/awk -f
# This program is a copy of guff, a plot device. https://github.com/silentbicycle/guff
# My copy here is written in awk instead of C, has no compelling benefit.
# Public domain. @thingskatedid
# Run as awk -v x=xyz ... or env variables for stuff?
# Assumptions: the data is evenly spaced along the x-axis
# TODO: moving average
@katef
katef / hist.awk
Last active October 23, 2020 10:10
#!/usr/bin/awk -f
function strrep(n, c) {
s = ""
for (i = 0; i < n; i++) {
s = c s
}
return s
#!/usr/bin/awk -f
function line(x1, y1, x2, y2) {
printf(" <line x1='%d' y1='%d' x2='%d' y2='%d'/>\n",
x1, y1 + rand() * 5, x2, y2 + rand() * 10)
}
function path(d) {
printf(" <path d='%s'/>\n", d)
}
@katef
katef / !knightmare.dot
Last active August 19, 2020 19:06
The Knightmare Challenge (Choose your own adventure), in Graphviz
/*
* The Knightmare Challenge (Choose your own adventure)
* ISBN 0-552-52540-5
*
* Transcribed to graphviz by Kate. I had originally used record
* nodes with ports describing each choice, but the result was
* illegible. What a way to spend an evening.
*/
digraph Knightmare {
@katef
katef / hattifatteners.awk
Created October 23, 2020 22:48
hattifatteners.awk
#!/usr/bin/awk -f
function hoop(h, w) {
printf("l 0 %d ", -h);
printf("c 0 -%u, %u -%u, %u 0 ", w, w, w, w);
printf("l 0 %d", +h);
}
function hand(x, h, o, l) {
printf("<g transform='translate(%d.5 %d)'>\n", x, h);
@katef
katef / blctl.sh
Created January 18, 2021 05:45
backlight control
#!/bin/bash -e
path=/sys/class/backlight/intel_backlight
factor=10
usage() {
echo "usage: ${0##*/} [-l label] [-f path] {up|down|raise|lower} [n]" >&2
echo " ${0##*/} [-l label] [-f path] set <n>" >&2
echo " ${0##*/} [-l label] [-f path] get" >&2
exit 1
@katef
katef / a.c
Created March 8, 2022 23:01
aaaaaaaaaaaaaaaaaaaaaaaaa
#define a <%
#define aa %>
#define aaa int
#define aaaa char
#define aaaaa "\n"
#define aaaaaa printf
#define aaaaaaa return
#define aaaaaaaa ;
#define aaaaaaaaa main
#define aaaaaaaaaa (