Compare commits

...

15 Commits

Author SHA1 Message Date
Ismo Vuorinen
9c05733b5d zsh: Starship config, removed rb and py bundles 2023-02-07 09:35:18 +02:00
d4e02bbb89 zsh: Added brew sbin to path 2023-02-06 23:20:41 +02:00
32dbec6476 nvim: Plugins cleanup 2023-02-06 22:32:27 +02:00
Ismo Vuorinen
980fc9aa7d zsh: Installed starship
https://starship.rs/
2023-01-31 15:38:41 +02:00
Ismo Vuorinen
a2c3de1b3b brew: Installed quitter 2023-01-31 15:38:19 +02:00
Ismo Vuorinen
16d455a262 2023-01-30 2023-01-30 12:16:20 +02:00
Ismo Vuorinen
9ba66c7734 dfm: dotfiles update 2023-01-19 16:33:36 +02:00
Ismo Vuorinen
86824d8c45 bin: git-dirty - list dirty git repositories 2023-01-19 16:32:07 +02:00
38d853aa8a rcrc: Skip *-secret files from rc linking 2023-01-19 16:29:22 +02:00
Ismo Vuorinen
34a0d7d8c4 brew: Brewfile update 2023-01-17 10:02:09 +02:00
Ismo Vuorinen
65bf470c5b dfm: brew autoupdate now removes first, then adds 2023-01-17 10:01:40 +02:00
Ismo Vuorinen
965c47efef zshrc: secret exports, alias and functions files 2023-01-17 10:00:49 +02:00
410f5ac2b5 nvim: wakatime/vim-wakatime 2023-01-16 22:58:22 +02:00
Ismo Vuorinen
b6a18688c4 Fix shfmt command and formatted files 2023-01-12 16:49:49 +02:00
9f1ba5034f nvim: Added harpoon 2023-01-09 04:04:09 +02:00
18 changed files with 293 additions and 210 deletions

View File

@@ -120,6 +120,8 @@ brew "mas"
brew "midnight-commander" brew "midnight-commander"
# Ambitious Vim-fork focused on extensibility and agility # Ambitious Vim-fork focused on extensibility and agility
brew "neovim" brew "neovim"
# No Nonsense Neovim Client in Rust
brew "neovide"
# Port scanning utility for large networks # Port scanning utility for large networks
brew "nmap" brew "nmap"
# Manage multiple Node.js versions # Manage multiple Node.js versions
@@ -128,6 +130,8 @@ brew "nvm"
brew "openjdk" brew "openjdk"
# Generate clients, server & docs from an OpenAPI spec (v2, v3) # Generate clients, server & docs from an OpenAPI spec (v2, v3)
brew "openapi-generator" brew "openapi-generator"
# Swiss-army knife of markup format conversion
brew "pandoc"
# Highly capable, feature-rich programming language # Highly capable, feature-rich programming language
brew "perl" brew "perl"
# Interpreted, interactive, object-oriented programming language # Interpreted, interactive, object-oriented programming language
@@ -144,6 +148,8 @@ brew "ruby"
brew "shellcheck" brew "shellcheck"
# Autoformat shell script source code # Autoformat shell script source code
brew "shfmt" brew "shfmt"
# Cross-shell prompt for astronauts
brew "starship"
# Version control system designed to be a better CVS # Version control system designed to be a better CVS
brew "subversion" brew "subversion"
# Send macOS User Notifications from the command-line # Send macOS User Notifications from the command-line
@@ -232,8 +238,6 @@ cask "insomnia"
cask "jetbrains-toolbox" cask "jetbrains-toolbox"
# Kubernetes IDE # Kubernetes IDE
cask "lens" cask "lens"
# Neovim Client
cask "neovide"
# Reverse proxy, secure introspectable tunnels to localhost # Reverse proxy, secure introspectable tunnels to localhost
cask "ngrok" cask "ngrok"
# Collaboration platform for API development # Collaboration platform for API development
@@ -248,6 +252,8 @@ cask "qlstephen"
cask "quicklook-json" cask "quicklook-json"
# QuickLook generator for Adobe Swatch Exchange files # QuickLook generator for Adobe Swatch Exchange files
cask "quicklookase" cask "quicklookase"
# Automatically hides or quits apps after periods of inactivity
cask "quitter"
# Move and resize windows using keyboard shortcuts or snap areas # Move and resize windows using keyboard shortcuts or snap areas
cask "rectangle" cask "rectangle"
# MySQL/MariaDB database management # MySQL/MariaDB database management
@@ -266,8 +272,12 @@ cask "syntax-highlight"
cask "visual-studio-code" cask "visual-studio-code"
# Multimedia player # Multimedia player
cask "vlc" cask "vlc"
# Spell-checking service for Finnish
cask "voikkospellservice"
# Rust-based terminal # Rust-based terminal
cask "warp" cask "warp"
# View output from scripts in the menu bar
cask "xbar"
mas "1Password for Safari", id: 1569813296 mas "1Password for Safari", id: 1569813296
mas "Flow", id: 1423210932 mas "Flow", id: 1423210932
mas "GarageBand", id: 682658836 mas "GarageBand", id: 682658836
@@ -275,4 +285,5 @@ mas "iMovie", id: 408981434
mas "Keynote", id: 409183694 mas "Keynote", id: 409183694
mas "Numbers", id: 409203825 mas "Numbers", id: 409203825
mas "Pages", id: 409201541 mas "Pages", id: 409201541
mas "pullBar", id: 1601913905
mas "Tailscale", id: 1475387142 mas "Tailscale", id: 1475387142

View File

@@ -4,6 +4,7 @@
*.cache *.cache
*~ *~
*-secret
__secret __secret
__ignored __ignored
__test_*.php __test_*.php

View File

@@ -48,11 +48,6 @@ require('packer').startup(function(use)
after = 'nvim-treesitter', after = 'nvim-treesitter',
} }
-- Git related plugins
use 'tpope/vim-fugitive'
use 'tpope/vim-rhubarb'
use 'lewis6991/gitsigns.nvim'
-- Theme based off the Material Pale Night -- Theme based off the Material Pale Night
use 'drewtempelmeyer/palenight.vim' use 'drewtempelmeyer/palenight.vim'
-- Fancier statusline -- Fancier statusline
@@ -66,12 +61,12 @@ require('packer').startup(function(use)
-- Fuzzy Finder (files, lsp, etc) -- Fuzzy Finder (files, lsp, etc)
use { 'nvim-telescope/telescope.nvim', use { 'nvim-telescope/telescope.nvim',
branch = '0.1.x', requires = { 'nvim-lua/plenary.nvim' } } branch = '0.1.x', requires = { 'nvim-lua/plenary.nvim' } }
-- Fuzzy Finder Algorithm which requires local dependencies to be built. -- Fuzzy Finder Algorithm which requires local dependencies to be built.
-- Only load if `make` is available -- Only load if `make` is available
use { 'nvim-telescope/telescope-fzf-native.nvim', use { 'nvim-telescope/telescope-fzf-native.nvim',
run = 'make', cond = vim.fn.executable 'make' == 1 } run = 'make', cond = vim.fn.executable 'make' == 1 }
-- Add custom plugins to packer from -- Add custom plugins to packer from
-- ~/.config/nvim/lua/custom/plugins.lua -- ~/.config/nvim/lua/custom/plugins.lua
@@ -342,18 +337,6 @@ require('indent_blankline').setup {
show_current_context_start = true, show_current_context_start = true,
} }
-- Gitsigns
-- See `:help gitsigns.txt`
require('gitsigns').setup {
signs = {
add = { text = '+' },
change = { text = '~' },
delete = { text = '_' },
topdelete = { text = '' },
changedelete = { text = '~' },
},
}
-- [[ Configure Telescope ]] -- [[ Configure Telescope ]]
-- See `:help telescope` and `:help telescope.setup()` -- See `:help telescope` and `:help telescope.setup()`
require('telescope').setup { require('telescope').setup {
@@ -392,6 +375,9 @@ ks('n', '<leader>sw', tl.grep_string, { desc = '[S]earch current [W]ord' })
ks('n', '<leader>sg', tl.live_grep, { desc = '[S]earch by [G]rep' }) ks('n', '<leader>sg', tl.live_grep, { desc = '[S]earch by [G]rep' })
ks('n', '<leader>sd', tl.diagnostics, { desc = '[S]earch [D]iagnostics' }) ks('n', '<leader>sd', tl.diagnostics, { desc = '[S]earch [D]iagnostics' })
-- Add harpoon to telescope
require("telescope").load_extension('harpoon')
-- [[ Configure Treesitter ]] -- [[ Configure Treesitter ]]
-- See `:help nvim-treesitter` -- See `:help nvim-treesitter`
require('nvim-treesitter.configs').setup { require('nvim-treesitter.configs').setup {
@@ -482,16 +468,6 @@ require('nvim-treesitter.configs').setup {
}, },
} }
-- Load custom treesitter grammar for org filetype
require('orgmode').setup_ts_grammar()
require('orgmode').setup({
org_agenda_files = {
vim.fn.expand '~/.local/share/_nvalt/**/*',
vim.fn.expand '~/.dotfiles/local/org/**/*'
},
org_default_notes_file = vim.fn.expand '~/.local/share/_nvalt/refile.org',
})
-- LSP settings. -- LSP settings.
-- This function gets run when an LSP connects to a particular buffer. -- This function gets run when an LSP connects to a particular buffer.
local on_attach = function(_, bufnr) local on_attach = function(_, bufnr)

View File

@@ -59,6 +59,13 @@ return function(use)
} }
} }
-- harpoon, by ThePrimeagen
-- https://github.com/ThePrimeagen/harpoon
use {
"ThePrimeagen/harpoon",
requires = { { "nvim-lua/plenary.nvim" } }
}
-- An asynchronous linter plugin for Neovim complementary to -- An asynchronous linter plugin for Neovim complementary to
-- the built-in Language Server Protocol support. -- the built-in Language Server Protocol support.
-- https://github.com/mfussenegger/nvim-lint -- https://github.com/mfussenegger/nvim-lint
@@ -69,36 +76,10 @@ return function(use)
end, end,
}) })
-- nvim orgmode, to get me use nvim even more.
use({
"nvim-orgmode/orgmode",
config = function()
require('orgmode').setup_ts_grammar()
end,
})
-- Markdown support -- Markdown support
use 'preservim/vim-markdown' use 'preservim/vim-markdown'
use 'godlygeek/tabular' use 'godlygeek/tabular'
-- obsidian plugin for nvim
-- https://github.com/epwalsh/obsidian.nvim
use({
"epwalsh/obsidian.nvim",
config = function()
require("obsidian").setup({
dir = '~/.local/share/_nvalt',
notes_subdir = "notes",
daily_notes = {
folder = "_daily"
},
completion = {
nvim_cmp = true, -- if using nvim-cmp, otherwise set to false
}
})
end
})
-- Creates missing folders on save -- Creates missing folders on save
-- https://github.com/jghauser/mkdir.nvim -- https://github.com/jghauser/mkdir.nvim
use { 'jghauser/mkdir.nvim' } use { 'jghauser/mkdir.nvim' }
@@ -197,4 +178,7 @@ return function(use)
requires = { "jose-elias-alvarez/null-ls.nvim" } requires = { "jose-elias-alvarez/null-ls.nvim" }
} }
-- WakaTime Support
use { "wakatime/vim-wakatime" }
end end

9
config/starship.toml Normal file
View File

@@ -0,0 +1,9 @@
# Get editor completions based on the config schema
"$schema" = 'https://starship.rs/config-schema.json'
# Inserts a blank line between shell prompts
add_newline = true
# Replace the '' symbol in the prompt with '➜'
[character] # The name of the module we are configuring is 'character'
success_symbol = '[➜](bold green)' # The 'success_symbol' segment is being set to '➜' with the color 'bold green'

View File

@@ -22,39 +22,39 @@ function section_install
case "$1" in case "$1" in
all) all)
$0 install antigen && msg_done "New antigen installed" $0 install antigen
$0 install macos && msg_done "macOS Defaults set" $0 install macos
$0 install brew && msg_done "Brewfile defined apps has been installed" $0 install brew
$0 install ext_gh && msg_done "Extensions for GitHub CLI have been installed" $0 install ext_gh
$0 install ext_go && msg_done "Go packages have been installed" $0 install ext_go
;; ;;
antigen) antigen)
curl -L git.io/antigen > "$DOTFILES/local/bin/antigen.zsh" && msg_done "🎉 Done!" curl -L git.io/antigen > "$DOTFILES/local/bin/antigen.zsh" && msg_done "🎉 New antigen installed!"
;; ;;
brew) brew)
brew bundle install --file="$BREWFILE" && msg_done "🎉 Done!" brew bundle install --file="$BREWFILE" && msg_done "🎉 macOS Defaults set!"
;; ;;
macos) macos)
bash "$DOTFILES/scripts/set-macos-defaults.sh" && msg_done "🎉 Done!" bash "$DOTFILES/scripts/set-macos-defaults.sh" && msg_done "🎉 Brewfile defined apps has been installed!"
;; ;;
ext_go) ext_go)
bash "$DOTFILES/scripts/install-go-packages.sh" && msg_done "🎉 Done!" bash "$DOTFILES/scripts/install-go-packages.sh" && msg_done "🎉 Go packages have been installed!"
;; ;;
ext_gh) ext_gh)
bash "$DOTFILES/scripts/install-gh-extensions.sh" && msg_done "🎉 Done!" bash "$DOTFILES/scripts/install-gh-extensions.sh" && msg_done "🎉 Extensions for GitHub CLI have been installed!"
;; ;;
settler) settler)
bash "$DOTFILES/scripts/settler.sh" && msg_done "🎉 Done!" bash "$DOTFILES/scripts/settler.sh" && msg_done "🎉 Settler has been run!"
;; ;;
*) *)
menu_section "$USAGE_PREFIX" "all | antigen | brew | macos | ext_go | ext_gh | settler" menu_section "$USAGE_PREFIX" "all | antigen | brew | ext_gh | ext_go | macos | settler"
menu_item "all" "Installs antigen, macos, brew, ext_gh and ext_go" menu_item "all" "Installs antigen, macos, brew, ext_gh and ext_go"
menu_item "antigen" "Updates the antigen.zsh file" menu_item "antigen" "Updates the antigen.zsh file"
menu_item "brew" "Install Brewfile contents" menu_item "brew" "Install Brewfile contents"
menu_item "ext_gh" "Install GitHub CLI Extensions" menu_item "ext_gh" "Install GitHub CLI Extensions"
menu_item "ext_go" "Install Go Packages" menu_item "ext_go" "Install Go Packages"
menu_item "macos" "Setup nice macOS defaults" menu_item "macos" "Setup nice macOS defaults"
menu_item "settler" "Runs the WIP settler.sh" menu_item "settler" "Runs the WIP settler.sh"
;; ;;
esac esac
} }
@@ -84,6 +84,7 @@ function section_brew
--describe && msg_done "🎉 Done!" --describe && msg_done "🎉 Done!"
;; ;;
autoupdate) autoupdate)
brew autoupdate delete
brew autoupdate start 43200 --upgrade --cleanup --immediate brew autoupdate start 43200 --upgrade --cleanup --immediate
;; ;;
*) *)
@@ -102,7 +103,7 @@ function section_dotfiles
case "$1" in case "$1" in
link) link)
rcup -B "$HOSTNAME" -f -v && msg_done "🎉 Done!" rcup -B "$HOSTNAME" -f -v && msg_done "🎉 dotfiles have been linked!"
;; ;;
update) update)
# Updates .dotfiles/scripts/install.sh and formats it # Updates .dotfiles/scripts/install.sh and formats it
@@ -111,28 +112,21 @@ function section_dotfiles
&& sed -i '' "s|$HOME|\$HOME|g" "$INSTALL_SCRIPT" \ && sed -i '' "s|$HOME|\$HOME|g" "$INSTALL_SCRIPT" \
&& sed -i '' "s|install.sh|$(basename "$INSTALL_SCRIPT")|g" "$INSTALL_SCRIPT" && sed -i '' "s|install.sh|$(basename "$INSTALL_SCRIPT")|g" "$INSTALL_SCRIPT"
$0 dotfiles shfmt $0 dotfiles shfmt
msg_done "🎉 Done!" $0 dotfiles link
msg_done "🎉 dotfiles updated and linked!"
;; ;;
shfmt) shfmt)
# Format shell scripts according to following rules. # Format shell scripts according to following rules.
shfmt \ find "$DOTFILES" \
--find \ \( -name '*.sh' -or -name '*.zsh' -or -name 'x-*' -or -not '*.pl' \) \
--list \ -exec shfmt -fn -l -w -i 2 -ci -sr -bn {} \;
--write \ msg_done "🎉 dotfiles have been formatted!"
--diff \
--simplify \
--indent 2 \
--binary-next-line \
--case-indent \
--space-redirects \
--func-next-line \
"$DOTFILES"
;; ;;
*) *)
menu_section "$USAGE_PREFIX" "link | update | shfmt" menu_section "$USAGE_PREFIX" "link | update | shfmt"
menu_item "link" "Use rcrc to update dotfile links" menu_item "link" "Use rcrc to update dotfile links"
menu_item "update" "Updates dotfile links, installs host specific overrides automatically" menu_item "update" "Updates dotfile links (scripts/install.sh), formats it and runs it."
menu_item "shfmt" "Run shfmt to all dotfiles" menu_item "shfmt" "Run shfmt to all dotfiles"
;; ;;
esac esac
} }
@@ -183,4 +177,3 @@ case "$1" in
tests) section_tests "$2" ;; tests) section_tests "$2" ;;
*) usage && exit 1 ;; *) usage && exit 1 ;;
esac esac

