Skip to content

Instantly share code, notes, and snippets.

View andrewmackrodt's full-sized avatar
😴

Andrew Mackrodt andrewmackrodt

😴
View GitHub Profile
@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 / bbod-dl
Last active March 15, 2024 13:46
Beachbody On Demand 1080p Downloader
#!/bin/bash
IFS=$'\n\t'
set -eou pipefail
# configure credentials
BBOD_API_KEY="" # bbConfig.configData.bbVideoDataMode
BBOD_PROFILE="" # bbConfig.profileID
BBOD_USER_AGENT="" # can probably be anything
# check whether the content id has been specified
{
"spectrum": {
"show": "false",
"n-points": "100",
"height": "100",
"use-custom-color": "false",
"fill": "true",
"show-bar-border": "true",
"scale": "1",
"exponent": "1",
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 / ClassTableModel.php
Last active May 8, 2023 00:12
Laravel Eloquent Multi Class Table Inheritance
<?php
declare(strict_types=1);
namespace App\Database\Eloquent;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Collection;
class ClassTableModel extends \Illuminate\Database\Eloquent\Model
@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: "
#!/bin/bash
set -euo pipefail
IFS=$'\n\t'
HOSTNAME=${HOSTNAME:-$(hostname 2>/dev/null || echo 'local')}
# logging functions
log() { echo -n "[$(date +'%Y-%d-%m %H:%M:%S')] $HOSTNAME.$1"; }
debug() { echo -ne '\033[90m' >&2; log "DEBUG: $1" >&2; echo -e '\033[0m' >&2; }
info() { echo -ne '\033[34m' >&2; log "INFO: $1" >&2; echo -e '\033[0m' >&2; }
warn() { echo -ne '\033[33m' >&2; log "WARN: $1" >&2; echo -e '\033[0m' >&2; }
@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
}