End of year tidy up
This commit is contained in:
parent
33eff3dbd2
commit
9aa984b3e4
|
@ -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
|
|
@ -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
|
91
bin/eachdir
91
bin/eachdir
|
@ -1,91 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
function _eachdir() {
|
||||
|
||||
if [[ "$1" == "-h" || "$1" == "--help" ]]; then cat <<HELP
|
||||
eachdir
|
||||
http://benalman.com/
|
||||
|
||||
Usage: eachdir [dirs --] commands
|
||||
|
||||
Run one or more commands in one or more dirs.
|
||||
|
||||
By default, all subdirs of the current dir will be iterated over, but if --
|
||||
is specified as an arg, the dirs list will be made up of all args specified
|
||||
before it. All remaining args are the command(s) to be executed for each dir.
|
||||
|
||||
Multiple commands must be specified as a single string argument.
|
||||
|
||||
In bash, aliasing like this allows you to specify aliases/functions:
|
||||
alias eachdir=". eachdir"
|
||||
|
||||
Both of these print the working directory of every subdir of the current dir:
|
||||
eachdir pwd
|
||||
eachdir * -- pwd
|
||||
|
||||
Perform a "git pull" inside all subdirs starting with repo-:
|
||||
eachdir repo-* -- git pull
|
||||
|
||||
Perform a few git-related commands inside all subdirs starting with repo-:
|
||||
eachdir repo-* -- 'git fetch && git merge'
|
||||
|
||||
Copyright (c) 2012 "Cowboy" Ben Alman
|
||||
Licensed under the MIT license.
|
||||
http://benalman.com/about/license/
|
||||
HELP
|
||||
return; fi
|
||||
|
||||
if [ ! "$1" ]; then
|
||||
echo 'You must specify one or more commands to run.'
|
||||
return 1
|
||||
fi
|
||||
|
||||
# For underlining headers.
|
||||
local h1="$(tput smul)"
|
||||
local h2="$(tput rmul)"
|
||||
|
||||
# Store any dirs passed before -- in an array.
|
||||
local dashes d
|
||||
local dirs=()
|
||||
for d in "$@"; do
|
||||
if [[ "$d" == "--" ]]; then
|
||||
dashes=1
|
||||
shift $(( ${#dirs[@]} + 1 ))
|
||||
break
|
||||
fi
|
||||
dirs=("${dirs[@]}" "$d")
|
||||
done
|
||||
|
||||
# If -- wasn't specified, default to all subdirs of the current dir.
|
||||
[[ "$dashes" ]] || dirs=(*/)
|
||||
|
||||
local nops=()
|
||||
# Do stuff for each specified dir, in each dir. Non-dirs are ignored.
|
||||
for d in "${dirs[@]}"; do
|
||||
# Skip non-dirs.
|
||||
[[ ! -d "$d" ]] && continue
|
||||
# If the dir isn't /, strip the trailing /.
|
||||
[[ "$d" != "/" ]] && d="${d%/}"
|
||||
# Execute the command, grabbing all stdout and stderr.
|
||||
output="$( (cd "$d"; eval "$@") 2>&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 "$@"
|
182
bin/git-jump
182
bin/git-jump
|
@ -1,182 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
function help() {
|
||||
cat <<HELP
|
||||
Git Jump (Forward & Back)
|
||||
http://benalman.com/
|
||||
|
||||
Usage: $(basename "$0") [command]
|
||||
|
||||
Commands:
|
||||
next Jump forward to the next commit in this branch
|
||||
prev Jump backward to the next commit in this branch
|
||||
clean Remove current unstaged changes/untracked files**
|
||||
cleanall Remove all saved tags, unstaged changes and untracked files**
|
||||
|
||||
** This action is destructive and cannot be undone!
|
||||
|
||||
Git config:
|
||||
git-jump.branch Branch to jump through. If not set, defaults to master
|
||||
|
||||
Description:
|
||||
"Replay" Git commits by moving forward / backward through a branch's
|
||||
history. Before jumping, any current unstaged changes and untracked
|
||||
files are saved in a tag for later retrieval, which is restored when
|
||||
jumped back to.
|
||||
|
||||
Copyright (c) 2014 "Cowboy" Ben Alman
|
||||
Licensed under the MIT license.
|
||||
http://benalman.com/about/license/
|
||||
HELP
|
||||
}
|
||||
|
||||
function usage() {
|
||||
echo "Usage: $(basename "$0") [next | prev | clean | cleanall]"
|
||||
}
|
||||
|
||||
# Get branch stored in Git config or default to master
|
||||
git_branch="$(git config git-jump.branch || echo "master")"
|
||||
|
||||
# Get some (short) SHAs
|
||||
function git_branch_sha() {
|
||||
git rev-parse --short "$git_branch"
|
||||
}
|
||||
function git_head_sha() {
|
||||
git rev-parse --short HEAD
|
||||
}
|
||||
function git_prev_sha() {
|
||||
git log --format='%h' "$git_branch" "$@" | awk "/^$(git_head_sha)/{getline; print}"
|
||||
}
|
||||
function git_next_sha() {
|
||||
git_prev_sha --reverse
|
||||
}
|
||||
|
||||
# Get absolute path to root of Git repo
|
||||
function git_repo_toplevel() {
|
||||
git rev-parse --show-toplevel
|
||||
}
|
||||
|
||||
# Get subject of specified commit
|
||||
function git_commit_subject() {
|
||||
git log --format='%s' -n 1 $1
|
||||
}
|
||||
|
||||
# Save changes for later retrieval
|
||||
function save() {
|
||||
local status=""
|
||||
local head_sha=$(git_head_sha)
|
||||
# Checkout current HEAD by SHA to force detached state
|
||||
git checkout -q $head_sha
|
||||
# Add all files in repo
|
||||
git add "$(git_repo_toplevel)"
|
||||
# Commit changes (if there were any)
|
||||
git commit --no-verify -m "Git Jump: saved changes for $head_sha" >/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
|
280
bin/gpr
280
bin/gpr
|
@ -1,280 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
function help() {
|
||||
pr=123
|
||||
local_ref=foo
|
||||
script="$(basename "$0") $pr"
|
||||
cat <<HELP
|
||||
-=[ GitHub Pull Request Helper - "Cowboy" Ben Alman - http://benalman.com/ ]=-
|
||||
|
||||
Usage: $(basename "$0") pull_request_id [ step ]
|
||||
|
||||
-=[ Description ]============================================================-
|
||||
|
||||
The "step" argument can be used to force execution of a particular step,
|
||||
but by default this script will automatically choose the next step, from
|
||||
STEP 1 to STEP 2 and finally to STEP 3. You'll have to execute STEP 4
|
||||
manually, once everything is done.
|
||||
|
||||
-=[ Detailed workflow example ]==============================================-
|
||||
|
||||
For this example, assume PR $pr has been filed against the "$local_ref" branch.
|
||||
|
||||
-=[ STEP 1 ]=-
|
||||
|
||||
You run "$script" and this executes:
|
||||
|
||||
$(help_step1)
|
||||
|
||||
-=[ STEP 2 ]=-
|
||||
|
||||
You run "$script" and this executes:
|
||||
|
||||
$(help_step2)
|
||||
|
||||
-=[ STEP 3 ]=-
|
||||
|
||||
You run "$script" and this executes:
|
||||
|
||||
$(help_step3)
|
||||
|
||||
-=[ STEP 4 ]=-
|
||||
|
||||
You run "$script 4" (explicitly specifying the 4) and this executes:
|
||||
|
||||
$(help_step4)
|
||||
|
||||
-=[ Very important notes ]===================================================-
|
||||
|
||||
Before running this script, ensure that your local "$local_ref" branch is
|
||||
up-to-date!
|
||||
|
||||
At the beginning of STEP 1, any existing "pr$pr" and "pr$pr-squash"
|
||||
branches will be deleted.
|
||||
|
||||
At the beginning of STEP 2, any existing pr$pr-squash" branch will be
|
||||
deleted.
|
||||
|
||||
If you want to hide per-step explanations, set ENV var GPR_SHH=1. For
|
||||
example, create an alias like: alias gpr='GPR_SHH=1 gpr'
|
||||
|
||||
-=[ License ]================================================================-
|
||||
|
||||
Copyright (c) 2012 "Cowboy" Ben Alman
|
||||
Licensed under the MIT license.
|
||||
http://benalman.com/about/license/
|
||||
HELP
|
||||
[[ "$1" ]]; exit
|
||||
}
|
||||
|
||||
function help_step1() {
|
||||
echo " Fetch and rebase PR $pr into \"pr$pr\" branch"
|
||||
[[ "$1" ]] && return
|
||||
cat <<HELP
|
||||
1. Fetch the repo and branch associated with PR $pr.
|
||||
2. Checkout a new "pr$pr" branch at the HEAD of the fetched branch.
|
||||
3. Rebase "$local_ref" branch onto "pr$pr" branch.
|
||||
4. Display a list of files changed in the PR.
|
||||
|
||||
Note that you may need to resolve conflicts. If the rebase is successful,
|
||||
test the PR and commit fixes. Commit as many times as necessary; It doesn't
|
||||
matter because all PR-related commits will be squash merged in STEP 2.
|
||||
HELP
|
||||
}
|
||||
|
||||
function help_step2() {
|
||||
echo " Perform squash merge into \"pr$pr-squash\" branch"
|
||||
[[ "$1" ]] && return
|
||||
cat <<HELP
|
||||
1. Checkout a new "pr$pr-squash" branch from "$local_ref" branch.
|
||||
2. Squash merge "pr$pr" branch into "pr$pr-squash" branch. (no commit)
|
||||
3. Append "Closes gh-$pr." to SQUASH_MSG.
|
||||
4. Commit using the PR branch's HEAD author name.
|
||||
|
||||
Since all the commits in the PR have been squashed into one commit, you will
|
||||
need to edit the commit message. When done, inspect the commit log, ensuring
|
||||
everything is perfect; you should see a single, beautiful commit.
|
||||
HELP
|
||||
}
|
||||
|
||||
function help_step3() {
|
||||
echo " Perform final merge into \"$local_ref\" branch"
|
||||
[[ "$1" ]] && return
|
||||
cat <<HELP
|
||||
1. Checkout "$local_ref" branch.
|
||||
2. Merge "$pr-squash" branch into "$local_ref" branch.
|
||||
|
||||
If STEP 2 was successful, there should be no conflicts here. If there are,
|
||||
you're doing it wrong. Just double-check the commit log and push when done.
|
||||
HELP
|
||||
}
|
||||
|
||||
function help_step4() {
|
||||
echo " Cleanup temporary branches and tags"
|
||||
[[ "$1" ]] && return
|
||||
cat <<HELP
|
||||
1. Temporary "pr$pr" and "pr$pr-squash" branches are deleted.
|
||||
2. Temporary "_pr${pr}_author_head" tag is deleted.
|
||||
HELP
|
||||
}
|
||||
|
||||
function header() {
|
||||
if [[ "$GPR_SHH" ]]; then
|
||||
echo "-=[ STEP $1 ]=================================================================-"
|
||||
else
|
||||
echo "-=[ STEP $1 Overview ]========================================================-"
|
||||
help_step$1
|
||||
echo
|
||||
echo "-=[ Actual ]=================================================================-"
|
||||
fi
|
||||
}
|
||||
|
||||
[[ ! "$1" || "$1" == "-h" || "$1" == "--help" ]] && help $1
|
||||
|
||||
# Generate and store an OAUTH token.
|
||||
if [[ "$1" == "auth" ]]; then
|
||||
read -p 'Enter GitHub username: '
|
||||
json="$(curl -fsSL --data '{"note":"gpr","scopes":["repo"]}' https://api.github.com/authorizations -u "$REPLY")"
|
||||
if [[ "$json" ]]; then
|
||||
token="$(node -pe "($json).token")"
|
||||
git config --global --remove-section gpr 2>/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
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -405,7 +405,7 @@ function! plug#end()
|
|||
|
||||
for [map, names] in items(lod.map)
|
||||
for [mode, map_prefix, key_prefix] in
|
||||
\ [['i', '<C-O>', ''], ['n', '', ''], ['v', '', 'gv'], ['o', '', '']]
|
||||
\ [['i', '<C-\><C-O>', ''], ['n', '', ''], ['v', '', 'gv'], ['o', '', '']]
|
||||
execute printf(
|
||||
\ '%snoremap <silent> %s %s:<C-U>call <SID>lod_map(%s, %s, %s, "%s")<CR>',
|
||||
\ mode, map, map_prefix, string(map), string(names), mode != 'i', key_prefix)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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 = <label> <bar>
|
||||
label = BL
|
||||
|
||||
bar-width = 10
|
||||
bar-indicator = |
|
||||
bar-indicator-foreground = #fff
|
||||
bar-indicator-font = 2
|
||||
bar-fill = ─
|
||||
bar-fill-font = 2
|
||||
bar-fill-foreground = #9f78e1
|
||||
bar-empty = ─
|
||||
bar-empty-font = 2
|
||||
bar-empty-foreground = ${colors.foreground-alt}
|
||||
|
||||
[module/backlight-acpi]
|
||||
inherit = module/xbacklight
|
||||
type = internal/backlight
|
||||
card = intel_backlight
|
||||
|
||||
[module/cpu]
|
||||
type = internal/cpu
|
||||
interval = 2
|
||||
format-prefix = "CPU "
|
||||
format-prefix-foreground = ${colors.foreground-alt}
|
||||
format-underline = #f90000
|
||||
label = %percentage:2%%
|
||||
|
||||
[module/memory]
|
||||
type = internal/memory
|
||||
interval = 2
|
||||
format-prefix = "MEM "
|
||||
format-prefix-foreground = ${colors.foreground-alt}
|
||||
format-underline = #4bffdc
|
||||
label = %percentage_used%%
|
||||
|
||||
[module/wlan]
|
||||
type = internal/network
|
||||
interface = wlp3s0
|
||||
interval = 3.0
|
||||
|
||||
format-connected = <ramp-signal> <label-connected>
|
||||
format-connected-underline = #9f78e1
|
||||
label-connected = %essid%
|
||||
|
||||
format-disconnected =
|
||||
;format-disconnected = <label-disconnected>
|
||||
;format-disconnected-underline = ${self.format-connected-underline}
|
||||
;label-disconnected = %ifname% disconnected
|
||||
;label-disconnected-foreground = ${colors.foreground-alt}
|
||||
|
||||
ramp-signal-0 = *
|
||||
ramp-signal-1 = **
|
||||
ramp-signal-2 = ***
|
||||
ramp-signal-3 = ****
|
||||
ramp-signal-4 = *****
|
||||
ramp-signal-foreground = ${colors.foreground-alt}
|
||||
|
||||
[module/eth]
|
||||
type = internal/network
|
||||
interface = eth0
|
||||
interval = 3.0
|
||||
|
||||
format-connected-underline = #55aa55
|
||||
format-connected-prefix = "LAN "
|
||||
format-connected-prefix-foreground = ${colors.foreground-alt}
|
||||
label-connected = %local_ip%
|
||||
|
||||
format-disconnected = <label-disconnected>
|
||||
format-disconnected-underline = ${self.format-connected-underline}
|
||||
label-disconnected = %ifname% disconnected
|
||||
label-disconnected-foreground = ${colors.foreground-alt}
|
||||
|
||||
[module/date]
|
||||
type = internal/date
|
||||
interval = 5
|
||||
date = "%Y-%m-%d"
|
||||
time = %H:%M
|
||||
label = %date% %time%
|
||||
|
||||
[module/pulseaudio]
|
||||
type = internal/pulseaudio
|
||||
|
||||
format-volume = <label-volume> <bar-volume>
|
||||
label-volume = VOL %percentage%%
|
||||
label-volume-foreground = ${root.foreground}
|
||||
|
||||
label-muted = muted
|
||||
label-muted-foreground = #666
|
||||
|
||||
bar-volume-width = 10
|
||||
bar-volume-foreground-0 = #55aa55
|
||||
bar-volume-foreground-1 = #55aa55
|
||||
bar-volume-foreground-2 = #55aa55
|
||||
bar-volume-foreground-3 = #55aa55
|
||||
bar-volume-foreground-4 = #55aa55
|
||||
bar-volume-foreground-5 = #f5a70a
|
||||
bar-volume-foreground-6 = #ff5555
|
||||
bar-volume-gradient = false
|
||||
bar-volume-indicator = |
|
||||
bar-volume-indicator-font = 2
|
||||
bar-volume-fill = ─
|
||||
bar-volume-fill-font = 2
|
||||
bar-volume-empty = ─
|
||||
bar-volume-empty-font = 2
|
||||
bar-volume-empty-foreground = ${colors.foreground-alt}
|
||||
|
||||
[module/battery]
|
||||
type = internal/battery
|
||||
battery = BAT0
|
||||
adapter = AC
|
||||
full-at = 98
|
||||
|
||||
format-charging = AC <label-charging>
|
||||
format-charging-underline = #ffb52a
|
||||
|
||||
format-discharging = BAT <label-discharging>
|
||||
format-discharging-underline = ${self.format-charging-underline}
|
||||
|
||||
format-full-prefix-foreground = ${colors.foreground-alt}
|
||||
format-full-underline = ${self.format-charging-underline}
|
||||
|
||||
[settings]
|
||||
screenchange-reload = true
|
||||
|
||||
[global/wm]
|
||||
margin-top = 5
|
||||
margin-bottom = 5
|
||||
|
||||
; vim:ft=dosini
|
|
@ -0,0 +1,3 @@
|
|||
if command -v keychain &> /dev/null; then
|
||||
eval $(keychain --eval --agents ssh id_rsa)
|
||||
fi
|
|
@ -1,6 +1,8 @@
|
|||
alias sdf="mosh dctrud@iceland.sdf.org -- tmux a"
|
||||
alias sdf-new"=mosh dctrud@iceland.sdf.org -- tmux"
|
||||
alias sdfnew="mosh dctrud@iceland.sdf.org -- tmux"
|
||||
|
||||
alias petroc="mosh dctrud@petroc.randomroad.net -- tmux a"
|
||||
alias petroc-new="mosh dctrud@petroc.randomroad.net -- tmux"
|
||||
alias club="mosh dctrud@tilde.club -- tmux a"
|
||||
alias clubnew="mosh dctrud@tilde.club -- tmux"
|
||||
|
||||
alias rr="mosh ubuntu@randomroad.net -- tmux a"
|
||||
alias rrnew="mosh ubuntu@petroc.randomroad.net -- tmux"
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
if [[ -n "$IS_WSL" || -n "$WSL_DISTRO_NAME" ]]; then
|
||||
eval $(keychain --eval --agents ssh id_rsa)
|
||||
fi
|
|
@ -1,22 +0,0 @@
|
|||
if test -d "$HOME/.guix-profile"
|
||||
set -x GUIX_PROFILE "$HOME/.guix-profile"
|
||||
set -x GUIX_EXTRA_PROFILES "$HOME/.guix-extra-profiles"
|
||||
source "$GUIX_PROFILE/etc/profile"
|
||||
end
|
||||
|
||||
|
||||
function aprofile
|
||||
|
||||
echo "Activating profile $1..."
|
||||
|
||||
set profile "$GUIX_EXTRA_PROFILES/$1/$1"
|
||||
|
||||
if test -f "$profile/etc/profile"
|
||||
set GUIX_PROFILE "$profile"
|
||||
source "$GUIX_PROFILE/etc/profile"
|
||||
else
|
||||
echo "Profile $1 does not exist"
|
||||
end
|
||||
|
||||
end
|
||||
|
|
@ -2,4 +2,4 @@
|
|||
|
||||
set -x EDITOR 'emacsclient -c --alternate-editor=vim'
|
||||
set -x VISUAL "$EDITOR"
|
||||
alias q="$EDITOR"
|
||||
alias e="$EDITOR"
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
#if test -d "$HOME/.local/share/flatpak"
|
||||
# set -x XDG_DATA_DIRS $XDG_DATA_DIRS "$HOME/.local/share/flatpak/exports/share"
|
||||
#end
|
||||
#
|
||||
#if test -d "/var/lib/flatpak/exports/share"
|
||||
# set -x XDG_DATA_DIRS $XDG_DATA_DIRS "/var/lib/flatpak/exports/share"
|
||||
#end
|
||||
|
|
@ -2,6 +2,10 @@ if test -d "/opt/go"
|
|||
set -x PATH "/opt/go/bin" $PATH
|
||||
end
|
||||
|
||||
if test -f "/usr/local/go"
|
||||
set -x PATH "/usr/local/go/bin" $PATH
|
||||
end
|
||||
|
||||
# If go is installed in ~/Apps/go use it there
|
||||
# put at start of PATH to override system go
|
||||
if test -d "$HOME/Apps/go"
|
||||
|
@ -11,5 +15,3 @@ end
|
|||
# Now setup the GOPATH
|
||||
set -x GOPATH "$HOME/go"
|
||||
set -x PATH "$GOPATH/bin" $PATH
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
if type -q keychain
|
||||
eval keychain --inherit any --eval --agents ssh id_rsa
|
||||
end
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
alias sdf="mosh dctrud@iceland.sdf.org -- tmux a"
|
||||
alias sdfnew="mosh dctrud@iceland.sdf.org -- tmux"
|
||||
|
||||
alias club="mosh dctrud@tilde.club -- tmux a"
|
||||
alias clubnew="mosh dctrud@tilde.club -- tmux"
|
||||
|
||||
alias rr="mosh ubuntu@randomroad.net -- tmux a"
|
||||
alias rrnew="mosh ubuntu@petroc.randomroad.net -- tmux"
|
Loading…
Reference in New Issue