Skip to content

Instantly share code, notes, and snippets.

@WoLfulus
WoLfulus / switch.ts
Created February 22, 2023 21:54
"Switch Case" for TypeScript Types
// PoC, has problems with type matching in case array
type Case<V extends boolean = any, T = any> = [V, T];
type Switch<T extends readonly any[], Fallback = never> =
T extends [infer Head, ...infer Rest] ? [Head] extends [[true, infer V]] ? V :
Switch<Rest> : Fallback;
type Default<V> = [true, V];
@WoLfulus
WoLfulus / pages-index.tsx
Last active February 17, 2023 00:47
Strongly typed Next.js routes and SWR
// pages/index.tsx
import { preload } from "@routes/server";
import People from "../lib/loaders/people";
export default Index({ defaultCount }) {
const [count, setCount] = useState(defaultCount);
return (
<>
@WoLfulus
WoLfulus / Bridge.cs
Last active May 18, 2022 01:55
Bridge
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using UnityEngine;
using Vuplex.WebView;
namespace UI.Interop
{
@WoLfulus
WoLfulus / watch.js
Created June 13, 2021 06:45
Watch and restart executables
const fs = require('fs');
const path = require('path');
const yargs = require('yargs');
const short = require('short-uuid')();
const chokidar = require("chokidar");
const log = require('pino')({
prettyPrint: true,
});
const args = yargs.argv;
@WoLfulus
WoLfulus / pi4-setup.md
Last active May 6, 2023 19:33
Raspberry Pi 4 Setup

bootstrap

  • burn raspbian image to sdcard
  • remove and insert sdcard
    • touch /boot/ssd
  • repeat for all sdcards

network pin (optional)

  • grab both (eth and wlan) mac addresses from your raspberries

Keybase proof

I hereby claim:

  • I am wolfulus on github.
  • I am wolfulus (https://keybase.io/wolfulus) on keybase.
  • I have a public key ASB1zvRiOcZj2_jTH6MZrtol22m9ZfcDSQxT5hRLH3U36Qo

To claim this, I am signing this object: