Skip to content

Instantly share code, notes, and snippets.

@stefansundin
stefansundin / background.js
Last active April 17, 2026 23:58
Firefox browser extension that attempts to disable GraphQL persisted queries by intercepting requests and trick the client that the server does not know what the query is. Modify the files to target your specific website.
// Note: This only works in Firefox!
//
// Load the extension in about:debugging
// If it doesn't seem to be working then click the Inspect button and see if there's any information in the Console tab.
// If you don't see any requests being intercepted, open the Add-ons Manager and go to the extension's "Permissions and Data" section, and make sure it is granted permissions for the hosts. It needs permissions to both the host page and the host that the requests are made to.
// IMPORTANT: The request will be sent twice because the first request is not cancelled. So any mutations will trigger twice, which may cause particular websites to behave strangely.
// TODO: Fix this somehow.
// Response body that will make the client re-send the request with the full query:
package main
import (
"errors"
"fmt"
"net"
"net/http"
"os"
"syscall"
)
@stefansundin
stefansundin / background.js
Created August 24, 2024 06:53
Firefox browser extension that can disable the persisted queries GraphQL feature on Twitch.tv
// Note: This only works in Firefox!
//
// Load the extension in about:debugging
// If it doesn't seem to be working then click the Inspect button and see if there's any information in the Console tab
// One issue with old Firefox versions is that the host permission isn't automatically granted. Double check this in the Add-ons Manager.
//
// https://assets.twitch.tv/config/settings.0fa0027ddfc373022638f7943c4dd40d.js
function listener(details) {
console.log(details.url);
@stefansundin
stefansundin / 1.docker-buildx-build-concurrency.md
Last active April 14, 2025 19:17
How to limit `docker buildx build` concurrency

If your computer is running out of memory during a docker build, or if the build is CPU intensive, you might want to try building one architecture at a time.

When creating the builder instance, specify a buildkitd config file with --config that limits the concurrency.

Create buildkitd.toml:

[worker.oci]
max-parallelism = 1
@stefansundin
stefansundin / protected-dialer-control.go
Last active February 8, 2022 01:59
Golang dialer control to prevent untrusted input from connecting to private IP addresses.
package main
import (
"errors"
"fmt"
"net"
"net/http"
"os"
"syscall"
)
@stefansundin
stefansundin / audd-analyze.sh
Last active February 5, 2021 08:25
Analyze long audio files with audd.io.
#!/bin/bash -ex
mkdir -p audd
if (( $# < 2 )); then
echo "Please supply two arguments, the input file and the timestamp (HH:MM:SS)."
exit 1
fi
fn=$1
pos=$(date -d "1970-01-01 $2" -u +%s)
@stefansundin
stefansundin / ffmpeg.rb
Last active August 20, 2021 14:19
Download Twitch video that has muted sound.
#!/usr/bin/env ruby
files = Dir["*.ts"].sort_by { |fn| fn.split(".")[0].to_i }
puts "ffmpeg -i 'concat:#{files.join("|")}' -codec copy output.mkv"
puts
puts "run this first:"
puts "ulimit -n 4096"
@stefansundin
stefansundin / manifest.json
Created July 24, 2019 19:11
Make the list of items in Rollbar wider.
{
"name": "Rollbar",
"version": "1.0",
"description": "Make the list of items in Rollbar wider.",
"content_scripts": [
{
"matches": ["https://rollbar.com/*"],
"css": ["rollbar.css"]
}
],