diff --git a/bin/ogyarn b/bin/ogyarn new file mode 100755 index 0000000..29f9124 --- /dev/null +++ b/bin/ogyarn @@ -0,0 +1,3 @@ +#! /usr/bin/env bash + +/usr/local/bin/yarn "$@" diff --git a/bin/serve b/bin/serve index b556b8f..9f3204d 100755 --- a/bin/serve +++ b/bin/serve @@ -4,7 +4,7 @@ function main { local arg="${1:-.}" local path="$(cd $arg;pwd)" - docker run --rm -v "$path:/usr/share/nginx/html" -p "80:80" nginx:alpine + docker run --rm -v "$path:/usr/share/nginx/html" -p "1337:80" nginx:alpine } main $1 diff --git a/bin/yarn b/bin/yarn index d00bab3..65a368b 100755 --- a/bin/yarn +++ b/bin/yarn @@ -3,11 +3,14 @@ set -euo pipefail function main { - if findup "WORKSPACE" + local w=$(dirname $(findup WORKSPACE)) + local p=$(dirname $(findup package.json)) + + if [ "$w" == "$p" ] then bazelisk run @nodejs//:yarn -- "$@" else - yarn "$@" + /usr/local/bin/yarn "$@" fi } diff --git a/boop/entity-id.js b/boop/entity-id.js new file mode 100644 index 0000000..e69de29 diff --git a/boop/timeslice.js b/boop/timeslice.js new file mode 100644 index 0000000..fdc9c4d --- /dev/null +++ b/boop/timeslice.js @@ -0,0 +1,23 @@ +/** + { + "api":1, + "name":"Generate Time Slice", + "description":"Convert a date into a timeslice of that day.", + "author":"Max Bucknell", + "icon":"quote", + "tags":"baseup,timeslice" + } +**/ + +function main(state) { + const timestamp = Date.parse(state.selection) / 1000 + const timeslice = { + startTimestamp: timestamp, + endTimestamp: timestamp + 86340, + dailyStartTime: 0, + dailyEndTime: 86340, + restrictToDays: 'MTWTFSS' + } + + state.insert(JSON.stringify(timeslice, null, 4)) +} diff --git a/fish/config.fish b/fish/config.fish deleted file mode 100644 index 0bc8b5c..0000000 --- a/fish/config.fish +++ /dev/null @@ -1,76 +0,0 @@ -# Default path -set PATH /sbin -set PATH /usr/sbin $PATH -set PATH /bin $PATH -set PATH /usr/bin $PATH -set PATH /usr/local/sbin $PATH -set PATH /usr/local/bin $PATH - -# MacGPG -set PATH /usr/local/MacGPG2/bin $PATH - -# Ruby -set RUBY_VERSION (ruby --version | cut -d " " -f 2 | cut -d "p" -f 1) -set PATH "/usr/local/Cellar/ruby/$RUBY_VERSION/bin" $PATH - -# LaTeX! -set PATH /usr/texbin $PATH - -# Local path -set PATH ~/.config/bin $PATH - -# Composer (PHP) -set PATH ~/.composer/vendor/bin $PATH - -# Atom -set PATH $PATH /opt/homebrew-cask/Caskroom/atom/latest/Atom.app/Contents/Resources/app/apm/node_modules/atom-package-manager/bin/apm - -# DYLD_LIBRARY_PATH (Rust asked for this) -set DYLD_LIBRARY_PATH "/usr/local/lib" "$DYLD_LIBRARY_PATH" - -# For GitHub integration. -# See github.com/github/hub -alias git hub - -# Remove the greeting message on startup -set fish_greeting - -# Stop less clearing the screen when it quits -alias less "less -X" -alias man "man -P \"less -isX\"" - -# Make my bloody directories -alias mkdir "mkdir -p" - -# Make sl run ls afterwards -alias sl "/usr/local/bin/sl; and ls" - -# SSH Agent -# -# Start SSH Agent if it's not already running, and add the -# id_(nice_hostname) identity. -setenv SSH_ENV "$HOME/.ssh/environment" -if [ -n "$SSH_AGENT_PID" ] - ps -ef | grep $SSH_AGENT_PID | grep ssh-agent > /dev/null - if [ $status -eq 0 ] - test_identities - end -else - if [ -f $SSH_ENV ] - . $SSH_ENV > /dev/null - end - ps -ef | grep $SSH_AGENT_PID | grep -v grep | grep ssh-agent > /dev/null - if [ $status -eq 0 ] - test_identities - else - start_agent - end -end - - -# Fish colour customisations -set fish_color_autosuggestion "-o" "black" -set fish_color_command "-o" "cyan" -set fish_color_param "cyan" -set fish_color_error "red" - diff --git a/fish/functions/fish_prompt.fish b/fish/functions/fish_prompt.fish deleted file mode 100755 index 9d1b37c..0000000 --- a/fish/functions/fish_prompt.fish +++ /dev/null @@ -1,69 +0,0 @@ -# Fish prompt -# Looks like: user@host in cwd(branch) -function fish_prompt - - # Reset button - set_color normal - - # Username - - # Show root user as red, to remind us of danger. - if test (whoami) = root - set_color red - else - set_color yellow - end - - echo -n (whoami) - - # Connecting pieces ("@", "in", "(", ")") are black. - set_color normal - set_color -o black - - echo -n @ - - # Hostname - - # To remove boldness - set_color normal - set_color blue - - echo -n (nice_hostname) - - set_color normal - set_color -o black - - echo -n " in " - - # Current working dir - - set_color normal - set_color red - - echo -n (pwd | rev | cut -d "/" -f 1 | rev) - - set_color normal - set_color -o black - - # Git branch - - set branch (git_branch) - if not test -z $branch - echo -n "(" - - set_color normal - set_color green - - echo -n "$branch" - - set_color normal - set_color -o black - - echo -n ")" - end - - echo "" - echo -n "→ " - - set_color normal -end diff --git a/fish/functions/git_branch.fish b/fish/functions/git_branch.fish deleted file mode 100644 index 8d73dbb..0000000 --- a/fish/functions/git_branch.fish +++ /dev/null @@ -1,18 +0,0 @@ -# Get the current git branch -# -# If we are not in a git repository, we silently ruturn noting. -function git_branch - set __git_branch (git current-branch ^ /dev/null) - - if test -z $__git_branch - return - else if test $__git_branch = HEAD - set __rev (git log -1 --oneline ^ /dev/null) - if not test -z $__rev - echo -n (git log -1 --oneline | cut -d " " -f 1) - end - else - echo -n $__git_branch - end -end - diff --git a/fish/functions/nice_hostname.fish b/fish/functions/nice_hostname.fish deleted file mode 100644 index a212e3b..0000000 --- a/fish/functions/nice_hostname.fish +++ /dev/null @@ -1,7 +0,0 @@ -# nice_hostname -# -# Take the first part of the hostname. -function nice_hostname - hostname | cut -d . -f 1 -end - diff --git a/fish/functions/start_agent.fish b/fish/functions/start_agent.fish deleted file mode 100644 index dabce3b..0000000 --- a/fish/functions/start_agent.fish +++ /dev/null @@ -1,10 +0,0 @@ -# Start SSH Agent and set relevant variables -function start_agent - echo "Initializing new SSH agent ..." - ssh-agent -c | sed 's/^echo/#echo/' > $SSH_ENV - echo "succeeded" - chmod 600 $SSH_ENV - . $SSH_ENV > /dev/null - ssh-add ~/.ssh/id_(nice_hostname) -end - diff --git a/fish/functions/test_identities.fish b/fish/functions/test_identities.fish deleted file mode 100644 index b7db800..0000000 --- a/fish/functions/test_identities.fish +++ /dev/null @@ -1,11 +0,0 @@ -# Add my SSH identity -function test_identities - ssh-add -l | grep "The agent has no identities" > /dev/null - if [ $status -eq 0 ] - ssh-add "~/.ssh/id_(nice_hostname)" - if [ $status -eq 2 ] - start_agent - end - end -end - diff --git a/git/gitconfig.symlink b/git/gitconfig.symlink index 1599acf..99a3f6e 100644 --- a/git/gitconfig.symlink +++ b/git/gitconfig.symlink @@ -5,8 +5,8 @@ fileMode = false [user] - name = Max Bucknell - email = me@maxbucknell.com + name = Max Bucknell + email = me@maxbucknell.com [alias] dc = diff --staged @@ -26,6 +26,7 @@ uu = !max-set-upstream whodunnit = blame peek = log -1 + wip = commit -m 'wip' --no-verify [color] ui = auto diff --git a/git/gitignore.symlink b/git/gitignore.symlink index badd6f9..f60bcf5 100644 --- a/git/gitignore.symlink +++ b/git/gitignore.symlink @@ -15,6 +15,7 @@ *.swp GoToFile + .idea .pick_index diff --git a/liquidprompt/liquidpromptrc.symlink b/liquidprompt/liquidpromptrc.symlink index 6139935..65524f4 100644 --- a/liquidprompt/liquidpromptrc.symlink +++ b/liquidprompt/liquidpromptrc.symlink @@ -162,23 +162,20 @@ LP_DISABLED_VCS_PATH="" # Colors -LP_COLOR_MARK="$BLACK" -LP_COLOR_USER_LOGGED="$BLACK" -LP_COLOR_TIME="$BLACK" +LP_COLOR_MARK="" +LP_COLOR_USER_LOGGED="" +LP_COLOR_TIME="" LP_COLOR_WRITE="$GREEN" LP_COLOR_NOWRITE="$RED" LP_MARK_DEFAULT="$" LP_MARK_LOAD="" -LP_MARK_BRACKET_OPEN="${BLACK}[${BLACK}" -LP_MARK_BRACKET_CLOSE="${BLACK}]${BLACK}" -LP_MARK_PERM="${BLACK}:${BLACK}" -LP_COLOR_UP="$BLACK" -LP_COLOR_COMMITS="$BLACK" -LP_COLOR_CHANGES="$BLACK" +LP_COLOR_UP="" +LP_COLOR_COMMITS="" +LP_COLOR_CHANGES="" -LP_COLOR_PATH="${BLACK}" +LP_COLOR_PATH="" # vim: set et sts=4 sw=4 tw=120 ft=sh: diff --git a/zsh/zshrc.symlink b/zsh/zshrc.symlink index 3f87870..7bad2c4 100644 --- a/zsh/zshrc.symlink +++ b/zsh/zshrc.symlink @@ -21,7 +21,7 @@ PATH="$HOME/.composer/vendor/bin:$PATH" export COMPOSER_HOME="$HOME/.composer" # Ruby -PATH="/usr/local/opt/ruby/bin:/usr/local/lib/ruby/gems/2.6.0/bin:$PATH" +PATH="/usr/local/opt/ruby/bin:/usr/local/lib/ruby/gems/2.7.0/bin:$PATH" # Python export PYTHONPATH="$PYTHONPATH:$HOME/dotfiles/lib/python" @@ -42,6 +42,12 @@ PATH="$HOME/dotfiles/bin/misc:$PATH" PATH="$HOME/dotfiles/bin:$PATH" PATH="$HOME/bin:$PATH" +# The next line updates PATH for the Google Cloud SDK. +if [ -f '/Users/maxbucknell/google-cloud-sdk/path.zsh.inc' ]; then . '/Users/maxbucknell/google-cloud-sdk/path.zsh.inc'; fi + +# The next line enables shell command completion for gcloud. +if [ -f '/Users/maxbucknell/google-cloud-sdk/completion.zsh.inc' ]; then . '/Users/maxbucknell/google-cloud-sdk/completion.zsh.inc'; fi + ## Completion # Load up the extra Z Shell completions @@ -87,7 +93,7 @@ ZSH_HIGHLIGHT_STYLES[assign]='none' ZSH_HIGHLIGHT_STYLES[default]='none' # Set editor -export EDITOR="/usr/local/bin/nvim" +export EDITOR="/usr/local/bin/nova" # Get the first part of the hostname # @@ -168,7 +174,7 @@ setopt extended_history setopt hist_lex_words # Liquid Prompt! -source "$HOME/.zsh/liquidprompt/liquidprompt" +[[ $- = *i* ]] && source "$HOME/.zsh/liquidprompt/liquidprompt" # Vim! alias vim=nvim @@ -182,6 +188,9 @@ alias ls=exa # Bat! alias cat='bat --theme=GitHub' +# Bazel -__- +alias bazel='bazelisk' + # Use fzf to select a running tmux session to attach to function select_session_interactive { tmux list-sessions 2> /dev/null | @@ -219,9 +228,4 @@ function select_session { # select_session -# The next line updates PATH for the Google Cloud SDK. -if [ -f '/Users/maxbucknell/google-cloud-sdk/path.zsh.inc' ]; then . '/Users/maxbucknell/google-cloud-sdk/path.zsh.inc'; fi - -# The next line enables shell command completion for gcloud. -if [ -f '/Users/maxbucknell/google-cloud-sdk/completion.zsh.inc' ]; then . '/Users/maxbucknell/google-cloud-sdk/completion.zsh.inc'; fi