Skip to content

Instantly share code, notes, and snippets.

View theneubeck's full-sized avatar

Jens Carlén theneubeck

View GitHub Profile
@theneubeck
theneubeck / wait-and-kill-subprocesses.sh
Created December 13, 2018 18:01
wait-and-kill-subprocesses (on ctrl+c)
#!/usr/bin/env bash
echo "Hej"
function cleanup {
kill $pid1
kill $pid2
exit
}
trap cleanup SIGHUP SIGINT SIGTERM
@theneubeck
theneubeck / pp-sek.js
Last active January 6, 2020 21:59
Pretty Print SEK
"use strict";
function pn(number) {
const str = number.toString();
const chunks = ["SEK"];
for (let i = 0; i < str.length; i += 3) {
chunks.unshift(str.substring(str.length - i - 3, str.length - i));
}
return chunks.join(" ");