diff --git a/config/iterm2/install b/config/iterm2/install old mode 100644 new mode 100755 diff --git a/config/macos/gitconfig.local b/config/macos/gitconfig.local index 95801f0..63fdc7b 100644 --- a/config/macos/gitconfig.local +++ b/config/macos/gitconfig.local @@ -1,4 +1,12 @@ [gpg] format = ssh [user] - signingkey = /Users/spraints/.ssh/id_ed25519.pub + signingkey = /Users/spraints/.ssh/id_rsa.pub +[commit] + gpgsign = true +[url "git@github.com:"] + insteadOf = https://github.com/ +#[url "git@ghe.io:"] +# insteadOf = https://ghe.io/ +[maintenance] + repo = /Users/spraints/src/github.com/github/spokesd diff --git a/config/nvim/install b/config/nvim/install index 10c3a5d..64410f5 100755 --- a/config/nvim/install +++ b/config/nvim/install @@ -22,6 +22,8 @@ start_dir="$(pwd -P)" curl -LO https://github.com/neovim/neovim/releases/latest/download/nvim.appimage chmod u+x nvim.appimage +# Instead of extracting it, maybe just install fuse? +# https://github.com/AppImage/docs.appimage.org/blob/master/source/user-guide/troubleshooting/fuse.rst#how-to-install-fuse cd / sudo "${start_dir}/nvim.appimage" --appimage-extract rm -f "${start_dir}/nvim.appimage" diff --git a/dotfiles/bin/merge-queue b/dotfiles/bin/merge-queue index 1280c08..f6148fa 100755 --- a/dotfiles/bin/merge-queue +++ b/dotfiles/bin/merge-queue @@ -2,7 +2,7 @@ export RBENV_VERSION=system exec ruby "$0" "$@" #!ruby -#/ Usage: merge-queue OWNER/REPO +#/ Usage: merge-queue [--oneline] OWNER/REPO #/ Shows pretty merge queue for the given repository. require "date" @@ -10,7 +10,7 @@ require "json" require "net/http" require "timeout" -def main(nwo:, token:, user: nil) +def main(nwo:, token:, user: nil, oneline: false) data = query_mq(nwo: nwo, token: token) if errors = data["errors"] p errors @@ -31,7 +31,9 @@ def main(nwo:, token:, user: nil) active_group_ids = mq.fetch("mergingEntries").fetch("edges").map { |edge| edge.fetch("node").fetch("id") } - puts "**", "Also check out: https://heaven.githubapp.com/apps/#{File.basename(nwo)}", "**", "" + unless oneline + puts "**", "Also check out: https://heaven.githubapp.com/apps/#{File.basename(nwo)}", "**", "" + end next_merge_time = mq.fetch("nextEntryEstimatedTimeToMerge") entries = mq.fetch("entries").fetch("edges") @@ -53,9 +55,10 @@ def main(nwo:, token:, user: nil) pr_url = entry.fetch("pullRequest").fetch("url") commit_url = entry.dig("headCommit", "url") - printf "%3d. %s @%s [%d] %s\n %s\n", - position, pretty_state(state), enqueued_by, pr_number, pr_title, pr_url - if state != "MERGEABLE" + printf "%3d. %s @%s [%d] %s\n", + position, pretty_state(state), enqueued_by, pr_number, pr_title + unless oneline + printf " %s\n", pr_url printf " %s\n", commit_url || "(no commit URL)" end end @@ -182,6 +185,8 @@ while arg = ARGV.shift opts[:nwo] = arg when "--user" opts[:user] = ARGV.shift + when "--oneline" + opts[:oneline] = true else usage end diff --git a/dotfiles/bin/tcp-hogs b/dotfiles/bin/tcp-hogs index 83e607f..aa6689f 100755 --- a/dotfiles/bin/tcp-hogs +++ b/dotfiles/bin/tcp-hogs @@ -1,19 +1,34 @@ #!/bin/bash +#/ Usage: tcp-hogs [-n SECONDS] [-i IFACE] +#/ SECONDS defaults to 10. +#/ IFACE defaults to en0. +#/ en0 = wifi on mac laptops. +#/ en8 = usb hub on work laptop. set -e set -o nounset -# on quad: -# en0 is the wifi adapter -# en8 is the usb hub iface=en0 - sec=10 +while [ $# -gt 0 ]; do + case "$1" in + -n) + sec="$2" + shift; shift;; + -i) + iface="$2" + shift; shift;; + *) + cat "$0" | grep "^#/" | cut -c4- + exit 1;; + esac +done + t=${TMPDIR:-/tmp} pcap="${t}/tcp-hogs-$$.pcap" -#trap "test -f ${pcap} && rm -f ${pcap}" EXIT +trap "test -f ${pcap} && (set -x; rm -f ${pcap})" EXIT echo "Capturing packets for ${sec} seconds into ${pcap}..." tcpdumpargs="-G ${sec} -W 1 -w ${pcap}" diff --git a/dotfiles/config/starship.toml b/dotfiles/config/starship.toml index 924bd82..95833eb 100644 --- a/dotfiles/config/starship.toml +++ b/dotfiles/config/starship.toml @@ -1,3 +1,5 @@ +command_timeout = 100 + [[battery.display]] threshold = 30 diff --git a/dotfiles/tmux.conf b/dotfiles/tmux.conf index 1ea9f18..f26a1f7 100644 --- a/dotfiles/tmux.conf +++ b/dotfiles/tmux.conf @@ -11,6 +11,7 @@ bind h select-pane -L bind j select-pane -D bind k select-pane -U bind l select-pane -R +bind -N 'find a window by name' e command-prompt -p 'window name:' 'find-window %%' bind _ clear-history diff --git a/script/archive-quad b/script/archive-quad new file mode 100755 index 0000000..215b83b --- /dev/null +++ b/script/archive-quad @@ -0,0 +1,105 @@ +#!/bin/bash + +set -e +set -o nounset + +# "DRYRUN=false script/archive-quad" to actually run the commands. +DRYRUN="${DRYRUN:-true}" + +TODAY="$(date +%Y-%m-%d)" +ARCHIVE_DIR="${HOME}/archive-${TODAY}" + +echo "Making archives in ${ARCHIVE_DIR}" + +backup() { + local dir="$1"; shift + local dest="${ARCHIVE_DIR}/${dir}.tar.bz2" + mkdir -p "$(dirname "$dest")" + if [ -e "${dir}/.archive-quad-excludes" ]; then + set -- "$@" --exclude-from "${dir}/.archive-quad-excludes" + fi + set -- "$@" --exclude "target" + set -- "$@" --exclude "build" + set -- "$@" --exclude "node_modules" + set -- "$@" --exclude ".bundle" + set -- "$@" --exclude "vendor/cache" + btar "$dir" "$dest" "$@" +} + +backup_home() { + local dir="$1"; shift + local dest="${ARCHIVE_DIR}/homes/${dir}.tar.bz2" + mkdir -p "$(dirname "$dest")" + btar --sudo "$dir" "$dest" "$@" +} + +btar() { + local dir="$1"; shift + local sudo= + if [ "$dir" = "--sudo" ]; then + sudo=sudo + dir="$1"; shift + fi + local dst="$1"; shift + + if [ -f "$dst" ]; then + ls -l "$dst" + elif $DRYRUN; then + echo $sudo tar "$@" -cjf "$dst" "$dir" + else + rm -f "$ARCHIVE_DIR/.tmp" + (set -x; $sudo tar "$@" -cjf "$ARCHIVE_DIR/.tmp" "$dir") + mv "$ARCHIVE_DIR/.tmp" "$dst" + ls -l "$dst" + fi +} + +cd "${HOME}" + +backup Desktop + +backup Documents --exclude Documents/VOI +backup Documents/VOI + +backup Movies + +backup Music/Sonic\ Pi + +for d in src/*; do + case "$(basename "$d")" in + github.com|ghe.io|github.ghe.com) + for dd in $d/*/*; do + case "$(basename "$dd")" in + enterprise2|github|github-bare|heaven|puppet|thehub|zoom) + ;; #skip + *) + backup "$dd" + ;; + esac + done + ;; + experiments|gist*) + for dd in $d/*; do + backup "$dd" + done + ;; + *) + backup "$d" + ;; + esac +done + +for d in dev/*; do + if [ "$d" != "dev/machines.bak" ]; then + backup "$d" + fi +done + +for d in Xcode/*; do + backup "$d" +done + +cd .. +backup_home cassandra +backup_home oliver +backup_home goldenpandas