Skip to content

Instantly share code, notes, and snippets.

View werdl's full-sized avatar
💭
$~>

werdl werdl

💭
$~>
View GitHub Profile
@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)
@werdl
werdl / 99bottles.c
Last active April 22, 2023 16:33
99 bottles of beer full version- in 206 characters of C89
#define z(a)a==1?" bottle":" bottles"
x;char*b=" of beer";main(){x=100;while(x-->1){char*c=z(x);printf("%d%s%s %d%s%s, take one down pass it around,%d%s%s on the wall ",x,c,b,x,c,b,(x==1)?0:x-1,z(x-1),b);}}
@werdl
werdl / wordle.py
Last active February 17, 2023 08:44
Wordle Clone In Python
import sys,random
words = [
"aback",
"abase",
"abate",
"abbey",
"abbot",
"abhor",
"abide",
"abled",
@werdl
werdl / hmm
Created January 21, 2023 17:20
find the word encoded in this file
d„0