Skip to content

Instantly share code, notes, and snippets.

@vikrum
vikrum / ping.11.sh
Last active September 1, 2023 17:00
ping.11.sh
#!/bin/bash
# <xbar.title>ping</xbar.title>
# <xbar.version>v1.1</xbar.version>
# <xbar.author>Trung Đinh Quang, Grant Sherrick and Kent Karlsson</xbar.author>
# <xbar.author.github>thealmightygrant</xbar.author.github>
# <xbar.desc>Sends pings to a range of sites to determine network latency</xbar.desc>
# <xbar.image>http://i.imgur.com/lk3iGat.png?1</xbar.image>
# <xbar.dependencies>ping</xbar.dependencies>
@vikrum
vikrum / newt.sh
Last active August 3, 2026 13:40
worktree helpers
# newt: fresh worktree off origin/main (ignores current branch/dirty state) + cd into it
function newt() {
local toplevel parent repo branch newdir
toplevel=$(git rev-parse --show-toplevel 2>/dev/null) || {
echo "newt: not inside a git repository" >&2
return 1
}
repo=$(basename "$(dirname "$(git rev-parse --path-format=absolute --git-common-dir 2>/dev/null)")")
parent=$(dirname "$toplevel")
branch="$(whoami)-$(date +%s)"