Skip to content

Instantly share code, notes, and snippets.

View wlinds's full-sized avatar
🍍

William Akilles Lindstedt wlinds

🍍
View GitHub Profile
@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