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
type SingleArgFunc = (arg: any) => any; | |
type Pipe<T extends SingleArgFunc[], M = T> = M extends [ | |
infer F extends SingleArgFunc, | |
infer S extends SingleArgFunc, | |
...infer Rest extends SingleArgFunc[], | |
] | |
? Awaited<ReturnType<F>> extends Parameters<S>[0] | |
? Pipe<T, [S, ...Rest]> | |
: never |
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
/* | |
* Copyright (c) 2025. Casper Küthe | |
* All rights reserved. | |
*/ | |
import java.util.*; | |
import java.util.function.Consumer; | |
import java.util.stream.Collectors; | |
import java.util.stream.Stream; | |
import java.util.stream.StreamSupport; |
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 | |
theme=$1 | |
if [ -Z $theme ]; then | |
current_theme=$(gsettings get org.cinnamon.desktop.interface gtk-theme) | |
if [[ "$current_theme" == "'Mint-Y-Dark'" ]]; then | |
theme="light" | |
else |
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
// Use dynamic React tags, kinda like Styled Components. | |
// e.g. <CustomTag.H1 === <h1> | |
import React from 'react' | |
// All JSX defined html elements | |
type Tag = keyof React.JSX.IntrinsicElements | |
// Convert tags longer than a length of 1 to its Capitalized version for fun | |
type ReactifyTag<T extends Tag> = T extends `${string}${infer Rest}` | |
? Rest extends '' |
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
module main | |
import vweb | |
import db.pg | |
struct App { | |
vweb.Context | |
vweb.Controller | |
db_handle vweb.DatabasePool[pg.DB] | |
mut: |
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
// Made by Casper Küthe | |
module vaunt | |
import db.pg | |
import json | |
// Why do I use this reflection? | |
// Well, in the frontend editor i need to have the option type available for | |
// rendering the options. Plus now each options is stored as single row in the | |
// database. No need to pass the whole json theme to the api only 1 update. |
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
; This program simulates the text-based version of tictactoe in assembly | |
; | |
; compile with: nasm -f elf tictactoe.asm -o out.o | |
; and: ld -m elf_i386 -s -o out out.o | |
; run with ./out | |
; | |
; Made by Casper Kuethe 2023 | |
; | |
; some constants |
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
""" | |
© Casper Kuethe 2022 | |
htmlparser.py | |
This script parses a html page and can format it | |
usage: | |
> python htmlparser.py [file] | |
this writes the formatted html file at the path ./out.html | |
""" |
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 cv2 | |
import glob | |
import os | |
import re | |
from datetime import datetime | |
""" | |
Script that turns the images in the input folder into a video. | |
The frames must be placed inside "path/{input_folder}/frames/*". | |
The video will be saved in "./animation.mp4". |
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 https from 'https' | |
export interface GetOptions { | |
data: (chunk: any) => void; | |
end: (data: any) => void; | |
error: (err: Error) => void; | |
} | |
export async function get(url: string, options: Partial<GetOptions> = {}): Promise<any> { | |
const p = new Promise((resolve, reject) => { |