Skip to content

Instantly share code, notes, and snippets.

java -cp clojure.jar clojure.lang.Repl
(for i in {1900..2100}; do ncal -o $i; done) | awk -e '{ if ($1 == 13) print $0 }'
@tail-call
tail-call / cal-hl.sh
Created February 13, 2016 05:40
Unix: highlight current date with parentheses
#!/bin/sh
cal -h | \
sed -e "s/^/ /;s/ \($(date +%_2d)\) /(\1)/"
(print (apply + (map char->integer (string->list "HOLYBIBLE"))))
(define ((make-counter i))
(set! i (+ i 1))
i)
(define a (make-counter 0))
(dotimes (_ 8) ; Imagine there is dotimes in Scheme.
; I mean, like if it was impossible to have it...
(print (a)))
@tail-call
tail-call / getwall.sh
Created August 1, 2016 13:24
Pony wallpapers!
#!/bin/sh
curl "https://derpibooru.org/tags/wallpaper/random_img.json?filter_id=56027" |
sed -e 's/{"id":"\([0-9]*\)"}/https:\/\/derpibooru.org\/\1.json\n/g' |
xargs curl |
# -P switch for Perl syntax (.*? - non-greedy match)
grep -o -P '"image":".*?"' |
sed -e 's/"image":"\(.*\)"/https:\1/' |
xargs feh --bg-fill
@tail-call
tail-call / colors-russian.json
Created August 7, 2017 06:25
Названия цветов на русском языке
[
["#000000", "Черный"],
["#000080", "Темно-синий (Цвет формы морских офицеров)"],
["#00008B", "Темный ультрамариновый"],
["#0000FF", "Синий"],
["#001D18", "Очень темный синевато-зеленый"],
["#002137", "Темно-синий"],
["#002800", "Очень глубокий желто-зеленый"],
["#002F55", "Глубокий синий"],
["#003153", "Берлинская лазурь"],
// A hard way to print "boombastic"
var cat = child_process.spawn("cat");
cat.stdin.write("boombastic");
console.log(cat.stdout.read().utf8Slice())
@tail-call
tail-call / object-stream-example.js
Created August 13, 2017 09:50
Object stream example
// Number stream example
"use strict"
const stream = require("stream")
let numberStream = new class extends stream.Readable {
constructor () {
// This is an object stream
super({ objectMode: true })
this.counter = 0
@tail-call
tail-call / somebody.txt
Created September 25, 2017 15:11
cat -vT somebody.txt | sed -e 's/\^//g'