Skip to content

Instantly share code, notes, and snippets.

@dafydd
dafydd / .vimrc
Last active March 6, 2026 21:18
.vimrc
" syntax on.
" show existing tab with 4 spaces width
set tabstop=4
" when indenting with '>', use 4 spaces width
set shiftwidth=4
" On pressing tab, insert 4 spaces
set expandtab
@dafydd
dafydd / setup.sh
Last active February 24, 2026 16:22
provision a new Mac OS/Linux account with sane options (one-liner)
curl -fsSL https://gist.githubusercontent.com/dafydd/61c8692caf432189655dc2051008ec0e/raw -o deploy.sh && chmod +x deploy.sh
#!/usr/bin/env sh
set -eu
BASE="https://gist.githubusercontent.com/dafydd"
BINDIR="$HOME/bin"
ADDENDUMLINE="source $BINDIR/.shell-addendum"
umask 077
mkdir -p "$BINDIR"
#-- addendum
export PATH="$HOME/bin:$PATH"
#open will open working dirs implicitly
o() {
if [ $# -eq 0 ]; then
open .
else
open "$@"
@dafydd
dafydd / stt
Created August 30, 2025 15:54
short machine status
#!/usr/bin/env bash
#ssum: machine status report
UNAME=`uname`
if [ 'Linux' == "$UNAME" ]
then
MACHINE=`hostname`
OSVERSION=`cat /etc/issue`
IP=`hostname --all-ip-addresses`
fi
@dafydd
dafydd / gitcon
Last active August 30, 2025 15:49
find out if our git repos are behind and likely merge statuses
#!/usr/bin/env python3
"""
Scan repos for "behind upstream" status (i.e. you need to catch up).
Optionally hints whether a merge would likely be clean (no working tree changes).
Usage:
./gitcon # scans ~/code
./gitcon /path/to/src # scan a different base directory
"""
@dafydd
dafydd / rscan
Last active February 24, 2026 14:08
find out what's not checked in and what's not pushed
#!/usr/bin/env python3
import os
import subprocess
def find_git_repos_with_unpushed_commits(base_dir):
messages = []
for root, dirs, files in os.walk(base_dir):
if '.git' in dirs:
repo_dir = root
try:
@dafydd
dafydd / .aliases
Last active March 6, 2026 22:19
shortcuts
#frequent
alias c="clear;pwd;echo;ls;echo;"
alias e="exit"
alias m="more"
alias sc="cat ~/.aliases"
alias u="cd .."
alias u2="cd ../.."
alias u3="cd ../../.."
alias lsa='ls -la --si'
alias l='ls -la --si'