Dotfile updates

This commit is contained in:
Max Bucknell 2021-09-03 00:39:08 +10:00
parent 96a5b8ca84
commit 1ed733e18e
15 changed files with 55 additions and 214 deletions

3
bin/ogyarn Executable file
View file

@ -0,0 +1,3 @@
#! /usr/bin/env bash
/usr/local/bin/yarn "$@"

View file

@ -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

View file

@ -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
}

0
boop/entity-id.js Normal file
View file

23
boop/timeslice.js Normal file
View file

@ -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))
}

View file

@ -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"

View file

@ -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

View file

@ -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

View file

@ -1,7 +0,0 @@
# nice_hostname
#
# Take the first part of the hostname.
function nice_hostname
hostname | cut -d . -f 1
end

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -15,6 +15,7 @@
*.swp
GoToFile
.idea
.pick_index

View file

@ -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:

View file

@ -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