Skip to content

Instantly share code, notes, and snippets.

View wlinds's full-sized avatar
🍍

William Akilles Lindstedt wlinds

🍍
View GitHub Profile
@wlinds
wlinds / stylesheet.css
Created July 3, 2024 13:52
Boilerplate CSS - Light Mode
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Helvetica', sans-serif;
}
@wlinds
wlinds / timestamp.py
Created July 2, 2024 21:27
Easy timestamp creation
import os, keyboard, time, json, threading
def format(elapsed):
ms = int((elapsed * 1000) % 1000)
seconds = int(elapsed % 60)
minutes = int((elapsed // 60) % 60)
hours = int((elapsed // 3600) % 24)
return f"{hours:02}:{minutes:02}:{seconds:02}.{ms:03}"
def record():
@wlinds
wlinds / key_to_hz.md
Last active June 14, 2024 15:54
Key to Frequency Cheat Sheet
1 2 3 4 5 6 7 8 9 10
C 16.35 32.70 65.40 130.80 261.60 523.20 1046.40 2092.80 4185.60 8371.20
C# 17.32 34.64 69.28 138.56 277.12 554.24 1108.48 2216.96 4433.92 8867.84
D 18.35 36.70 73.40 146.80 293.60 587.20 1174.40 2348.80 4697.60 9395.20
D# 19.45 38.90 77.80 155.60 311.20 622.40 1244.80 2489.60 4979.20 9958.40
E 20.60 41.20 82.40 164.80 329.60 659.20 1318.40 2636.80 5273.60 10547.20
F 21.83 43.66 87.32 174.64 349.28 698.56 1397.12 2794.24 5588.48 11176.96
F# 23.12 46.24 92.48 184.96 369.92 739.84 1479.68 2959.36 5918.72 11837.44
G 24.50 49.00 98.00 196.00 392.00 784.00 1568.00 3136.00 6272.00 12544.00
@wlinds
wlinds / my_ftp.py
Created May 1, 2024 10:55
Super simple asynchronous FTP server with pyftpdlib
import os
from pyftpdlib.authorizers import DummyAuthorizer
from pyftpdlib.handlers import FTPHandler
from pyftpdlib.servers import FTPServer
USERNAME = "admin"
PASSWORD = "foobar"
PERMISSION = 'elradfmwMT'
@wlinds
wlinds / sample_rate_counter.py
Last active April 23, 2024 19:05
Get distributions of sample rates among WAV files
import os
import soundfile as sf # https://github.com/bastibe/python-soundfile
def get_wav_sample_rate(file_path):
try:
with sf.SoundFile(file_path) as wav_file:
return wav_file.samplerate
except: print(f"Error processing file: {file_path}")
def count_sample_rates_in_dir(root_dir):
@wlinds
wlinds / gd.py
Last active April 15, 2024 17:09
Batch Gradient Descent example with synthetic data
import numpy as np
from sklearn.model_selection import train_test_split
import matplotlib.pyplot as plt
np.random.seed(42)
samples = 1000
X = 2 * np.random.rand(samples,1) # Features with uniform distribution
epsilon = np.random.normal(0,1, size=(samples,1)) # Random disturbance
y = 2 + 9 * X + epsilon # Simple linear regression model
@wlinds
wlinds / find_soundcloud_names.py
Created March 18, 2024 21:51
Find available Soundcloud names
import os, requests, time, csv
from bs4 import BeautifulSoup
delay_seconds = 0.2
url_to_check = "https://soundcloud.com"
error_title_to_check = "Something went wrong on SoundCloud"
csv_filename = "results.csv"
start_sequence = "/wla"
def get_names(delay, base_url, error_title, csv_filename, start_sequence):
@wlinds
wlinds / latex.md
Created November 30, 2023 13:42
LaTeX Lathund 🐶

$\LaTeX$

Greek Letters

LaTex Symbol LaTex Symbol