Skip to content

Instantly share code, notes, and snippets.

View bttger's full-sized avatar
🦄

Tom Boettger bttger

🦄
View GitHub Profile
@bttger
bttger / authenticate.ts
Created September 29, 2021 19:39
find the error...
/**
* Checks if the provided credentials are correct and returns corresponding
* employer entity
*
* @throws 404 NotFound Exception (email not found)
* @throws 401 Unauthorized Exception (email and password combination wrong)
* @param email
* @param password
*/
async validateCredentialsEmployer(
@bttger
bttger / openra.md
Last active January 5, 2023 16:17
My hotkeys and tips for OpenRA

OpenRA hotkeys

  • , cycle status bars
  • Z to jump to selection
  • H to jump to base
  • Space to jump to last radar event
  • Q to select all combat units on screen (double click for on map)
  • Click on unit and W to select all units of same type on screen (double click for on map)
  • Shift + Click on unit to add it to selection (also possible to drag over multiple units)
@bttger
bttger / tum_ds_2022.md
Last active February 17, 2023 12:19
My mdfc notes I collected throughout the semester with copied stuff from slides, papers, and the internet. NOT REVIEWED YET answers might be wrong and please don't copy them blindly

Overview

Why should you make a distributed system?

  • The system is inherently distributed (e.g. mobile devices like smartphones)
  • Reliability (some nodes can fail and the system keeps functioning; fault tolerance)
  • Performance (process data faster by utilizing multiple nodes or achieve better latency by requesting data from a nearby node)
  • The capacity of a single machine isn’t enough for the task (e.g. limited memory size, bandwidth, CPU cycles, etc.; scalability)

What are the Characteristics of distributed systems?

@bttger
bttger / index.ts
Created May 10, 2023 20:57
Generate JSON on the upstream database to prevent n+1 query issues
type TableName = string;
type ColumnReference = string;
type SqlConditions = string;
type JsonKeyName = string;
type OrderBy = Record<ColumnReference, "ASC" | "DESC">;
enum QueryNodeType {
Array,
Object,
}
@bttger
bttger / connmon.go
Created June 22, 2023 15:26
Monitor your internet connection in a reliable interval
package main
import (
"bufio"
"flag"
"fmt"
"log"
"net/http"
"os"
"strings"
@bttger
bttger / extract_reddit_comments.py
Created July 28, 2024 00:25
Extract comments on Reddit posts
from lxml import etree
def process_elements(element, keep_tags, depth=0):
result = []
for child in element:
if child.tag in keep_tags:
result.append((depth, child))
result.extend(process_elements(child, keep_tags, depth + 1))
return result