Skip to content

Instantly share code, notes, and snippets.

@husjon
husjon / debugging.md
Created November 19, 2025 13:19 — forked from Fevol/debugging.md
An overview for debugging and performance analysis within Obsidian

Debugging your code

Unwinding the code trace

Sometimes you want to figure out what path your code takes when getting executed. This may be helpful for investigating inconsistent behaviour between function calls or finding where exactly in the bundled/minified code your function is located

// Logs the current stack trace of the code, also logs any provided parameters

/*
 * YOUR CODE HERE
 */
console.trace(var1, var2);

Zyxel GS1900 certificate installer

A simple script to install a certificate (specifically PKCS#12) for the Zyxel GS1900 switch using the v2.80V2.80(AAHK.0) | 10/16/2023 firmware.
Firmware release notes can be found here: https://download.zyxel.com/GS1900-24E/firmware/GS1900-24E_2.80(AAHK.0)C0_2.pdf

The idea for it is to allow us to update the certificate automatically when needed (hands-free) with for example certbot.

After some investigation I found that the switch was very stubborn about how it wants the request sent.
In short:

@husjon
husjon / get-humble-bundle-library-keys.js
Created December 21, 2023 23:19 — forked from jonathonlui/get-humble-bundle-library-keys.js
Get list of keys from Humble Bundle Library page
/*
* Run on https://www.humblebundle.com/home/library
* Global variable `gamekeys` is available on the Library page
*
*/
Promise.all(gamekeys.map(key => {
return new Promise((resolve, reject) => {
$.ajax({
url: `https://www.humblebundle.com/api/v1/order/${key}?all_tpkds=true`
}).done(data => resolve(data))
@husjon
husjon / aoc-01-input.txt
Last active December 3, 2023 16:48
advent of code inputs
gtlbhbjgkrb5sixfivefivetwosix
ninesixrgxccvrqscbskgzxh6cpvpxsqnb6
dxxzrlzkksfsffp4
sbzvmddhnjtwollnjv33d2lbcscstqt
88xpnfpb
ninevct4cpdvqfxmspbz9xrvxfvbpzthreesfnncrqn
mqsxzsglbtmsbltrbzkbrt23
seven16ninefc
8jdddctvxs3
fivennhhdfpmrnpjhdm2sixkrsgdt
@husjon
husjon / binds_on_mount.sh
Created June 8, 2023 17:52 — forked from alexandrusavin/binds_on_mount.sh
Add letsencrypt certificate to dd-wrt web interface
#!/bin/sh
if [ `nvram get https_enable` -gt 0 ] ; then
# get the absolute directory of the executable
SELF_PATH=$(cd -P "$(dirname "$0")" && pwd -P)
echo SELF_PATH: ${SELF_PATH}
# extract the mount path
@husjon
husjon / Notes.md
Last active March 14, 2024 01:52
Script for publishing notes from Obsidian to Quartz
@husjon
husjon / FTBA_unix_202211021238-4322c4d8d1-release.sh.patch
Last active November 8, 2022 22:40
FTB Launcher patch for Linux
596c596,597
< app_java_home=`pwd`
---
> java_binary_path="$(find -name 'java' | sed 's/\/bin\/java//')"
> app_java_home="$(realpath "${java_binary_path}")"
@husjon
husjon / list_packages.sh
Created July 15, 2021 18:59
Synology list packages that has dependencies
#/bin/bash
for pkg in $(synopkg list --name); do
for dep_pkg in $(synopkg list --depend-on $pkg --name); do
echo "$pkg -> $dep_pkg";
done
done | sort
#!/bin/bash
swap() {
tmux swap-pane -s $1 -t $2
tmux select-pane -t $1
}
get_id() {
echo $(tmux run "echo #{pane_id}")
}
swap_vert() {