Skip to content

Instantly share code, notes, and snippets.

View andrewmackrodt's full-sized avatar
😴

Andrew Mackrodt andrewmackrodt

😴
View GitHub Profile
@andrewmackrodt
andrewmackrodt / switch-network.sh
Last active June 27, 2024 00:15
macOS script to toggle between static ip and dhcp using different routers
#!/usr/bin/env bash
set -euo pipefail
inetInterfaceIp=$( \
ifconfig \
| perl -0777 -pe 's/\n+^[ \t]/ /gm' \
| grep 'inet ' \
| grep RUNNING \
| grep -v LOOPBACK \
| sed -nE 's/([a-z0-9]+).* inet ([^ ]+).*/\1 \2/p' \
#!/usr/bin/env bash
set -euo pipefail
sshUser="REPLACE_ME"
sshKeys=$(cat <<'EOF'
REPLACE_ME
EOF
)
assert_root() {
@andrewmackrodt
andrewmackrodt / glx3000-at-tool.html
Last active June 3, 2024 21:42
GL-X3000 AT Command Tool
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>GL-X3000 AT Command Tool</title>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,300italic,700,700italic">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/8.0.1/normalize.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/milligram/1.4.1/milligram.css">
<style type="text/css">
@andrewmackrodt
andrewmackrodt / gist:78e816c251f34935a6a68a51c1fc67db
Created May 20, 2024 22:56
git reset all commit authors and dates
git rebase --root --reset-author --exec 'export GIT_COMMITTER_DATE=$(git log --format="%aD" | head -n1); git commit --amend --no-edit --date="$GIT_COMMITTER_DATE"'
import pem from 'pem'
import fs from 'node:fs'
import http from 'node:http'
import https from 'node:https'
import net from 'node:net'
import { parse as parseURL } from 'node:url'
import tls, { SecureContext } from 'tls'
type Scheme = 'http' | 'https'
@andrewmackrodt
andrewmackrodt / convert_x264.sh
Last active July 22, 2023 23:47
Vaudeville Proton Video Fix
#!/bin/bash
# Script to transcode Vaudeville 4K AVC1 media to 1080p X264/Opus so that Proton
# Experimental or Proton GE can play cutscene video and audio.
#
# Move the script to ${steam_library}/steamapps/common/Vaudeville and run. This
# script requires ffmpeg. If ffmpeg crashes with a segfault, re-run the script
# until it succeeds. Files which have successfully been transcoded already will
# be skipped on subsequent runs.
#
@andrewmackrodt
andrewmackrodt / discord-updater.sh
Last active February 15, 2023 20:20
Updates an existing discord installation to the latest version on Ubuntu
#!/bin/bash
echo -n "detecting installed version: "
installed=$(dpkg -l | awk '$1 == "ii" && $2 == "discord" { print $3 }')
if [[ "$installed" == "" ]]; then
echo "error"
exit 1
fi
echo "$installed"
echo -n "detecting latest version: "
@andrewmackrodt
andrewmackrodt / asusctl-builder.sh
Last active March 19, 2024 21:57
Ubuntu 22.04 deb creator for asusctl
#!/bin/bash
set -euo pipefail
cd $(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)
build_dir=$(mktemp -d)
cleanup() {
if [[ -d "$build_dir" ]]; then
rm -rf "$build_dir"
fi
@andrewmackrodt
andrewmackrodt / portable-secret-decrypt.js
Last active December 22, 2022 16:51
Decrypt Portable Secret messages using command-line (requires Node.js >= 10)
const crypto = require('crypto')
const fs = require('fs')
const readline = require('readline')
const rl = readline.createInterface({ input: process.stdin, output: process.stdout })
const prompt = (query) => new Promise((resolve) => rl.question(query, resolve))
void (async () => {
const args = process.argv.slice(2)
#!/bin/bash
function finish {
if [[ "${rtspContainerId:-}" != "" ]]; then
docker kill "$rtspContainerId"
fi
if [[ "${ffmpegPid:-}" != "" ]]; then
kill "$ffmpegPid"
fi
}