This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# lto_backup.sh — tiny, cautious LTO-6 backup helper | |
# - Assumes LTO-6 native capacity (~2.5 TB, decimal bytes). | |
# - Prompts before each step; requires exact "OK". | |
# - Starts writing from BOT; proceeding will overwrite existing data. | |
# - Uses /dev/nst0 (no-rewind); rewinds explicitly only when needed. | |
set -Eeuo pipefail | |
# -------- run-in-screen reminder (non-blocking) -------- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Network;main=withSocketsDo$listenOn(PortNumber 70)>>=forever.fst.accept>=>\h->hGetLine h>>=readFile>>=hPutStr h>>hClose h |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# PLEASE READ ME BEFORE RUNNING! | |
# ------------------------------ | |
# | |
# giamp3 v1 (2024-10-04) | |
# | |
# Random 30 second samples from Internet Archive. | |
# | |
# Tested on Debian Unstable (Sid) as of the release date. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Data.Data (Data, gmapQ, toConstr, cast) | |
import Data.Maybe (catMaybes) | |
import Data.Data (constrFields) | |
import qualified Data.Text as Text | |
{- | Convert any generic data type with record syntax to a list | |
of key-value `Text` pairs. | |
Uses some Haskell magic. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE ScopedTypeVariables #-} | |
{-# LANGUAGE TupleSections #-} | |
{- | |
Double Cola | |
https://codeforces.com/problemset/problem/82/A | |
EFFICIENCY REQUIREMENTS | |
time limit per test: 1 second | |
memory limit per test: 256 megabytes |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{- | |
My attempt at a Tesla interview question: | |
Minimum number of characters to delete from a string so that each character | |
appears unique number of times. Note: You can delete all occurances of | |
characters. | |
eg: "aaaabbbb" -> 1 "a" or 1"b" would make "a" and "b" appear unique number of | |
times. | |
-} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{- | |
Advent of Code: Day 1 | |
Part 1 and 2 | |
https://adventofcode.com/2020/day/1 | |
-} | |
-- Converted using a simple find/replace vim command. | |
puzzleInput = | |
[ 1780 | |
, 1693 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{- | |
Advent of Code: Day 2 | |
Part 1 & 2 | |
https://adventofcode.com/2020/day/2 | |
-} | |
type PasswordData = ((Int, Int, Char), String) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Control.Monad.Reader | |
import Data.Map as Map | |
data Expr = Lit Int | Var String | Add Expr Expr | Let (String, Expr) Expr | |
eval :: Expr -> Reader (Map String Int) Int | |
eval (Lit i) = pure i | |
eval (Var s) = do | |
varMap <- ask | |
case Map.lookup s varMap of |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{- | |
I saw this posted on HackerNews: | |
"Most candidates cannot solve this interview problem." | |
https://twitter.com/Al_Grigor/status/1357028887209902088 | |
> Most candidates cannot solve this interview problem: | |
> Input: "aaaabbbcca" | |
> Output: [("a", 4), ("b", 3), ("c", 2), ("a", 1)] |
NewerOlder