Skip to content

Instantly share code, notes, and snippets.

View pvdb's full-sized avatar
🖥️
Making computers do things!

Peter Vandenberk pvdb

🖥️
Making computers do things!
View GitHub Profile
@pvdb
pvdb / square_fit
Last active March 12, 2024 12:36
convert images to "squared" PNGs
#!/usr/bin/env ruby
# frozen_string_literal: true
#
# INSTALLATION
#
# ln -s ${PWD}/square_fit $(brew --prefix)/bin/
# sudo ln -s ${PWD}/square_fit /usr/local/bin/
#
# PREREQUISITES
@pvdb
pvdb / obfuscate
Last active February 24, 2024 09:55
Obfuscate sensitive input read from STDIN and write to STDOUT
#!/usr/bin/env sh
#
# INSTALLATION
#
# ln -s ${PWD}/obfuscate $(brew --prefix)/bin/
# sudo ln -s ${PWD}/obfuscate /usr/local/bin/
#
# ALIAS
#
@pvdb
pvdb / pack-recurse
Last active February 12, 2024 13:44
#!/bin/sh
#
# INSTALLATION
#
# ln -s ${PWD}/pack-recurse $(brew --prefix)/bin/
# sudo ln -s ${PWD}/pack-recurse /usr/local/bin/
#
find "${HOME}/.vim/pack" -mindepth 2 -maxdepth 2 -type d \( -name start -or -name opt \) | while read -r pack_dir; do
@pvdb
pvdb / git-recurse
Last active February 12, 2024 13:25
#!/bin/sh
#
# INSTALLATION
#
# ln -s ${PWD}/git-recurse $(brew --prefix)/bin/
# sudo ln -s ${PWD}/git-recurse /usr/local/bin/
#
(
@pvdb
pvdb / rbenv-upgrade
Last active November 16, 2023 10:09
#!/usr/bin/env ruby -r semantic -r consenter
# frozen_string_literal: true
#
# INSTALLATION
#
# ln -s ${PWD}/rbenv-upgrade $(brew --prefix)/bin/
# sudo ln -s ${PWD}/rbenv-upgrade /usr/local/bin/
#
@pvdb
pvdb / list_targets.sh
Last active November 8, 2023 08:18
List all targets (sometimes incorrectly referred to as "goals") in a GNU Makefile
#
# this gist can be used to list all targets, or - more correctly - rules,
# that are defined in a Makefile (and possibly other included Makefiles)
# and is inspired by Jack Kelly's reply to a StackOverflow question:
#
# http://stackoverflow.com/questions/3063507/list-goals-targets-in-gnu-make/3632592#3632592
#
# I also found this script - http://www.shelldorado.com/scripts/cmds/targets - which does
# something similar using awk, but it extracts targets from the "static" rules from a single
# Makefile, meaning it ignores any included Makefiles, as well as targets from "dynamic" rules
@pvdb
pvdb / repl
Last active September 6, 2023 10:47
wrap a non-interactive command in an interactive REPL _(read-eval-print loop)_
#!/usr/bin/env ruby
# frozen_string_literal: true
REPL_NAME = 'repl'
REPL_VERSION = '1.0.0'
#
# INSTALLATION
#
# brew install rlwrap
@pvdb
pvdb / git-rev-diff
Last active July 12, 2023 21:26
Run the same command against two git revisions, and diff the output
#!/usr/bin/env bash
#
# INSTALLATION
#
# ln -s ${PWD}/git-rev-diff $(brew --prefix)/bin/
# sudo ln -s ${PWD}/git-rev-diff /usr/local/bin/
#
# check command-line options
#!/usr/bin/env ruby
# frozen_string_literal: true
#
# INSTALLATION
#
# ln -s ${PWD}/git-multi $(brew --prefix)/bin/
# sudo ln -s ${PWD}/git-multi /usr/local/bin/
#
@pvdb
pvdb / git-branch--list--recent
Last active April 18, 2023 08:47
list branches (refs, really) ordered by "recency"
#!/usr/bin/env ruby
# frozen_string_literal: true
#
# INSTALLATION
#
# ln -s ${PWD}/git-branch--list--recent $(brew --prefix)/bin/
# sudo ln -s ${PWD}/git-branch--list--recent /usr/local/bin/
#
# INSPIRATION