This file contains 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
async function typedFetch<T>(): Promise<T> { | |
let res = await fetch("http://ip.jsontest.com/"); | |
let json = res.json(); | |
return json; // actually Promise<any> | |
} | |
type Ip = { ip: String }; | |
(async function () { | |
let ip = await typedFetch<Ip>(); |
This file contains 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
{ | |
description = "minimal nix flake with a default package"; | |
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; | |
outputs = { self, nixpkgs }: { | |
# packages.x86_64-linux.default = | |
# with nixpkgs.legacyPackages.x86_64-linux; | |
packages.aarch64-darwin.default = |
This file contains 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
(async function () { | |
var webHookUrl = "https://hooks.slack.com/triggers/a/b/c"; | |
// credits chatgpt | |
function isoWeek(date) { | |
// copy date so don't modify original | |
date = new Date(date); | |
// set to nearest thursday (current date + 4 - current day) % 7 | |
date.setUTCDate(date.getUTCDate() + 4 - (date.getUTCDay() || 7)); |
This file contains 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 java.lang.reflect.InvocationHandler; | |
import java.lang.reflect.Method; | |
import java.lang.reflect.Proxy; | |
class DynamicInvocationHandler implements InvocationHandler { | |
@Override | |
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { | |
return 42; | |
} |
This file contains 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
# one: string | |
#INSERT INTO `torgeirtester.schema_one` values ("one"); | |
# one: string, two: number | |
#INSERT INTO `torgeirtester.schema_two` values ("one", 2); | |
# three: boolean | |
#INSERT INTO `torgeirtester.schema_three` values (true); | |
SELECT * FROM `torgeirtester.schema_*`; |
This file contains 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
tar xvfz Tomb-2.9.tar.gz | |
cd Tomb-2.9 | |
sudo make install | |
# 300MB disk | |
tomb dig -s 300 locked.tomb | |
tomb forge locked.tomb.key | |
This file contains 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
(ns pico) | |
;; basic-mod1 | |
;; | |
(def data [91 322 57 124 40 406 272 147 239 285 353 272 77 110 296 262 299 323 255 337 150 102]) | |
(def alph | |
"0-25 is the alphabet (uppercase), 26-35 are the decimal digits, and 36 is an underscore." |
This file contains 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
# https://wiki.archlinux.org/title/Securely_wipe_disk | |
❯ sudo shred --verbose --random-source=/dev/urandom -n1 --zero /dev/sdX | |
shred: /dev/sdb: pass 1/2 (random)... | |
shred: /dev/sdb: pass 1/2 (random)...134MiB/932GiB 0% | |
shred: /dev/sdb: pass 1/2 (random)...319MiB/932GiB 0% | |
shred: /dev/sdb: pass 1/2 (random)...503MiB/932GiB 0% |
This file contains 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
cd | |
git clone [email protected]:Frogging-Family/wine-tkg-git.git Code/wine-tkg-git | |
pushd Code/wine-tkg-git/wine-tkg-git | |
git checkout master | |
# vim customizations.cfg: _staging_version="v7.15", _use_fsync="true" | |
# why tho? | |
rm -rf wine-tkg-patches/hotfixes/mfplat | |
# select 0, the customizations has settings for fsync |
This file contains 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 java.util.* | |
import java.lang.Integer.parseInt | |
typealias Coord = Pair<Int, Int> | |
fun Coord.x() = first | |
fun Coord.y() = second | |
typealias Move = Pair<Direction, Coord> |
NewerOlder