82
local/bin/git-dirty Executable file
View File

@@ -0,0 +1,82 @@
#!/usr/bin/env bash
# Get git repository status for all subdirectories
# recursively in specified dir.
#
# Check the default dir:
# `git-dirty.sh`
# Check specific dir:
# `git-dirty.sh ~/Projects`
# Override default dir with env:
# `GIT_DIRTY_DIR=$HOME/Projects git-dirty.sh`
#
# If you want to skip directory from checks, just add `.ignore` file next
# to the `.git` folder. ProTip: Add `.ignore` to your global `.gitignore`.
#
# The script automatically skips folders:
# node_modules, vendor
#
# SET Defaults:
# Default dir to check, can be overridden in env (.bashrc, .zshrc, ...)
: "${GIT_DIRTY_DIR:=$HOME/Code}"
# If user has provided folder as a first argument, use it.
if [ "$1" != "" ]; then
GIT_DIRTY_DIR="$1"
fi
# UTF-8 ftw
GITDIRTY="❌ "
GITCLEAN="✅ "
catch()
{
echo "Error $1 occurred on $2"
}
gitdirty()
{
local d="$1"
trap 'catch $? $LINENO' ERR
if [[ -d "$d" ]]; then
if [[ -e "$d/.ignore" ]]; then
echo -e ""
else
# Check that $d is not '--', 'vendor', or 'node_modules'
if [[ "${d:0:2}" == "--" ]] || [[ "$d" == "vendor" ]] || [[ "$d" == "node_modules" ]]; then
echo ""
else
cd "$d" > /dev/null
# If we have `.git` folder, check it.
if [[ -d ".git" ]]; then
ISDIRTY=$(git diff --shortstat 2> /dev/null | tail -n1)
ICON="$GITCLEAN"
[[ $ISDIRTY != "" ]] && ICON="$GITDIRTY"
printf " %s %s\n" "$ICON" "$(pwd)"
else
# If it wasn't git repository, check subdirectories.
gitdirtyrepos -- *
fi
fi
cd .. > /dev/null
fi
fi
}
gitdirtyrepos()
{
for x in "$@"; do
gitdirty "$x"
done
}
set -e
trap 'case $? in
139) echo "segfault occurred";;
11) echo "ssegfault occurred";;
esac' EXIT
gitdirtyrepos "$GIT_DIRTY_DIR"

View File

