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 / 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 / subst
Last active March 11, 2023 09:29
#!/usr/bin/env bash
#
# INSTALLATION
#
# ln -s ${PWD}/subst $(brew --prefix)/bin/
# sudo ln -s ${PWD}/subst /usr/local/bin/
#
# ALTERNATIVE IMPLEMENTATION
#
@pvdb
pvdb / git-hub
Last active February 27, 2023 08:55
#!/usr/bin/ruby
# frozen_string_literal: true
#
# INSTALLATION
#
# ln -s ${PWD}/git-hub $(brew --prefix)/bin/
# sudo ln -s ${PWD}/git-hub /usr/local/bin/
#
# CONFIGURATION
@pvdb
pvdb / git-ctags
Last active February 27, 2023 08:55
#!/bin/sh
#
# INSTALLATION
#
# ln -s ${PWD}/git-ctags $(brew --prefix)/bin/
# sudo ln -s ${PWD}/git-ctags /usr/local/bin/
#
# https://tbaggery.com/2011/08/08/effortless-ctags-with-git.html
@pvdb
pvdb / process_rss.rb
Last active December 14, 2022 10:50
Get real memory (resident set) used by current Ruby process
#
# This first version should work on Mac OS X and Linux, but it spawns a process
#
# http://stackoverflow.com/questions/7220896/
# https://github.com/rdp/os/blob/master/lib/os.rb#L127
# http://www.ruby-doc.org/core-2.0/Process.html
#
# A better - but more complicated - way to achieve the same is documented here:
#
# https://build.betterup.com/tracking-a-processs-memory-usage-in-ruby/
@pvdb
pvdb / 70-available-updates-incl-age.rb
Last active September 15, 2021 00:22
determine and print out the age of the oldest and the age of the most recent security update
#!/usr/bin/env ruby
#
# This script can be used to patch the following script on an Amazon Linux AMI:
#
# /etc/update-motd.d/70-available-updates
#
# which is run by cron on a daily basis to add package update info to the MOTD:
#
# 19 package(s) needed for security, out of 160 available
#!/usr/bin/env bash
#
# INSTALLATION
#
# ln -s ${PWD}/git-subst $(brew --prefix)/bin/
#
FROM="$1" ;
TO="$2" ;
#!/usr/bin/env ruby
#
# INSTALLATION
#
# ln -s ${PWD}/git-stash-switcher $(brew --prefix)/bin/
#
# COMING SOON!
@pvdb
pvdb / consenter.rb
Last active September 4, 2018 17:59
idiomatic Enumerable extensions to filter elements by consent
# rubocop:disable all
# https://github.com/pvdb/consenter
require 'io/console'
class Consenter # :nodoc:
VALID_RESPONSES = {
'y' => 'yes to this',
@pvdb
pvdb / validate_external_urls.sh
Last active March 4, 2017 09:01
Shell script to extract and validate external URLs found in Seedy content files
#!/usr/bin/env sh
#
# install GNU grep (`/usr/local/bin/ggrep`)...
#
# brew tap homebrew/dupes; brew install grep
#
# usage - ensure `${PROJECTS_HOME}` is set...
#
# find ${PROJECTS_HOME}/seedy/content -name '*.md' | ./validate_external_urls.sh > seedy_external_urls.tsv