Skip to content

Instantly share code, notes, and snippets.

View joseywoermann's full-sized avatar

Josey C. Wörmann joseywoermann

View GitHub Profile
def obersumme(n: int, f) -> None:
"""
Berechnet die Obersumme für `n` äquidistante Rechtecke mit der Funktion `f` im Intervall [0; 1]
`O(n) = 1/n * f(1/n) + 1/n * f(2/n) + 1/n * f(3/n) + ... + 1/n * f((n-1)/n) + 1/n * f(n/n)`
"""
term = 0
for i in range(n + 1):
term += (1 / n) * f(i / n)
@joseywoermann
joseywoermann / sveltekit.code-snippets
Last active October 11, 2021 13:47
VS Code code snippets for Svelte
{
"Create SvelteKit Route Component": {
"scope": "svelte",
"prefix": "sv",
"body": [
"<script lang=\"ts\">\n\n</script>\n\n\n<svelte:head>\n <title></title>\n</svelte:head>\n\n\n<body>\n $1\n</body>\n\n\n<style type=\"text/postcss\">\n\n</style>"
],
"description": "Create a SvelteKit route component"
},
"Create Tailwind style block": {
⭐ Total Stars: 10
➕ Total Commits: 1,427
🔀 Total PRs: 241
🚩 Total Issues: 137
📦 Contributed to: 28
public class Util {
/**
* Pauses the program
* @param pSeconds How long should the program be paused?
*/
public static void wait(int pSeconds) {
try {
Thread.sleep(pSeconds * 1000);
} catch (InterruptedException ex) {
Thread.currentThread().interrupt();
@joseywoermann
joseywoermann / cleanup.bat
Created September 7, 2021 17:53
Delete all .class and .ctxt files in a folder.
del /S *.class
del /S *.ctxt
public class Dice {
/**
* Generate a random full number between 0 and the specified number. (Upper limit)
*/
public static int roll(int pSides) {
return (int) Math.round(Math.random() * (pSides - 0));
}
}
@joseywoermann
joseywoermann / commands.md
Last active November 14, 2021 19:09
Useful Raspberry Pi commands

A collection of commands I find useful when working with Raspberry Pis. Some of these require external software.

Shows the uptime in a pretty format

uptime -p

Shows the SoC's temperature

@joseywoermann
joseywoermann / vercel.json
Created July 5, 2021 17:34
make CORS error go poof on Vercel
{
"headers": [
{
"source": "/api/(.*)",
"headers": [
{ "key": "Access-Control-Allow-Credentials", "value": "true" },
{ "key": "Access-Control-Allow-Origin", "value": "*" },
{ "key": "Access-Control-Allow-Methods", "value": "GET,OPTIONS,PATCH,DELETE,POST,PUT" },
{ "key": "Access-Control-Allow-Headers", "value": "X-CSRF-Token, X-Requested-With, Accept, Accept-Version, Content-Length, Content-MD5, Content-Type, Date, X-Api-Version" }
]
@joseywoermann
joseywoermann / 🎵 My last week in music
Last active April 24, 2024 14:09
What I listened to last week:
Illenium █████░░░░░░░░░░░░ 46 plays
Crystal Rock ██░░░░░░░░░░░░░░░ 18 plays
Bad Omens █▉░░░░░░░░░░░░░░░ 17 plays
Blind Channel █▎░░░░░░░░░░░░░░░ 12 plays
Smash Into Pieces █▎░░░░░░░░░░░░░░░ 12 plays
The Sidh █▎░░░░░░░░░░░░░░░ 12 plays
Bloodywood █░░░░░░░░░░░░░░░░ 10 plays
LANDMVRKS █░░░░░░░░░░░░░░░░ 9 plays
NF █░░░░░░░░░░░░░░░░ 9 plays
Ocean Sleeper ▉░░░░░░░░░░░░░░░░ 8 plays