Skip to content

Instantly share code, notes, and snippets.

View kthy's full-sized avatar
🧀
Was wird aus dem Loch wenn der Käs gefressen ist?

Kristian Thy kthy

🧀
Was wird aus dem Loch wenn der Käs gefressen ist?
View GitHub Profile
@kthy
kthy / app.js
Created June 9, 2022 09:35
Sequelize demo with custom schema
const dotenv = require('dotenv');
const express = require('express');
const { Sequelize, DataTypes } = require('sequelize');
dotenv.config();
const app = express();
const port = parseInt(process.env.APP_PORT) || 3000;
const pg_connection_details = {
database: process.env.PG_DATABASE,
@kthy
kthy / live_streams.sii
Created October 26, 2022 21:56
ETS2 Radio Stations
SiiNunit
{
live_stream_def : _nameless.13d.c83f.e360 {
stream_data: 9
stream_data[0]: "https://live-bauerdk.sharp-stream.com/myrock_dk_mp3|myROCK|Rock|DA|112|0"
stream_data[1]: "http://live-icy.dr.dk/A/A29H.mp3|P6 Beat|Rock|DA|256|0"
stream_data[2]: "http://streams.radiobob.de/bob-metal/mp3-192/mediaplayer|Radio BOB Metal|Metal|DE|192|0"
stream_data[3]: "https://icecast.skyrock.net/s/natio_mp3_128k|Skyrock|Rock|FR|128|0"
stream_data[4]: "https://live-bauerno.sharp-stream.com/radiorock_no_mp3|Radio Rock|Rock|NO|0|0"
stream_data[5]: "https://stream.oneplay.no/rox128|Radio Rox|Rock|NO|128|0"
@kthy
kthy / .bashrc
Created November 17, 2022 08:59
Config for WSL@SPARK
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
@kthy
kthy / spooled_wrapper_fail.py
Created February 7, 2023 09:04
Spooled Wrapper Fail
from csv import DictReader, DictWriter
from io import TextIOWrapper
from tempfile import SpooledTemporaryFile
csv_lines = ["A;2;3", "B;4;6", "C;8;12"]
fieldnames = ["Foo", "Bar", "Baz"]
csv_reader = DictReader(csv_lines, fieldnames=fieldnames, delimiter=";")
with SpooledTemporaryFile(mode="w+b") as tmp:
with TextIOWrapper(tmp, encoding='utf-8') as wrapper:
writer = DictWriter(wrapper, fieldnames=fieldnames)
@kthy
kthy / .bashrc
Created June 16, 2023 21:36
Add Windows host DNS entry in Ubuntu/WSL
if ! $(cat /etc/hosts | grep -q 'winhost'); then
echo 'Adding DNS entry for Windows host in /etc/hosts'
echo '# Windows host - added via ~/.bashrc' | sudo tee -a /etc/hosts
echo -e "$(grep nameserver /etc/resolv.conf | awk '{print $2, " winhost"}')" | sudo tee -a /etc/hosts
fi
@kthy
kthy / .bashrc
Created February 28, 2024 10:29
Bash setup @ SPARK
# add Windows host DNS entry
if ! $(cat /etc/hosts | grep -q 'winhost'); then
echo 'Adding DNS entry for Windows host in /etc/hosts'
echo '# Windows host - added via ~/.bashrc' | sudo tee -a /etc/hosts
echo -e "$(grep nameserver /etc/resolv.conf | awk '{print $2, " winhost"}')" | sudo tee -a /etc/hosts
fi
# configure Cargo
. "$HOME/.cargo/env"
@kthy
kthy / gh-cli.md
Last active March 11, 2025 10:10
List GitHub releases, only show non-prod releases and format output for deletion
gh release list -L1000 -Oasc --json tagName \
  --template '{{range .}}gh release delete {{.tagName}} -y && \{{printf "\n"}}{{end}}' | grep -v -e product