Skip to content

Instantly share code, notes, and snippets.

View met's full-sized avatar
:octocat:

Martin Hassman met

:octocat:
View GitHub Profile
@met
met / warmth-for-kyiv.py
Created January 22, 2026 21:38
Compare the charitable amounts collected from the Czech Republic and Poland to save people in Kyiv
import requests
from bs4 import BeautifulSoup
import re
from decimal import Decimal
HEADERS = {
"User-Agent": "Mozilla/5.0 (compatible; DonationComparer/1.0)"
}
def parse_amount(text: str) -> Decimal:
@met
met / Microsoft.PowerShell_profile.ps1
Last active January 22, 2026 01:58
Power shell loader. Put into Dokuments\PowerShell\Microsoft.PowerShell_profile.ps1 Will load all .ps1 files from $dotfilesPath
# ------------------------------
# 💡 Main PowerShell profil
# Edit: notepad $PROFILE
# ------------------------------
# Uncomment to show all Write-Verbose output
# $VerbosePreference = 'Continue'
# Set directory with my .ps1 files
@met
met / csv.sh
Created November 15, 2025 18:06
Format CSV via duckdb
cat file.csv | duckdb -markdown -c "CREATE TABLE tbl AS SELECT * FROM read_json_auto('/dev/stdin'); SELECT * FROM tbl;"
@met
met / logitech-keyboard-k810-set-fn-keys.js
Last active October 25, 2025 23:22
Set F1-F12 keys on/off for old Logitech keyboard K810 via WebHID_API
// Source: https://github.com/victor-st/k810-fn-config/blob/main/src/lib/k810-webhid.js
// Do not execute whole script, Just run step by step, eg. in browse JS console
// Step 1: request permission
let devices = await navigator.hid.requestDevice({
filters: [
{
vendorId: 0x46d, // 1133 - Logitech
productId: 0xb319, // 45849 - K810 keyboard device id
@met
met / gtfs_id_with_underscore.sql
Created October 7, 2024 21:25
Find stop gtfs id containing underscore with duckdb SQL
SELECT * FROM read_csv_auto('stops.txt') WHERE stop_id LIKE '%\_%' ESCAPE '\';
@met
met / trasy_linek.sql
Created October 6, 2024 00:42
Get line routes from static GTFS
SELECT
route_short_name, stop_name, route_long_name, stop_sequence, route_stops.route_id, route_stops.stop_id
FROM
read_csv_auto("route_stops.txt") as route_stops
INNER JOIN
read_csv_auto("routes.txt") as routes ON route_stops.route_id = routes.route_id
INNER JOIN
read_csv_auto("stops.txt") as stops ON route_stops.stop_id = stops.stop_id
WHERE
route_stops.direction_id = 0
@met
met / gtfs_character_check.sh
Last active October 6, 2024 09:53
Show all characters used in Prague public transit stop_names, headsigns and route_short_names
#!/usr/bin/env bash
# Download static GTFS for Prague PID and show all used characters in stop_names, trip_headsigns and, route_short_names
# Require: curl, unzip and duckdb
GTFS_PID_URL='https://data.pid.cz/PID_GTFS.zip'
GTFS_ZIP_FILEMAME='pid_gtfs.zip'
GTFS_DIRNAME='pid_gtfs'
# check for file GTFS_ZIP_FILEMAME
@met
met / vocabulary2zivyObraz.gs
Created September 15, 2024 17:02
Train vocabulary with ZivyObraz.cz
// This work by Martin Hassman is marked with CC0 1.0
// https://creativecommons.org/publicdomain/zero/1.0/?ref=chooser-v1
//
// How to use:
// 1. Upload your vocabulary into 1st column of 1st sheet in Google Tables
// 2. Set apiKey of https://zivyobraz.eu/
// 3. Set time trigger to SetNewVocab() function
// 4. Practice vocabulary
function SetNewVocab() {
@met
met / concatenate-mp3.js
Created January 27, 2024 05:11
Generate bat file for concatenating MP3. Each 18 MP3 from directory is added 2 times into one biger MP3 file
// Generate bat file for concatenating MP3. Each 18 MP3 from directory is added 2 times into one biger MP3 file
// Like this, but every line contains 2x18 mp3 files:
// ffmpeg -i "concat:50lang-1st-part-1-0001.mp3|50lang-1st-part-1-0002.mp3|50lang-1st-part-1-0003.mp3" -c copy 50lang-lesson-01.mp3
const path = require('path');
const fs = require('fs');
const directoryPath = path.join(__dirname);
let fff = [];
@met
met / 50languagesToCSV.js
Created January 24, 2024 00:19
Export 50languages page to CSV containing language data for study
// This is a modified script from https://www.geeksforgeeks.org/how-to-export-html-table-to-csv-using-javascript/
function tableToCSV() {
// Variable to store the final csv data
let csv_data = [];
let table = document.getElementById('table1');
// Get each row data