Skip to content

Instantly share code, notes, and snippets.

View hovsater's full-sized avatar
🤟

Kevin Hovsäter hovsater

🤟
View GitHub Profile
fold (\v l r -> Node v r l) Empty tree
~/code/dte (master) $ trap -l
1) SIGHUP 2) SIGINT 3) SIGQUIT 4) SIGILL 5) SIGTRAP
6) SIGABRT 7) SIGEMT 8) SIGFPE 9) SIGKILL 10) SIGBUS
11) SIGSEGV 12) SIGSYS 13) SIGPIPE 14) SIGALRM 15) SIGTERM
16) SIGURG 17) SIGSTOP 18) SIGTSTP 19) SIGCONT 20) SIGCHLD
21) SIGTTIN 22) SIGTTOU 23) SIGIO 24) SIGXCPU 25) SIGXFSZ
26) SIGVTALRM 27) SIGPROF 28) SIGWINCH 29) SIGINFO 30) SIGUSR1
31) SIGUSR2
FROM ubuntu:focal
ENV LANG en_US.UTF-8
RUN apt-get update && apt-get install -y locales && locale-gen en_US.UTF-8
type TokenType = 'ASSIGN' | 'NAME' | 'NUM' | 'OP';
type TokenLiteral = string;
type Token = [TokenType, TokenLiteral];
type Tokens = ReadonlyArray<Token>;
function assert<T extends Tokens>(actual: T, expected: T): void | never {
const stringActual = JSON.stringify(actual);
const stringExpected = JSON.stringify(expected);
if (stringActual !== stringExpected) {
#!/usr/bin/env bash
set -e
if [[ $# -lt 2 ]]; then
>&2 echo "usage: dte-replace <search> <replacement> [rg_args]"
exit 1
fi
rg "$1" --files-with-matches ${@:3} | xargs -n1 dte -c 'replace -c '$1' '$2'; save; quit'
#!/usr/bin/env bash
function m() {
local marks="$HOME/.config/m/marks"
local version="0.0.1"
# Create "$HOME/.config/m/marks" if it doesn't exist.
if ! [[ -f "$marks" ]]; then
mkdir -p "$(dirname "$marks")"
touch "$marks"
{
"background": "#101010",
"colors": {
"activityBar.activeBorder": "#101010",
"activityBar.background": "#101010",
"activityBar.border": "#191919",
"activityBar.foreground": "#b4b4b4",
"activityBar.inactiveForeground": "#444444",
"activityBarBadge.background": "#626262",
"badge.background": "#262626",
@hovsater
hovsater / Day05.elm
Last active February 23, 2022 18:45
Solution to Advent of Code 2015 - Day 5 (https://adventofcode.com/2015/day/5)
module Day05 exposing (main)
import Html exposing (Html, div, strong, text)
import Set exposing (Set)
partOne : Html ()
partOne =
div []
[ strong [] [ text "Part 1: " ]
@hovsater
hovsater / Day04.elm
Last active February 21, 2022 14:37
Solution to Advent of Code - Day 4 (https://adventofcode.com/2015/day/4)
module Day04 exposing (main)
import Html exposing (Html, div, strong, text)
import MD5
partOne : Html ()
partOne =
div []
[ strong [] [ text "Part 1: " ]
@hovsater
hovsater / Day03.elm
Last active February 21, 2022 14:36
Solution to Advent of Code 2015 - Day 3 (https://adventofcode.com/2015/day/3)
module Day03 exposing (main)
import Dict exposing (Dict)
import Html exposing (Html, div, strong, text)
partOne : Html ()
partOne =
div []
[ strong [] [ text "Part 1: " ]