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 / 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-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 / 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/
#
(
#!/usr/bin/env bash
#
# INSTALLATION
#
# ln -s ${PWD}/git-subst $(brew --prefix)/bin/
#
FROM="$1" ;
TO="$2" ;
@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 / 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
@pvdb
pvdb / SSLPoke.java
Created May 18, 2016 19:21 — forked from 4ndrej/SSLPoke.java
Test of java SSL / keystore / cert setup. Check the commet #1 for howto.
import javax.net.ssl.SSLSocket;
import javax.net.ssl.SSLSocketFactory;
import java.io.*;
/** Establish a SSL connection to a host and port, writes a byte and
* prints the response. See
* http://confluence.atlassian.com/display/JIRA/Connecting+to+SSL+services
*/
public class SSLPoke {
public static void main(String[] args) {
@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
@pvdb
pvdb / process_tcp.rb
Last active August 29, 2015 14:25
Get the number of TCP connections owned by current Ruby process
#
# This first version should work on Mac OS X and Linux, but it spawns a process
#
# the number of TCP connections owned by the process.
def Process.tcp_count() `lsof -l -n -P -p #{Process.pid} -a -i tcp | egrep -v '^COMMAND' | wc -l`.chomp.to_i ; end
#!/usr/bin/env ruby
require 'pp'
def ruby_repl processor = nil
unless (processor && Proc === processor) || block_given?
warn "Please invoke `ruby_repl` with a block or a proc..."
else
in_pry = Kernel.const_defined?("Pry::ColorPrinter")
cmd_count = 0 # for use in the command prompt