Skip to content

Instantly share code, notes, and snippets.

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

Peter Vandenberk pvdb

🖥️
Busy making computers do things!
View GitHub Profile
@pvdb
pvdb / README.md
Last active February 16, 2025 17:40

yet another code counter: gloc

gloc is yet another code counter, with some differences and enhancements compared to similar utilities.

Most importantly, it simply groups files based on their file extension, unlike other code counters that group files based on the - oftentimes incorrect - language of their content (as determined by whatever "language detection" heuristics these tools may use).

Further differences and enhancements:

  • it doesn't ignore files just because it doesn't recognise them (ie. cannot correctly determine or guess their language)
  • in a git repo, it processes $( git ls-files ) by default
@pvdb
pvdb / brew-browse
Last active December 1, 2024 14:59
#!/usr/bin/env sh
#
# INSTALLATION
#
# ln -s ${PWD}/brew-browse $(brew --prefix)/bin/
# sudo ln -s ${PWD}/brew-browse /usr/local/bin/
#
# PREREQUISITES
#
@pvdb
pvdb / fit2gpx
Last active September 5, 2024 09:03
Extract GPX tracks from Garmin FIT files
#!/usr/bin/env ruby
# frozen_string_literal: true
#
# fit2gpx - Convert FIT files to GPX files
#
# INSTALLATION
#
# ln -s ${PWD}/fit2gpx $(brew --prefix)/bin/
# sudo ln -s ${PWD}/fit2gpx /usr/local/bin/
@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-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
@pvdb
pvdb / git-multi
Last active February 16, 2025 17:34
#!/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/
#
# DEPENDENCIES
@pvdb
pvdb / repl
Last active February 16, 2025 17:42
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
#
# ln -s ${PWD}/repl $(brew --prefix)/bin/
@pvdb
pvdb / xdiff
Last active March 14, 2023 12:28
#!/usr/bin/env zsh
#
# INSTALLATION
#
# ln -s ${PWD}/xdiff $(brew --prefix)/bin/
# sudo ln -s ${PWD}/xdiff /usr/local/bin/
#
REPORT="$1" ; shift ;
@pvdb
pvdb / square_fit
Last active October 29, 2024 13:10
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