Skip to content

Instantly share code, notes, and snippets.

View FredrikM97's full-sized avatar

Fredrik Mårtensson FredrikM97

  • Sweden
View GitHub Profile
@FredrikM97
FredrikM97 / wabbajack-download-button-clicker.py
Last active February 26, 2026 09:15
wabbajack-download-button-clicker
import os
import sys
import time
import signal
from dataclasses import dataclass
import pyautogui
import keyboard
@FredrikM97
FredrikM97 / gitconfig-multi-ssh.txt
Last active February 26, 2026 09:15
Github switch user
# This is a script for .gitconfig and .ssh/config to manage and switch between user accounts. If first argument to ctx is left empty it is considered default otherwise we append to github.com-*
```
[alias]
ctx = "!f() { LABEL=$1; EMAIL=$2; NAME=$3; CURRENT=$(git remote get-url origin); FROM=$(echo \"$CURRENT\" | grep -oE 'git@github\\.com(-[^:]*)?'); if [ -z \"$LABEL\" ]; then TO=\"git@github.com\"; elif echo \"$FROM\" | grep -q -- \"-$LABEL\"; then TO=\"git@github.com\"; else TO=\"git@github.com-$LABEL\"; fi; NEW=$(echo \"$CURRENT\" | sed \"s|$FROM|$TO|\"); git remote set-url origin \"$NEW\"; git config user.email \"$EMAIL\" && git config user.name \"$NAME\" && echo \"* Switched to ${LABEL:-default}: $EMAIL\"; }; f"
whoami = "!echo \"Current email: $(git config user.email)\" && git remote -v | head -n1"
private = "!git ctx private '<private email>' '<private name>'"
default = "!git ctx '' '<work email>' '<work name>'"
@FredrikM97
FredrikM97 / tradfri_e2001-e2002_light_switch.yaml
Last active December 16, 2024 17:37
Tradfri E2001/E2002 light Switch Blueprint
blueprint:
name: Tradfri E2001/E2002 light Switch
description: >
Control light or group of lights with switch.
Based on https://gist.github.com/FloppyGit/efaa93c1d63676e30c4b61adb4a861ac
domain: automation
input:
source_switch_action:
name: Tradfri E2001/E2002 Switch
description: Switch triggers action.