Skip to content

Instantly share code, notes, and snippets.

View david-shepard's full-sized avatar

David Shepard david-shepard

View GitHub Profile
@david-shepard
david-shepard / sshfzf.sh
Created October 10, 2025 21:15
Simple SSH script using fzf
# include this in ~/.bashrc or ~/.zshrc
sshf () {
local hosts
hosts=$(grep -E '^Host ' ~/.ssh/config | awk '{print $2}' | grep -v '*' | grep -v '*$' | grep -v 'github')
local selected_host
selected_host=$(echo "$hosts" | fzf --height=50% --reverse --prompt="SSH into: ")
if [ -n "$selected_host" ]; then
ssh "$selected_host"
fi
}
@david-shepard
david-shepard / proxmox-reuse-lxc.sh
Last active September 22, 2025 21:39
Reuse a LXC Container Config in Proxmox
#!/bin/bash
if [[ "$#" != 2 ]]; then
echo "Usage $0 <config path> <hostname>"
exit 1
fi
mapfile -t configs < <(ls -1 /etc/pve/lxc/)
last_config="${configs[-1]%%.*}"
new_config=$((last_config+1))
@david-shepard
david-shepard / reddit-answers-bookmarklet.js
Created August 22, 2025 07:51
bookmarklet opens prompt to search reddit answers (https://www.reddit.com/answers/), workaround for the fact that it's not addressable by the chrome search bar
javascript:(function(){javascript:(function(){
const guid = ([1e7]+-1e3+-4e3+-8e3+-1e11)
.replace(/[018]/g, c=>(c^crypto.getRandomValues(new Uint8Array(1))[0]&15 >> c/4).toString(16));
const q = prompt('Search for:');
if(q){
location.href = `https://www.reddit.com/answers/${guid}?q=${encodeURIComponent(q)}`;
}
})();})();
@david-shepard
david-shepard / redirect-medium-url.js
Created August 21, 2025 23:07
redirect-medium-urls
// ==UserScript==
// @name Redirect Medium Urls
// @namespace https://github.com/push-and-pray-ops
// @version 0.1
// @description Redirect medium urls to freedium ones automatically
// @author https://github.com/david-shepard
// @match https://medium.com/*
// @match https://*.medium.com/*
// @grant none
// ==/UserScript==