Skip to content

Instantly share code, notes, and snippets.

View beporter's full-sized avatar

Brian Porter beporter

View GitHub Profile
@beporter
beporter / readme.md
Last active March 10, 2026 17:57
Greasemonkey script to automatically claim bonus channel points from chat whenever that icon pops up.

Auto-click Twitch chat notices for bonus channel points.

Greasemonkey script to automatically claim bonus channel points from Twitch chat. Clicks the bonus button for you after a short random delay. The button will adopt a new background color (pink by default, but configurable) to let you know this script is working.

This script is heavily inspired by Pabli's version (the mutation observer instead of a setInterval()) and techygrrrl's version (background color, better aria selector) of the same idea, with my addition of a random delay before clicking, in case Twitch ever decides to monitor for this kind of automation.

Installation

@beporter
beporter / .bash_profile
Last active February 26, 2026 23:03
Set iTerm2 tab color based on current working directory name ($PWD).
# The follow snippets will automatically change your iTerm2 tab color when you enter a configured directory.
#
# Installation:
#
# Add the function definitions in this file to your `~/.bash_profile` or `~/.profile`.
#
# Configuring your command prompt to include $(_iterm_tab_color).
# For example:
# PS1="\[$(iterm2_prompt_mark; _iterm_tab_color)\]${PS1}"
#
@beporter
beporter / repro-transcript.txt
Created February 13, 2026 22:18
npm create @storybook:latest error in alpine/busybox
% docker run -it --rm node:lts-alpine sh
/ # cat /etc/os-release
NAME="Alpine Linux"
ID=alpine
VERSION_ID=3.23.3
PRETTY_NAME="Alpine Linux v3.23"
HOME_URL="https://alpinelinux.org/"
BUG_REPORT_URL="https://gitlab.alpinelinux.org/alpine/aports/-/issues"
@beporter
beporter / add_to_cart.user.js
Last active May 10, 2025 06:20
Greasemonkey script to repeatedly refresh a given page, look for specific "Add to Cart" buttons, click them if present, and make a lot of noise on success.
// ==UserScript==
// @name Add Saved Items to Cart
// @namespace https://gist.github.com/beporter/ce76204bcba35d9edb66b395bb5e9305
// @version 0.5
// @description Repeatedly refresh a given "saved items" page (Amazon, Walmart, BestBuy), look for specific "Add to Cart" buttons, click them if present, and make a lot of noise on success.
// @author https://github.com/beporter
// @match https://www.amazon.com/gp/registry/wishlist/*
// @match https://www.amazon.com/hz/wishlist/ls/*
// @match https://www.bestbuy.com/cart
// @match https://www.bestbuy.com/site/customer/lists/manage/saveditems
@beporter
beporter / gravatar.sh
Last active April 24, 2025 21:22
Bash script to generate a gravatar.com URL for an email address. Drop in your PATH and `chmod u+x`. See also: https://gravatar.redirect.channel
#!/usr/bin/env bash
# Generate the correct Gravatar URL for the provided email address.
# When the -o option is provided, `open` the URL in your default browser.
usage() { >&2 echo "Usage: ${0##*/} [-o] <email>"; exit 1; }
GRAVATAR_BASE_URL="https://gravatar.com/avatar/"
GRAVATAR_OPTIONS="d=wavatar"
# Parse command line arguments.
@beporter
beporter / rotate_backups.sh
Last active March 28, 2025 22:40
Having reimplemented this logic probably a dozen times, I'm finally throwing in all the bells and whistles and committing this to a gist for future reference. More notes in the script itself.
#!/usr/bin/env bash
# When `source`d, this script will define a `rotate_backups` function.
# When executed, the script will look for required $1 and $2 arguments
# and execute the function using those.
# Author: beporter at users dot sourceforge dot net
set -eo pipefail
shopt -s extglob
# Moves "${2}.1" to "${2}.2", then "$2" to "${2}.1", etc., making room
@beporter
beporter / github_header_colors.user.js
Last active April 15, 2024 15:41
A Greasemonkey/Tampermonkey script that allows you to customize the header color of each GitHub repository you frequent. If you already have Tampermonkey installed, click the "Raw" button to install this user script.
// ==UserScript==
// @name GitHub Repo Header Colors
// @namespace https://gist.github.com/beporter/704eea76b3943c50f7a61e287f60eca8
// @version 1.1.6
// @description Change the header background color of selected GitHub repositories.
// @author https://github.com/beporter
// @match http*://github.com/*
// @grant GM_getValue
// @grant GM_setValue
// @grant GM_addStyle
@beporter
beporter / thumbs.php
Last active April 19, 2022 09:23
A quick PHP script to generate a folder of thumbnails from a source folder of JPG image files. PHP must be able to write files to the local directory.
<?php
// Make sure we see processing errors during development/testing.
error_reporting(E_ALL);
ini_set('display_errors', true);
// Set up operating parameters.
$filePattern = 'gallery/*.[jJ][pP][gG]';
$thumbPattern = 'thumbs/%s';
$targetWidth = 200;
@beporter
beporter / vmnetshop.sh
Last active March 31, 2020 04:46
Shut down VM network bridges on a Mac
#!/usr/bin/env bash
#
# If you're like me and have to switch between VMware Fusion and
# VirtualBox virtual machines on your Mac frequently, then you've
# probably run into one of the associated errors in this gist
# (https://gist.github.com/beporter/2841de37edbcc48a8755), particularly
# if you're using vagrant. This script shuts down or removes the bridge
# interfaces from BOTH providers so that they can start up cleanly again
# without conflicting with each other and without having to reboot your
# Mac.
@beporter
beporter / composer-create-project-test.sh
Last active January 9, 2020 20:28
Make the process of testing a `composer create-project` command easier by operating against your local working copy.
#!/usr/bin/env bash
# Allows you to test the create-project process using your local
# checked-out copy of the skeleton as the source. You MUST commit the
# changes you want to test to a git branch! You MUST name that branch
# as the first argument and the destination path to set up the fresh
# copy into as the second.
#
# Usage:
# - Place this script in your package's root directory and make it executable.
# - Set the PACKAGE_NAME variable below to match your composer.json's `name`.