diff --git a/bin/backup_pavilion.sh b/bin/backup_pavilion.sh deleted file mode 100755 index 0ef9398..0000000 --- a/bin/backup_pavilion.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env bash -HOST="pavilion" -DEST="de1103@de1103.rsync.net:borg/borg_${HOST}" -SOURCES="/home /etc /var /data" - -if [ $(hostname -s) != "${HOST}" ]; then - echo "Must be run from ${HOST}" - exit 255 -fi - -echo "Backup to ${DEST}" -sudo borg create --remote-path=borg1 -s --progress "${DEST}::$(date '+%Y%m%d-%H%M')" ${SOURCES} - -echo -echo DONE -echo diff --git a/bin/backup_t420.sh b/bin/backup_t420.sh deleted file mode 100755 index bd7e40a..0000000 --- a/bin/backup_t420.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env bash -HOST="t420" -DEST="de1103@de1103.rsync.net:borg/borg_${HOST}" -SOURCES="/home /etc /var" - -if [ $(hostname -s) != "${HOST}" ]; then - echo "Must be run from ${HOST}" - exit 255 -fi - -echo "Backup to ${DEST}" -sudo borg create --remote-path=borg1 -s --progress "${DEST}::$(date '+%Y%m%d-%H%M')" ${SOURCES} - -echo -echo DONE -echo diff --git a/bin/eachdir b/bin/eachdir deleted file mode 100755 index 4528a24..0000000 --- a/bin/eachdir +++ /dev/null @@ -1,91 +0,0 @@ -#!/usr/bin/env bash - -function _eachdir() { - -if [[ "$1" == "-h" || "$1" == "--help" ]]; then cat <&1 )" - if [[ "$output" ]]; then - # If the command had output, display a header and that output. - echo -e "${h1}${d}${h2}\n$output\n" - else - # Otherwise push it onto an array for later display. - nops=("${nops[@]}" "$d") - fi -done - -# List any dirs that had no output. -if [[ ${#nops[@]} > 0 ]]; then - echo "${h1}no output from${h2}" - for d in "${nops[@]}"; do echo "$d"; done -fi - -} - -# By putting the above code inside a function, if this file is sourced (which -# is required for external aliases/functions to be used as commands), vars -# can be local and return can be used to exit. -_eachdir "$@" diff --git a/bin/git-jump b/bin/git-jump deleted file mode 100755 index 3dbc6b7..0000000 --- a/bin/git-jump +++ /dev/null @@ -1,182 +0,0 @@ -#!/usr/bin/env bash - -function help() { -cat </dev/null - # If the commit was successful, tag it (overwriting any previous tag) - if [[ $? == 0 ]]; then - status="*" - git tag -f "git-jump-$head_sha" >/dev/null - fi - echo "Previous HEAD was $head_sha$status, $(git_commit_subject $head_sha)" -} - -# Restore previously-saved changes -function restore() { - local status="" - # Save current changes before restoring - save - # Attempt to restore saved changes for specified commit - git checkout "git-jump-$1" 2>/dev/null - if [[ $? == 0 ]]; then - # If the restore was successful, figure out exactly what was saved, check - # out the original commit, then restore the saved changes on top of it - status="*" - local patch="$(git format-patch HEAD^ --stdout)" - git checkout HEAD^ 2>/dev/null - echo "$patch" | git apply - - else - # Otherwise, just restore the original commit - git checkout "$1" 2>/dev/null - fi - echo "HEAD is now $1$status, $(git_commit_subject $1)" -} - -# Clean (permanently) current changes and remove the current saved tag -function clean() { - local head_sha=$(git_head_sha) - git tag -d "git-jump-$head_sha" &>/dev/null - if [[ $? == 0 ]]; then - echo "Removed stored data for commit $head_sha." - fi - local repo_root="$(git_repo_toplevel)" - git reset HEAD "$repo_root" >/dev/null - git clean -f -d -q -- "$repo_root" >/dev/null - git checkout -- "$repo_root" >/dev/null - echo "Unstaged changes and untracked files removed." -} - -# Remove (permanently) all saved tags -function clean_all_tags() { - git for-each-ref refs/tags --format='%(refname:short)' | \ - while read tag; do - if [[ "$tag" =~ ^git-jump- ]]; then - git tag -d "$tag" - fi - done -} - -# Jump to next commit -function next() { - local next_sha=$(git_next_sha) - if [[ "$next_sha" == "$(git_head_sha)" ]]; then - # Abort if no more commits - echo "Already at last commit in $git_branch. Congratulations!" - else - # Checkout branch by name if at its HEAD - if [[ "$next_sha" == "$(git_branch_sha)" ]]; then - next_sha="$git_branch" - fi - echo "Jumping ahead to next commit." - restore $next_sha - fi -} - -# Jump to previous commit -function prev() { - local prev_sha=$(git_prev_sha) - if [[ "$prev_sha" == "$(git_head_sha)" ]]; then - # Abort if no more commits - echo "Already at first commit in $git_branch." - else - echo "Jumping back to previous commit." - restore $prev_sha - fi -} - -# Show help if requested -if [[ "$1" == "--help" || "$1" == "-h" ]]; then - help - exit -fi - -# Check if branch is valid -git rev-parse "$git_branch" &>/dev/null -if [[ $? != 0 ]]; then - echo "Error: Branch \"$git_branch\" does not appear to be valid." - echo "Try $(basename "$0") --help for more information." - exit 1 -fi - -# Handle CLI arguments -if [[ "$1" == "next" ]]; then - next -elif [[ "$1" == "prev" ]]; then - prev -elif [[ "$1" == "clean" ]]; then - clean -elif [[ "$1" == "cleanall" ]]; then - clean_all_tags - clean -else - usage - exit 1 -fi diff --git a/bin/gpr b/bin/gpr deleted file mode 100755 index 9fef290..0000000 --- a/bin/gpr +++ /dev/null @@ -1,280 +0,0 @@ -#!/usr/bin/env bash - -function help() { - pr=123 - local_ref=foo - script="$(basename "$0") $pr" - cat </dev/null - git config --global --add gpr.token $token - echo "Authorization successful, token saved." - exit - else - echo "Error authorizing with GitHub, please try again." - exit 5 - fi -fi - -pr="$1"; shift -script="$(basename "$0") $pr" -branch="pr$pr" - -repo="$(git remote show -n origin | perl -ne '/Fetch URL: .*github\.com[:\/](.*\/.*)\.git/ && print $1')" - -# Let's fetch some JSON. -token="$(git config --get gpr.token)" -json="$(curl -fsSL "https://api.github.com/repos/$repo/pulls/$pr?access_token=$token" 2>/dev/null)" -if [[ $? != 0 || ! "$json" ]]; then - echo "Error fetching GitHub API data for $repo PR $pr!" - echo "If you're trying to access a private repo and haven't yet done so, please run" - echo "the \"$(basename "$0") auth\" command to generate a GitHub auth token." - exit 2 -fi - -# Let's parse some JSON. -remote_url="$(node -pe "($json).head.repo.git_url")" -remote_ref="$(node -pe "($json).head.ref")" -local_url="$(node -pe "($json).base.repo.git_url")" -local_ref="$(node -pe "($json).base.ref")" -num_commits="$(node -pe "($json).commits")" - -# Let's get the project's .git folder. -git_dir="$(git rev-parse --show-toplevel)/.git" - -function del_branch() { - if [[ "$(git branch | grep " $1\$")" ]]; then - git checkout "$local_ref" 2>/dev/null - git branch -D "$1" 2>/dev/null - fi -} - -# Use the specified step, otherwise attempt to auto-detect it. -if [[ "$1" ]]; then - step=$1 -elif [[ "$(git branch | grep " $branch-squash\$")" ]]; then - # STEP 3 should never auto-execute twice. - if [[ "$(git branch --contains "$(git rev-parse $branch-squash)" | grep " $local_ref\$")" ]]; then - echo "Error merging branch \"$branch-squash\" into \"$local_ref\" branch! (already done)" - echo - echo "Redo the last step with: $script 3" - exit 4 - fi - step=3 -elif [[ "$(git branch | grep " $branch\$")" ]]; then - step=2 -else - step=1 -fi - -# Let's do some stuff. -if [[ $step == 1 ]]; then - header 1 - - # Clean up any prior work on this PR. - del_branch "$branch" - del_branch "$branch-squash" - - # Fetch remote, create a branch, etc. - if [[ "$remote_url" == "$local_url" ]]; then - git fetch origin "$remote_ref" - else - git fetch "$remote_url" "$remote_ref" - fi - git checkout -b "$branch" FETCH_HEAD - - # Save ref to last PR author commit for later use - git tag --force "_${branch}_author_head" FETCH_HEAD - - # Rebase! - git rebase "$local_ref" - if [[ $? != 0 ]]; then - echo "Error while attempting rebase!" - exit 3 - fi - - echo - echo "Changed files in HEAD~$num_commits:" - git --no-pager diff --name-only HEAD~"$num_commits" - - echo - echo "-=[ Next Steps ]=============================================================-" - echo "$(help_step2 1) with: $script" - echo " Or redo the current step with: $script 1" - -elif [[ $step == 2 ]]; then - header 2 - - # Clean up any prior squashes for this PR. - del_branch "$branch-squash" - - # Create branch and squash merge all commits. - git checkout -b "$branch-squash" "$local_ref" - git merge --squash "$branch" - - # Append useful information to commit message. - squash_msg_file="$git_dir/SQUASH_MSG" - echo -e "\nCloses gh-$pr." >> "$squash_msg_file" - - # Retrieve author name and email from stored commit, and commit. - author="$(git log "_${branch}_author_head" -n1 --format="%an <%ae>")" - git commit --author="$author" - - echo - echo "-=[ Next Steps ]=============================================================-" - echo "$(help_step3 1) with: $script" - echo " Or redo the current step with: $script 2" - -elif [[ $step == 3 ]]; then - header 3 - - # Actually merge squashed commits into branch. - git checkout "$local_ref" - git merge "$branch-squash" - - echo - echo "-=[ Next Steps ]=============================================================-" - echo "$(help_step4 1) with: $script 4" - echo " Or redo the current step with: $script 3" - -elif [[ $step == 4 ]]; then - header 4 - - del_branch "$branch" - del_branch "$branch-squash" - git tag -d "_${branch}_author_head" 2>/dev/null - - echo - echo "All done." -fi diff --git a/bin/install-go-tools.sh b/bin/install-go-tools.sh index 4a60233..b26d313 100755 --- a/bin/install-go-tools.sh +++ b/bin/install-go-tools.sh @@ -1,26 +1,5 @@ #!/bin/sh -# Language Server -go get -u -v golang.org/x/tools/gopls - -# Spacemacs layer requirements -go get -u -v github.com/mdempsky/gocode -go get -u -v github.com/rogpeppe/godef -go get -u -v golang.org/x/tools/cmd/guru -go get -u -v golang.org/x/tools/cmd/gorename -go get -u -v golang.org/x/tools/cmd/goimports -go get -u -v github.com/zmb3/gogetdoc -go get -u -v github.com/cweill/gotests/... -go get -u github.com/haya14busa/gopkgs/cmd/gopkgs -go get -u -v github.com/davidrjenni/reftools/cmd/fillstruct -go get -u github.com/josharian/impl - -# Spacemacs layer optional -go get -u -v github.com/alecthomas/gometalinter -gometalinter --install --update -go get -u -v github.com/godoctor/godoctor -go install github.com/godoctor/godoctor -go get -u -v github.com/fatih/gomodifytags - -# Work uses golang-ci-lint -go get -u -v github.com/golangci/golangci-lint/cmd/golangci-lint +go install golang.org/x/tools/gopls@latest +go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.43.0 +go install mvdan.cc/gofumpt@latest diff --git a/init/30_osx_homebrew_casks.sh b/init/30_osx_homebrew_casks.sh index dfe0a0b..1c605b3 100644 --- a/init/30_osx_homebrew_casks.sh +++ b/init/30_osx_homebrew_casks.sh @@ -9,20 +9,13 @@ casks=( # Applications adoptopenjdk balenaetcher - bitwarden caffeine - cyberduck emacs - emacsclient firefox iterm2 - libreoffice - musicbrainz-picard - nextcloud sublime-merge sublime-text tigervnc-viewer - vlc xquartz ) @@ -31,24 +24,6 @@ casks=($(setdiff "${casks[*]}" "$(brew cask list 2>/dev/null)")) if (( ${#casks[@]} > 0 )); then e_header "Installing Homebrew casks: ${casks[*]}" for cask in "${casks[@]}"; do - brew cask install $cask - done - brew cask cleanup -fi - -# Work around colorPicker symlink issue. -# https://github.com/caskroom/homebrew-cask/issues/7004 -cps=() -for f in ~/Library/ColorPickers/*.colorPicker; do - [[ -L "$f" ]] && cps=("${cps[@]}" "$f") -done - -if (( ${#cps[@]} > 0 )); then - e_header "Fixing colorPicker symlinks" - for f in "${cps[@]}"; do - target="$(readlink "$f")" - e_arrow "$(basename "$f")" - rm "$f" - cp -R "$target" ~/Library/ColorPickers/ + brew install --cask $cask done fi diff --git a/init/30_osx_homebrew_recipes.sh b/init/30_osx_homebrew_recipes.sh index 81bd663..e71ae8d 100644 --- a/init/30_osx_homebrew_recipes.sh +++ b/init/30_osx_homebrew_recipes.sh @@ -19,12 +19,8 @@ recipes=( gnupg gnutls htop - irssi - isync man2html markdownlint - mu - mutt nmap pandoc python @@ -39,26 +35,3 @@ recipes=( ) brew_install_recipes - -# Misc cleanup! - -# This is where brew stores its binary symlinks -local binroot="$(brew --config | awk '/HOMEBREW_PREFIX/ {print $2}')"/bin - -# htop -if [[ "$(type -P $binroot/htop)" ]] && [[ "$(stat -L -f "%Su:%Sg" "$binroot/htop")" != "root:wheel" || ! "$(($(stat -L -f "%DMp" "$binroot/htop") & 4))" ]]; then - e_header "Updating htop permissions" - sudo chown root:wheel "$binroot/htop" - sudo chmod u+s "$binroot/htop" -fi - -# bash -if [[ "$(type -P $binroot/bash)" && "$(cat /etc/shells | grep -q "$binroot/bash")" ]]; then - e_header "Adding $binroot/bash to the list of acceptable shells" - echo "$binroot/bash" | sudo tee -a /etc/shells >/dev/null -fi -if [[ "$(dscl . -read ~ UserShell | awk '{print $2}')" != "$binroot/bash" ]]; then - e_header "Making $binroot/bash your default shell" - sudo chsh -s "$binroot/bash" "$USER" >/dev/null 2>&1 - e_arrow "Please exit and restart all your shells." -fi diff --git a/link/.vim/autoload/plug.vim b/link/.vim/autoload/plug.vim index b6e4cbf..ad95041 100644 --- a/link/.vim/autoload/plug.vim +++ b/link/.vim/autoload/plug.vim @@ -405,7 +405,7 @@ function! plug#end() for [map, names] in items(lod.map) for [mode, map_prefix, key_prefix] in - \ [['i', '', ''], ['n', '', ''], ['v', '', 'gv'], ['o', '', '']] + \ [['i', '', ''], ['n', '', ''], ['v', '', 'gv'], ['o', '', '']] execute printf( \ '%snoremap %s %s:call lod_map(%s, %s, %s, "%s")', \ mode, map, map_prefix, string(map), string(names), mode != 'i', key_prefix) diff --git a/link/.vim/autoload/plug.vim.old b/link/.vim/autoload/plug.vim.old index 6a958cb..b6e4cbf 100644 --- a/link/.vim/autoload/plug.vim.old +++ b/link/.vim/autoload/plug.vim.old @@ -1208,7 +1208,8 @@ function! s:update_impl(pull, force, args) abort normal! 2G silent! redraw - let s:clone_opt = [] + " Set remote name, overriding a possible user git config's clone.defaultRemoteName + let s:clone_opt = ['--origin', 'origin'] if get(g:, 'plug_shallow', 1) call extend(s:clone_opt, ['--depth', '1']) if s:git_version_requirement(1, 7, 10) diff --git a/manual/polybar/config b/manual/polybar/config deleted file mode 100644 index 1d43649..0000000 --- a/manual/polybar/config +++ /dev/null @@ -1,184 +0,0 @@ -[colors] -background = #dedede -background-alt = #444 -foreground = #000000 -foreground-alt = #555 -primary = #ffb52a -secondary = #e60053 -alert = #bd2c40 - -[bar/dct] -width = 100% -height = 27 -fixed-center = true - -background = ${colors.background} -foreground = ${colors.foreground} - -line-size = 3 -line-color = #f00 - -border-size = 1 -border-color = #00000000 - -padding-left = 2 -padding-right = 2 - -module-margin-left = 1 -module-margin-right = 2 - -font-0 = Fira Code:pixelsize=10;1 - -modules-right = date -modules-center = -modules-left = filesystem memory cpu wlan eth battery backlight-acpi pulseaudio - -tray-position = right -tray-padding = 2 -tray-background = #ededed - -[module/filesystem] -type = internal/fs -interval = 25 - -mount-0 = / -#mount-1 = /home -#mount-2 = /data -#mount-3 = /archive - -label-mounted = %{F#0a81f5}%mountpoint%%{F-}: %percentage_used%% -label-unmounted = %mountpoint% not mounted -label-unmounted-foreground = ${colors.foreground-alt} - -[module/xbacklight] -type = internal/xbacklight - -format =