@@ -20,9 +20,10 @@
# #
# Simple function to show usage information, and exit. # Simple function to show usage information, and exit.
# #
usage() { usage()
echo "Usage: $0 [-d] [-p 443] domain1.org domain2.com .. domainN" {
exit 0 echo "Usage: $0 [-d] [-p 443] domain1.org domain2.com .. domainN"
exit 0
} }
# #
@@ -35,19 +36,19 @@ port=443
# Parse the argument(s) - i.e. look for "-d" / "-p 443". # Parse the argument(s) - i.e. look for "-d" / "-p 443".
# #
while getopts "h?dp:" opt; do while getopts "h?dp:" opt; do
case $opt in case $opt in
h) h)
usage usage
;; ;;
\?) \?)
usage usage
;; ;;
d) d)
days=1 days=1
;; ;;
p) p)
port=$OPTARG port=$OPTARG
;; ;;
esac esac
done done
shift $((OPTIND - 1)) shift $((OPTIND - 1))
@@ -56,7 +57,7 @@ shift $((OPTIND - 1))
# Ensure we have some arguments # Ensure we have some arguments
# #
if [ "$#" = "0" ]; then if [ "$#" = "0" ]; then
usage usage
fi fi
# #
@@ -64,70 +65,70 @@ fi
# #
for name in "$@"; do for name in "$@"; do
# #
# Make a temporary file # Make a temporary file
# #
# Test if we have BSD or GNU version of mktemp # Test if we have BSD or GNU version of mktemp
if ( strings "$(which mktemp)" | grep -q GNU); then if (strings "$(which mktemp)" | grep -q GNU); then
# We have the GNU version # We have the GNU version
tmp=$(mktemp) tmp=$(mktemp)
else else
# We have the BSD version # We have the BSD version
tmp=$(mktemp -t tmp) tmp=$(mktemp -t tmp)
fi fi
# #
# Download the certificate # Download the certificate
# #
if ( ! echo "" | openssl s_client -connect $name:$port > $tmp 2> /dev/null); then if (! echo "" | openssl s_client -connect $name:$port > $tmp 2> /dev/null); then
echo "Failed to get cert from https://$name:$port/" echo "Failed to get cert from https://$name:$port/"
exit 3 exit 3
fi fi
# #
# Get the expiry date # Get the expiry date
# #
date=$(openssl x509 -in "$tmp" -noout -enddate | awk -F= '{print $2}') date=$(openssl x509 -in "$tmp" -noout -enddate | awk -F= '{print $2}')
# #
# Remove the temporary file # Remove the temporary file
# #
rm -f "$tmp" rm -f "$tmp"
# #
# Convert the expiry date + todays date to seconds-past epoch # Convert the expiry date + todays date to seconds-past epoch
# #
# Check if we have the BSD or the GNU version of date # Check if we have the BSD or the GNU version of date
if (strings "$(which date)" | grep -q GNU); then if (strings "$(which date)" | grep -q GNU); then
# We have GNU this is easy # We have GNU this is easy
then=$(date --date "$date" +%s) then=$(date --date "$date" +%s)
else else
# We have BSD now it is getting complicated # We have BSD now it is getting complicated
year=$(echo "$date" | awk '{print $4}') year=$(echo "$date" | awk '{print $4}')
month=$(echo "$date" | awk '{print $1}') month=$(echo "$date" | awk '{print $1}')
day=$(echo "$date" | awk '{print $2}') day=$(echo "$date" | awk '{print $2}')
hour=$(echo "$date" | awk '{print $3}' | awk -F: '{print $1}') hour=$(echo "$date" | awk '{print $3}' | awk -F: '{print $1}')
minute=$(echo "$date" | awk '{print $3}' | awk -F: '{print $2}') minute=$(echo "$date" | awk '{print $3}' | awk -F: '{print $2}')
second=$(echo "$date" | awk '{print $3}' | awk -F: '{print $3}') second=$(echo "$date" | awk '{print $3}' | awk -F: '{print $3}')
then=$(date -v${year}y -v${month} -v${day}d -v${hour}H -v${minute}M -v${second}S -u +%s) then=$(date -v${year}y -v${month} -v${day}d -v${hour}H -v${minute}M -v${second}S -u +%s)
fi fi
now=$(date +%s) now=$(date +%s)
# #
# Day diff # Day diff
# #
diff=$(("$then" - "$now")) diff=$(("$then" - "$now"))
diff=$($diff / 86400) diff=$($diff / 86400)
# #
# All done # All done
# #
if [ "$days" = "1" ]; then if [ "$days" = "1" ]; then
echo "${name}: ${diff}" echo "${name}: ${diff}"
else else
echo "$name" echo "$name"
echo " Expires: ${date}" echo " Expires: ${date}"
echo " Days: ${diff}" echo " Days: ${diff}"
fi fi
done done

View File

@@ -11,5 +11,5 @@
# If the status code was zero then repeat. # If the status code was zero then repeat.
# #
while [ $? -eq 0 ]; do while [ $? -eq 0 ]; do
"$@" "$@"
done done

View File

@@ -26,5 +26,5 @@
# If the status code was not zero then repeat. # If the status code was not zero then repeat.
# #
while [ $? -ne 0 ]; do while [ $? -ne 0 ]; do
"$@" "$@"
done done

View File

