Skip to content

Instantly share code, notes, and snippets.

View slhck's full-sized avatar

Werner Robitza slhck

View GitHub Profile
@slhck
slhck / convert_git_to_https.sh
Created June 24, 2025 08:31
Convert Git repos from Git SSH to HTTPS
#!/bin/bash
# This script converts all git remote URLs from SSH to HTTPS for all repositories in the current directory.
#
# Author: Werner Robitza
#
# Usage:
# ./convert_to_https.sh
TARGET_PATH="."
GIT_HOSTNAME="git.example.com" # Change this to your Git hostname
@slhck
slhck / release.sh
Created June 18, 2025 11:42
Simple release script
#!/usr/bin/env bash
#
# Release the project and bump version number in the process.
#
# To set up the project, make sure you have a VERSION file:
#
# echo "1.0.0" > VERSION
set -e
@slhck
slhck / release.sh
Last active June 18, 2025 11:31
Simple uv-based release script
#!/usr/bin/env bash
#
# Release the project and bump version number in the process.
#
# To set up the project, make sure you have in pyproject.toml:
#
# [project]
# name = "foo-bar"
# version = "2.10.0"
# ...
@slhck
slhck / find_offset.py
Created April 2, 2025 15:13
find_offset.py
#!/usr/bin/env python3
# /// script
# requires-python = ">=3.11"
# dependencies = [
# "p-tqdm",
# ]
# ///
#
# Find the temporal offset between two videos.
# Do this by computing the PSNR of the first against the second video for all frames
@slhck
slhck / ufw_traefik_fix.sh
Created October 23, 2024 09:23
Fix Traefik container not being reachable after restarts
#!/usr/bin/env bash
#
# Update the ufw rules such that a Traefik container is reachable
set -e
for cmd in ufw-docker ufw docker; do
if ! command -v "$cmd" > /dev/null; then echo "Install $cmd first!"; exit 1; fi
done
@slhck
slhck / dbproxy.sh
Created September 30, 2024 07:00
Expose a Docker-based Postgres database to localhost
#!/usr/bin/env bash
#
# Start a reverse proxy for the Postgres DB,
# exposing port 5432 locally.
#
# To use this, on your local machine, run:
#
# ssh -t -L 5432:localhost:5432 username@hostname 'cd $HOME/path/to/folder/ && ./dbproxy.sh'
set -e
@slhck
slhck / docker_entrypoint_sidekiq.sh
Created June 20, 2024 14:25
A Docker entrypoint for starting Foreman with multiple Sidekiq processes
#!/usr/bin/env bash
#
# A Docker entrypoint for starting Foreman with multiple Sidekiq processes
#
# Required in the Dockerfile:
#
# gem install foreman --no-document
echo_stderr() {
@slhck
slhck / download-latest-chrome.sh
Created June 5, 2024 18:13
Download latest chrome installer for Linux and rename
#!/usr/bin/env bash
#
# Download latest chrome installer for Linux and rename
set -e
cd "$(dirname "$0")" || exit 1
if ! command -v dpkg-deb &> /dev/null; then
echo "ERROR: dpkg-deb is not installed"
@slhck
slhck / trello-convert.py
Last active June 5, 2024 09:36
Export Trello cards to Markdown
#!/usr/bin/env python3
import argparse
import json
def main():
parser = argparse.ArgumentParser(description="Convert Trello JSON to Markdown")
parser.add_argument("file", type=str, help="Trello JSON file")
parser.add_argument("-l", "--list", help="Filter list name to convert")
@slhck
slhck / Dockerfile
Created February 15, 2023 19:44
Dockerfile for Google Lighthouse
# syntax=docker/dockerfile:1
FROM debian:bullseye
ENV DEBIAN_FRONTEND noninteractive
# ==============================================================================
# Main dependencies
RUN apt-get update -qq \
&& apt-get install -y \