Skip to content

Instantly share code, notes, and snippets.

@rubenhorn
rubenhorn / summon_window.ahk
Last active January 30, 2024 10:29
AutoHotkey script for moving active window to main monitor
#SingleInstance force
; Hotkey: Alt + S
!s::
; Check if window active window exists
WinGetTitle, t, a
if(t = "Program Manager" or t = "") {
MsgBox ,, No window selected!, Please select a window.`n(Alt + Tab)
return
@rubenhorn
rubenhorn / TermuxServer.md
Last active November 22, 2023 20:18
Termux Server

Initial setup

(See also the Termux Wiki)

# Install AutoSSH, OpenSSH and FTP server and tmux
pkg upgrade
pkg install autossh openssh openssh-sftp-server tmux
# Set password for initial connection
passwd
# Find local IP address of device
ifconfig | grep -o 192[0-9\.]*
@rubenhorn
rubenhorn / YTranslate.cs
Created October 16, 2019 09:08
Unity script for machine translation using the Yandex Translate API
using System.Collections;
using System;
using System.Xml;
using UnityEngine.Networking;
/*
Requirement:
Yandex Translate API key (https://tech.yandex.com/translate/)
Usage:
@rubenhorn
rubenhorn / indivious-to-newpipe.py
Created February 2, 2023 12:49
Convert indivious export to NewPipe export
#! /usr/bin/python3
import json
import sys
import requests
import html
indivious_subs = json.load(sys.stdin).get("subscriptions", [])
@rubenhorn
rubenhorn / get-notified
Last active December 17, 2022 12:28
Personal Push Notifications
#! /bin/sh
HOST="ntfy.sh"
TOPIC="hh2WuvyfG7dN8tQx8ZxLF8wE"
TIMEOUT=10
# Hack to get around issue of output not being piped
while true
do
curl -s $HOST/$TOPIC/json --max-time $TIMEOUT | jq -c 'select(.event == "message")' | while IFS= read -r JSON
@rubenhorn
rubenhorn / frun
Created October 7, 2022 18:22
A simple, fuzzy flatpak launcher
#! /bin/bash
# A simple, fuzzy flatpak launcher
if [ -z "$(which flatpak 2>/dev/null)" ]
then
echo "Flatpak not installed!"
exit 1
fi
@rubenhorn
rubenhorn / eduroam-connect
Created October 6, 2022 11:16
nmcli eduroam script
#! /bin/bash
if [ "$1" == "rm" ]
then
nmcli connection delete eduroam 2>/dev/null
exit
fi
if [ -z "$(nmcli con show | grep eduroam)" ]
then
@rubenhorn
rubenhorn / aws-mfa
Created July 31, 2022 16:25
A simple shell script to generate AWS CLI credentials using MFA
#! /usr/bin/bash
ACCOUNT=$1
USER=$2
OTP=$3
PROFILE=$4
if [ -n "$PROFILE" ]; then
PROFILE="--profile $PROFILE"
fi
@rubenhorn
rubenhorn / firebase-sms-jwt.py
Created March 13, 2022 22:53
Generate Firebase ID token for SMS based authentication
#!/usr/bin/python3
import argparse, requests
url_request_code = (
"https://identitytoolkit.googleapis.com/v1/accounts:sendVerificationCode"
)
url_sign_in_with_phone_number = (
"https://identitytoolkit.googleapis.com/v1/accounts:signInWithPhoneNumber"
)
@rubenhorn
rubenhorn / aws-mfa.py
Last active January 3, 2022 15:55
Simple command line tool for updating AWS MFA session credentials
#!/usr/bin/python3
import json
from pathlib import Path
from subprocess import PIPE, Popen
import sys
"""
Before using this script:
- Configure AWS cli to output JSON (https://docs.aws.amazon.com/cli/latest/userguide/cli-usage-output-format.html)