Skip to content

Instantly share code, notes, and snippets.

View Celti's full-sized avatar

Pat Burroughs Celti

View GitHub Profile
@Celti
Celti / dice.rs
Last active April 16, 2020 13:57
Partial implementation of the Roll20 grammar in Rust-PEG
use rand::distributions::{Distribution, Uniform};
peg::parser!( grammar roller() for str {
pub rule expr() -> Atom
= l:term() op:$(['+'|'-']) r:term() {
match op {
"+" => l + r,
"-" => l - r,
_ => unreachable!(),
}

There was once a factory that specialised in armour. They made leather jerkins, full plate suits, greaves, helmets, anything that would stop an arrow or a sword.

One day, an order arrived from a foreign kingdom. It was a big contract, to outfit an entire army with chain-mail leggings. The factory owner was delighted, and immediately took the design specifications down to the factory floor to begin production.

Several days later, a second message arrived. Due to various circumstances, the design of the leggings had changed. The new standardised national military uniform required that the hems be lowered by several centimetres.

The factory owner grumbled about the loss of time and money involved in changing the design, but there was nothing he could do. He took the new plans down to the foreman.

Several days later, another new design arrived. The nation's uniform requirements had changed again, and the hems must be raised, even higher than the original design.

@Celti
Celti / hr
Last active August 31, 2021 20:11
the worst hr script ever
#!/bin/awk -f
BEGIN {
"tput cols" | getline cols;
length(ARGV[1]) == 0 ? s = "▄" : s = ARGV[1];
for (colnum = 0; colnum<cols; colnum++) {
r = 255-(colnum*255/cols);
g = (colnum*510/cols);
b = (colnum*255/cols);
if (g>255) g = 510-g;
printf "\033[48;2;%d;%d;%dm", r,g,b;

“It's definitely refined metal, probably steel, probably a spaceship,” reported the computer. “There are no EM emissions, and it's dead cold, so it has to be abandoned.”

“I.e., salvage,” said the captain.

“…i.e., salvage,” confirmed the computer. “But…”

“‘But’?” asked the captain, as she carefully brought the ship down from cruising velocity.

@Celti
Celti / keybase.md
Last active February 4, 2018 12:06

Keybase proof

I hereby claim:

  • I am celti on github.
  • I am celti (https://keybase.io/celti) on keybase.
  • I have a public key ASDWLSWphZafq1faozXETQcLwr8vOb0oVaVaWXlfmv5R-wo

To claim this, I am signing this object: