Skip to content

Instantly share code, notes, and snippets.

View werdl's full-sized avatar
🐧
i use arch btw

werdl werdl

🐧
i use arch btw
View GitHub Profile
@werdl
werdl / filegame.py
Created April 4, 2025 19:32
Guess a file type based on a random snippet of its hex (required xxd)
#!/usr/bin/env python3
import os
import random
import subprocess
import sys
def prompt_file():
directory = sys.argv[1] if len(sys.argv) > 1 else os.getcwd()
@werdl
werdl / instructions.md
Created March 16, 2025 10:20
Install Arch Linux ARM on Raspberry Pi 3

install arch linux on RPi 3

fdisk

  • plug in your SD card
  • replace sdX with the device name (find with lsblk)

fdisk /dev/sdX

  • o - clear out old partitions and create new MBR
  • p - none should be left
  • n, p, 1, ENTER, +500M - create a new primary boot parition, starting at the start of the disk with size 500MB/
  • t, c - set type to W95 FAT32
  • n, p, 2, ENTER x2 - create a new primary partition for data, taking up all remaining space
@werdl
werdl / ytdlpwrapper.py
Last active February 9, 2025 10:10
yt-dlp GUI (eg. where command line inaccesible/inconvenient) Dependencies: yt-dlp, tkinter
import yt_dlp
import tkinter as tk
from tkinter import scrolledtext
import threading
import json
def load_preferences():
try:
with open('preferences.json', 'r') as f:
return json.load(f)
@werdl
werdl / base.c
Last active April 6, 2024 08:13
Base converter, golfed for source size and binary size (only works with tcc)
#define z int
char*d="0123456789abcdefghijklmnopqrstuvwxyz";b(z a,char*n){if(a==16&n[0]=='0'&n[1]=='x'){n+=2;}if(a==2&n[0]=='0'&n[1]=='b'){n+=2;}z r=0;for(z i=0;n[i]!='\0';i++){z c=n[i];z g=0;for(z j=0;d[j]!='\0';j++){if(d[j]==c){g=j;break;}}r=r*a+g;}return r;}char*v(z s,z u){z p=1;z m=u;while(m>=s){m/=s;p*=s;}char e[100];z i;while(p>0){z t=u/p;e[i]=d[t];i++;u-=t*p;p/=s;}e[i]='\0';return e;}main(z c,char**r){z a=b(10,r[2]);char*n=r[1];if(c>3){printf("%s\n",v(a,b(10,n)));}else{printf("%d\n",b(a, n));}}

Keybase proof

I hereby claim:

  • I am werdl on github.
  • I am werdl (https://keybase.io/werdl) on keybase.
  • I have a public key whose fingerprint is 3824 86A5 F021 9819 184B 3755 AD49 721B 79A3 C32E

To claim this, I am signing this object:

if (window.location.includes("kes.net") {
window.location.replace("teams.microsoft.com")
}
@werdl
werdl / vup.sh
Created November 20, 2023 13:37
Install V
git clone https://github.com/vlang/v
cd v
make
sudo ./v symlink
@werdl
werdl / 5
Last active November 1, 2023 15:08
Wordle clone (308 chars)
aback
abase
abate
abaya
abbey
abbot
abets
abhor
abide
@werdl
werdl / photofit.py
Last active May 17, 2023 13:55
Photofit
dalle_ok=True
try:
import shutil
import openai
import requests
from PIL import Image
except ImportError:
dalle_ok=False
print("Switching to Python Turtle mode")
import turtle
@werdl
werdl / 99bottles.py
Created April 21, 2023 13:19
99 bottles song - 208 characters of Python 3.x
b="of beer"
t=", take one down, pass it around,"
p="bottles "+b
o=p[0:6]
l="on the wall"
x=99
k=print
while(x>2):
x-=1;k(x,p+",",x,p+",",x,p+t)
if x>2: k(x-1,p,l)