@@ -14,8 +14,8 @@
# Ensure we received the correct number of arguments. # Ensure we received the correct number of arguments.
# #
if [ $# -lt 2 ]; then if [ $# -lt 2 ]; then
echo "Usage: $0 HOST COMMAND..." echo "Usage: $0 HOST COMMAND..."
exit 1 exit 1
fi fi
HOST=$1 HOST=$1
@@ -24,7 +24,7 @@ echo "Waiting for $HOST to get down..."
true true
while [ $? -ne 1 ]; do while [ $? -ne 1 ]; do
ping -c 1 -W 1 $HOST > /dev/null ping -c 1 -W 1 $HOST > /dev/null
done done
shift shift

View File

@@ -18,8 +18,8 @@
# Ensure we received the correct number of arguments. # Ensure we received the correct number of arguments.
# #
if [ $# -lt 2 ]; then if [ $# -lt 2 ]; then
echo "Usage: $0 HOST COMMAND..." echo "Usage: $0 HOST COMMAND..."
exit 1 exit 1
fi fi
if [ $1 = "ssh" ]; then if [ $1 = "ssh" ]; then
@@ -32,8 +32,8 @@ echo "Waiting for $HOST to come online..."
ping -c 1 -W 1 $HOST > /dev/null ping -c 1 -W 1 $HOST > /dev/null
while [ $? -ne 0 ]; do while [ $? -ne 0 ]; do
sleep 1 sleep 1
ping -c 1 -W 1 $HOST > /dev/null ping -c 1 -W 1 $HOST > /dev/null
done done
# By the time we reach here the ping-command has completed successfully # By the time we reach here the ping-command has completed successfully

2
rcrc
View File

@@ -1,2 +1,2 @@
EXCLUDES="*.md *.sh *.lock.json Brewfile scripts" EXCLUDES="*.md *.sh *.lock.json Brewfile scripts *-secret xbar"
HOSTNAME=$(hostname -s) HOSTNAME=$(hostname -s)

View File

@@ -9,7 +9,7 @@
# env VERBOSE=1 sh install-dotfiles.sh # env VERBOSE=1 sh install-dotfiles.sh
# #
# DO NOT EDIT THIS FILE # DO NOT EDIT THIS FILE
# #
# This file is generated by rcm(7) as: # This file is generated by rcm(7) as:
# #
# rcup -B 0 -g # rcup -B 0 -g
@@ -22,14 +22,12 @@
: ${MKDIR:=/bin/mkdir} : ${MKDIR:=/bin/mkdir}
: ${RM:=/bin/rm} : ${RM:=/bin/rm}
: ${DIRNAME:=/usr/bin/dirname} : ${DIRNAME:=/usr/bin/dirname}
verbose() verbose() {
{
if [ "$VERBOSE" -gt 0 ]; then if [ "$VERBOSE" -gt 0 ]; then
echo "$@" echo "$@"
fi fi
} }
handle_file_cp() handle_file_cp() {
{
if [ -e "$2" ]; then if [ -e "$2" ]; then
printf "%s " "overwrite $2? [yN]" printf "%s " "overwrite $2? [yN]"
read overwrite read overwrite
@@ -47,8 +45,7 @@ handle_file_cp()
$MKDIR -p "$($DIRNAME "$2")" $MKDIR -p "$($DIRNAME "$2")"
$CP -R "$1" "$2" $CP -R "$1" "$2"
} }
handle_file_ln() handle_file_ln() {
{
if [ -e "$2" ]; then if [ -e "$2" ]; then
printf "%s " "overwrite $2? [yN]" printf "%s " "overwrite $2? [yN]"
read overwrite read overwrite
@@ -75,7 +72,6 @@ handle_file_ln "$HOME/.dotfiles/config/functions" "$HOME/.config/functions"
handle_file_ln "$HOME/.dotfiles/config/gh/config.yml" "$HOME/.config/gh/config.yml" handle_file_ln "$HOME/.dotfiles/config/gh/config.yml" "$HOME/.config/gh/config.yml"
handle_file_ln "$HOME/.dotfiles/config/git/config" "$HOME/.config/git/config" handle_file_ln "$HOME/.dotfiles/config/git/config" "$HOME/.config/git/config"
handle_file_ln "$HOME/.dotfiles/config/git/gitignore" "$HOME/.config/git/gitignore" handle_file_ln "$HOME/.dotfiles/config/git/gitignore" "$HOME/.config/git/gitignore"
handle_file_ln "$HOME/.dotfiles/config/nvim/after/plugin/defaults.lua" "$HOME/.config/nvim/after/plugin/defaults.lua"
handle_file_ln "$HOME/.dotfiles/config/nvim/init.lua" "$HOME/.config/nvim/init.lua" handle_file_ln "$HOME/.dotfiles/config/nvim/init.lua" "$HOME/.config/nvim/init.lua"
handle_file_ln "$HOME/.dotfiles/config/nvim/lua/custom/plugins.lua" "$HOME/.config/nvim/lua/custom/plugins.lua" handle_file_ln "$HOME/.dotfiles/config/nvim/lua/custom/plugins.lua" "$HOME/.config/nvim/lua/custom/plugins.lua"
handle_file_ln "$HOME/.dotfiles/config/nvim/plugin/packer_compiled.lua" "$HOME/.config/nvim/plugin/packer_compiled.lua" handle_file_ln "$HOME/.dotfiles/config/nvim/plugin/packer_compiled.lua" "$HOME/.config/nvim/plugin/packer_compiled.lua"
@@ -85,10 +81,11 @@ handle_file_ln "$HOME/.dotfiles/git_profiles" "$HOME/.git_profiles"
handle_file_ln "$HOME/.dotfiles/huskyrc" "$HOME/.huskyrc" handle_file_ln "$HOME/.dotfiles/huskyrc" "$HOME/.huskyrc"
handle_file_ln "$HOME/.dotfiles/local/bin/antigen.zsh" "$HOME/.local/bin/antigen.zsh" handle_file_ln "$HOME/.dotfiles/local/bin/antigen.zsh" "$HOME/.local/bin/antigen.zsh"
handle_file_ln "$HOME/.dotfiles/local/bin/dfm" "$HOME/.local/bin/dfm" handle_file_ln "$HOME/.dotfiles/local/bin/dfm" "$HOME/.local/bin/dfm"
handle_file_ln "$HOME/.dotfiles/local/bin/git-dirty" "$HOME/.local/bin/git-dirty"
handle_file_ln "$HOME/.dotfiles/local/bin/x-check-git-attributes" "$HOME/.local/bin/x-check-git-attributes" handle_file_ln "$HOME/.dotfiles/local/bin/x-check-git-attributes" "$HOME/.local/bin/x-check-git-attributes"
handle_file_ln "$HOME/.dotfiles/local/bin/x-dupes" "$HOME/.local/bin/x-dupes" handle_file_ln "$HOME/.dotfiles/local/bin/x-dupes.pl" "$HOME/.local/bin/x-dupes.pl"
handle_file_ln "$HOME/.dotfiles/local/bin/x-foreach" "$HOME/.local/bin/x-foreach" handle_file_ln "$HOME/.dotfiles/local/bin/x-foreach" "$HOME/.local/bin/x-foreach"
handle_file_ln "$HOME/.dotfiles/local/bin/x-multi-ping" "$HOME/.local/bin/x-multi-ping" handle_file_ln "$HOME/.dotfiles/local/bin/x-multi-ping.pl" "$HOME/.local/bin/x-multi-ping.pl"
handle_file_ln "$HOME/.dotfiles/local/bin/x-open-ports" "$HOME/.local/bin/x-open-ports" handle_file_ln "$HOME/.dotfiles/local/bin/x-open-ports" "$HOME/.local/bin/x-open-ports"
handle_file_ln "$HOME/.dotfiles/local/bin/x-ssl-expiry-date" "$HOME/.local/bin/x-ssl-expiry-date" handle_file_ln "$HOME/.dotfiles/local/bin/x-ssl-expiry-date" "$HOME/.local/bin/x-ssl-expiry-date"
handle_file_ln "$HOME/.dotfiles/local/bin/x-until-error" "$HOME/.local/bin/x-until-error" handle_file_ln "$HOME/.dotfiles/local/bin/x-until-error" "$HOME/.local/bin/x-until-error"

View File

@@ -12,77 +12,102 @@ CLR_BLUE='\033[1;34m'
CLR_RESET="\033[0m" CLR_RESET="\033[0m"
# -- Helpers -- # # -- Helpers -- #
function __log_marker() { function __log_marker()
{
echo -e "${CLR_BLUE}${CLR_RESET}" echo -e "${CLR_BLUE}${CLR_RESET}"
} }
function __log_marker_ok() { function __log_marker_ok()
{
echo -e "${CLR_GREEN}${CLR_RESET}" echo -e "${CLR_GREEN}${CLR_RESET}"
} }
function __log_marker_ok_blue() { function __log_marker_ok_blue()
{
echo -e "${CLR_BLUE}${CLR_RESET}" echo -e "${CLR_BLUE}${CLR_RESET}"
} }
function __log_marker_warn() { function __log_marker_warn()
{
echo -e "${CLR_YELLOW}${CLR_RESET}" echo -e "${CLR_YELLOW}${CLR_RESET}"
} }
function __log_marker_err() { function __log_marker_err()
{
echo -e "${CLR_RED}${CLR_RESET}" echo -e "${CLR_RED}${CLR_RESET}"
} }
function __log_indent() { function __log_indent()
{
echo " " echo " "
} }
# -- Log -- # # -- Log -- #
function msg() { function msg()
{
echo -e "$(__log_marker) $1" echo -e "$(__log_marker) $1"
} }
function msg_done() { function msg_done()
{
echo -e "$(__log_marker) $1 ...$(__log_marker_ok)" echo -e "$(__log_marker) $1 ...$(__log_marker_ok)"
} }
function msg_prompt() { function msg_prompt()
{
echo -e "$(__log_marker) $1" echo -e "$(__log_marker) $1"
} }
function msg_prompt_done() { function msg_prompt_done()
{
echo -e "$(__log_marker) $1 ...$(__log_marker_ok)" echo -e "$(__log_marker) $1 ...$(__log_marker_ok)"
} }
function msg_nested() { function msg_nested()
{
echo -e "$(__log_indent)$(__log_marker) $1" echo -e "$(__log_indent)$(__log_marker) $1"
} }
function msg_nested_done() { function msg_nested_done()
{
echo -e "$(__log_indent)$(__log_marker) $1 ...$(__log_marker_ok)" echo -e "$(__log_indent)$(__log_marker) $1 ...$(__log_marker_ok)"
} }
function msg_run() { function msg_run()
{
echo -e "${CLR_GREEN}$1${CLR_RESET} $2" echo -e "${CLR_GREEN}$1${CLR_RESET} $2"
} }
function msg_ok() { function msg_ok()
{
echo -e "$(__log_marker_ok) $1" echo -e "$(__log_marker_ok) $1"
} }
function msg_warn() { function msg_warn()
{
echo -e "$(__log_marker_warn) $1" echo -e "$(__log_marker_warn) $1"
} }
function msg_err() { function msg_err()
{
echo -e "$(__log_marker_err) $1" echo -e "$(__log_marker_err) $1"
} }
# -- Menu builder -- # # -- Menu builder -- #
function menu_section() { function menu_section()
{
LINE=$(printf '%-18s [ %-15s ]\n' "$1" "$2") LINE=$(printf '%-18s [ %-15s ]\n' "$1" "$2")
echo -e " $(__log_marker) $LINE" echo -e " $(__log_marker) $LINE"
} }
function menu_item() { function menu_item()
{
LINE=$(printf '%-15s %-30s\n' "$1" "$2") LINE=$(printf '%-15s %-30s\n' "$1" "$2")
echo -e "$(__log_indent)$(__log_marker) $LINE" echo -e "$(__log_indent)$(__log_marker) $LINE"
} }
# https://stackoverflow.com/a/85932
function fn_exists()
{
declare -f -F "$1" > /dev/null
return $?
}

22
zshrc
View File

@@ -5,7 +5,7 @@
autoload -U colors zsh/terminfo autoload -U colors zsh/terminfo
colors colors
export PATH="/opt/homebrew/opt/ruby/bin:/opt/homebrew/bin:/usr/local/sbin:$PATH" export PATH="/opt/homebrew/opt/ruby/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/sbin:$PATH"
if [ command -v brew &> /dev/null ]; then if [ command -v brew &> /dev/null ]; then
BREW_BIN=$(brew --prefix)/bin BREW_BIN=$(brew --prefix)/bin
@@ -48,7 +48,9 @@ function x-load-configs()
# Load the shell dotfiles, and then some: # Load the shell dotfiles, and then some:
for file in ~/.dotfiles/config/{exports,alias,functions}; do for file in ~/.dotfiles/config/{exports,alias,functions}; do
[ -r "$file" ] && [ -f "$file" ] && source "$file" [ -r "$file" ] && [ -f "$file" ] && source "$file"
[ -r "$file-secret" ] && [ -f "$file-secret" ] && source "$file-secret"
[ -r "$file-$HOSTNAME" ] && [ -f "$file-$HOSTNAME" ] && source "$file-$HOSTNAME" [ -r "$file-$HOSTNAME" ] && [ -f "$file-$HOSTNAME" ] && source "$file-$HOSTNAME"
[ -r "$file-$HOSTNAME-secret" ] && [ -f "$file-$HOSTNAME-secret" ] && source "$file-$HOSTNAME-secret"
done done
} }
x-load-configs x-load-configs
@@ -63,7 +65,7 @@ ssh-add -A 2>/dev/null;
if command -v antigen &> /dev/null; then if command -v antigen &> /dev/null; then
antigen use oh-my-zsh antigen use oh-my-zsh
antigen theme oskarkrawczyk/honukai-iterm-zsh honukai # antigen theme oskarkrawczyk/honukai-iterm-zsh honukai
antigen bundle ssh-agent antigen bundle ssh-agent
antigen bundle colored-man-pages antigen bundle colored-man-pages
@@ -78,8 +80,8 @@ if command -v antigen &> /dev/null; then
hash php 2>/dev/null && antigen bundle php hash php 2>/dev/null && antigen bundle php
hash nvm 2>/dev/null && antigen bundle nvm hash nvm 2>/dev/null && antigen bundle nvm
hash docker 2>/dev/null && antigen bundle docker hash docker 2>/dev/null && antigen bundle docker
hash ruby 2>/dev/null && antigen bundle ruby # hash ruby 2>/dev/null && antigen bundle ruby
hash python 2>/dev/null && antigen bundle MichaelAquilina/zsh-autoswitch-virtualenv # hash python 2>/dev/null && antigen bundle MichaelAquilina/zsh-autoswitch-virtualenv
hash jq 2>/dev/null && antigen bundle reegnz/jq-zsh-plugin hash jq 2>/dev/null && antigen bundle reegnz/jq-zsh-plugin
hash docker-compose 2>/dev/null && antigen bundle sroze/docker-compose-zsh-plugin hash docker-compose 2>/dev/null && antigen bundle sroze/docker-compose-zsh-plugin
# antigen bundle voronkovich/phpcs.plugin.zsh # antigen bundle voronkovich/phpcs.plugin.zsh
@@ -106,11 +108,13 @@ if hash op 2>/dev/null; then
fi fi
# gcloud is present # gcloud is present
if hash gcloud 2>/dev/null; then #if hash gcloud 2>/dev/null; then
GCLOUD_LOC=$(gcloud info --format="value(installation.sdk_root)" --quiet) # GCLOUD_LOC=$(gcloud info --format="value(installation.sdk_root)" --quiet)
[[ -f "$GCLOUD_LOC/path.zsh.inc" ]] && builtin source "$GCLOUD_LOC/path.zsh.inc" # [[ -f "$GCLOUD_LOC/path.zsh.inc" ]] && builtin source "$GCLOUD_LOC/path.zsh.inc"
[[ -f "$GCLOUD_LOC/completion.zsh.inc" ]] && builtin source "$GCLOUD_LOC/completion.zsh.inc" # [[ -f "$GCLOUD_LOC/completion.zsh.inc" ]] && builtin source "$GCLOUD_LOC/completion.zsh.inc"
fi #fi
eval "$(starship init zsh)"
# Fig post block. Keep at the bottom of this file. # Fig post block. Keep at the bottom of this file.
[[ -f "$HOME/.fig/shell/zshrc.post.zsh" ]] && builtin source "$HOME/.fig/shell/zshrc.post.zsh" [[ -f "$HOME/.fig/shell/zshrc.post.zsh" ]] && builtin source "$HOME/.fig/shell/zshrc.post.zsh"