mirror of
https://github.com/ivuorinen/dotfiles.git
synced 2026-02-01 21:47:45 +00:00
Compare commits
16 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6395895beb | ||
|
|
fa3dc531a0 | ||
| bb7ba3c919 | |||
| 53d91f8248 | |||
| 745fc9b737 | |||
| dbe5ea3ce0 | |||
| 761671e7f7 | |||
| f4df8623b0 | |||
| 03aacb0639 | |||
| 04c85245cc | |||
| 2ccb74422c | |||
| 3c87ed4d2b | |||
| 4e4ff92ae5 | |||
| ef9bf3864b | |||
| cfb9aa696e | |||
| 1c75e7a53f |
@@ -8,8 +8,12 @@ indent_style = space
|
|||||||
insert_final_newline = true
|
insert_final_newline = true
|
||||||
trim_trailing_whitespace = true
|
trim_trailing_whitespace = true
|
||||||
|
|
||||||
[*.{yaml,yml}]
|
[*.lua]
|
||||||
|
insert_final_newline = true
|
||||||
|
|
||||||
|
[*.yaml,*.yml]
|
||||||
indent_size = 2
|
indent_size = 2
|
||||||
|
insert_final_newline = true
|
||||||
|
|
||||||
[local/bin/antigen.zsh]
|
[local/bin/antigen.zsh]
|
||||||
ignore = true
|
ignore = true
|
||||||
|
|||||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,3 +1,3 @@
|
|||||||
Brewfile.lock.json
|
Brewfile.lock.json
|
||||||
*.log
|
*.log
|
||||||
|
*-secret
|
||||||
|
|||||||
22
.gitmodules
vendored
22
.gitmodules
vendored
@@ -3,23 +3,28 @@
|
|||||||
url = https://github.com/anishathalye/dotbot.git
|
url = https://github.com/anishathalye/dotbot.git
|
||||||
ignore = dirty
|
ignore = dirty
|
||||||
|
|
||||||
[submodule "dotbot-plugins/dotbot-brew"]
|
[submodule "dotbot-brew"]
|
||||||
path = dotbot-plugins/dotbot-brew
|
path = dotbot-brew
|
||||||
url = https://github.com/wren/dotbot-brew.git
|
url = https://github.com/wren/dotbot-brew.git
|
||||||
ignore = dirty
|
ignore = dirty
|
||||||
|
|
||||||
[submodule "dotbot-plugins/dotbot-if"]
|
[submodule "dotbot-if"]
|
||||||
path = dotbot-plugins/dotbot-if
|
path = dotbot-if
|
||||||
url = https://github.com/wonderbeyond/dotbot-if.git
|
url = https://github.com/wonderbeyond/dotbot-if.git
|
||||||
ignore = dirty
|
ignore = dirty
|
||||||
|
|
||||||
[submodule "dotbot-plugins/dotbot-gh-extension"]
|
[submodule "dotbot-ifplatform"]
|
||||||
path = dotbot-plugins/dotbot-gh-extension
|
path = dotbot-ifplatform
|
||||||
|
url = https://github.com/ssbanerje/dotbot-ifplatform.git
|
||||||
|
ignore = dirty
|
||||||
|
|
||||||
|
[submodule "dotbot-gh-extension"]
|
||||||
|
path = dotbot-gh-extension
|
||||||
url = https://github.com/fundor333/dotbot-gh-extension.git
|
url = https://github.com/fundor333/dotbot-gh-extension.git
|
||||||
ignore = dirty
|
ignore = dirty
|
||||||
|
|
||||||
[submodule "dotbot-plugins/dotbot-golang"]
|
[submodule "dotbot-golang"]
|
||||||
path = dotbot-plugins/dotbot-golang
|
path = dotbot-golang
|
||||||
url = https://github.com/delicb/dotbot-golang.git
|
url = https://github.com/delicb/dotbot-golang.git
|
||||||
ignore = dirty
|
ignore = dirty
|
||||||
|
|
||||||
@@ -35,3 +40,4 @@
|
|||||||
url = https://github.com/ivuorinen/astronvim_config.git
|
url = https://github.com/ivuorinen/astronvim_config.git
|
||||||
update = rebase
|
update = rebase
|
||||||
branch = main
|
branch = main
|
||||||
|
ignore = dirty
|
||||||
|
|||||||
7
add-submodules.sh
Normal file
7
add-submodules.sh
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
git submodule add --name dotbot-brew -f https://github.com/wren/dotbot-brew.git dotbot-brew
|
||||||
|
git submodule add --name dotbot-gh-extension -f https://github.com/fundor333/dotbot-gh-extension.git dotbot-gh-extension
|
||||||
|
git submodule add --name dotbot-golang -f https://github.com/delicb/dotbot-golang.git dotbot-golang
|
||||||
|
git submodule add --name dotbot-if -f https://github.com/wonderbeyond/dotbot-if.git dotbot-if
|
||||||
|
git submodule add --name dotbot-ifplatform -f https://github.com/ssbanerje/dotbot-ifplatform.git dotbot-ifplatform
|
||||||
@@ -5,3 +5,4 @@ export NVM_DIR="$HOME/.nvm"
|
|||||||
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
|
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
|
||||||
|
|
||||||
alias php="php -d error_reporting=22527"
|
alias php="php -d error_reporting=22527"
|
||||||
|
|
||||||
|
|||||||
20
base/zshrc
20
base/zshrc
@@ -1,3 +1,4 @@
|
|||||||
|
# this is my zsh config. there are many like it, but this one is mine.
|
||||||
# shellcheck shell=bash
|
# shellcheck shell=bash
|
||||||
|
|
||||||
autoload -U colors zsh/terminfo
|
autoload -U colors zsh/terminfo
|
||||||
@@ -24,15 +25,15 @@ export PATH="$XDG_BIN_HOME:$HOMEBREW_BIN:$HOMEBREW_SBIN:/usr/local/sbin:$PATH"
|
|||||||
|
|
||||||
# brew, https://brew.sh
|
# brew, https://brew.sh
|
||||||
if [ command -v brew &> /dev/null ]; then
|
if [ command -v brew &> /dev/null ]; then
|
||||||
BREW_BIN=$(brew --prefix)/bin
|
BREW_BIN=$(brew --prefix)/bin
|
||||||
BREW_SBIN=$(brew --prefix)/sbin
|
BREW_SBIN=$(brew --prefix)/sbin
|
||||||
|
|
||||||
BREW_PYTHON=$(brew --prefix python@3.8)/bin
|
BREW_PYTHON=$(brew --prefix python@3.8)/bin
|
||||||
GNUBIN_DIR=$(brew --prefix coreutils)/libexec/gnubin
|
GNUBIN_DIR=$(brew --prefix coreutils)/libexec/gnubin
|
||||||
BREW_RUBY=$(brew --prefix ruby)/bin
|
BREW_RUBY=$(brew --prefix ruby)/bin
|
||||||
BREW_GEMS=$(gem environment gemdir)/bin
|
BREW_GEMS=$(gem environment gemdir)/bin
|
||||||
|
|
||||||
export PATH="$BREW_PYTHON:$GNUBIN_DIR:$BREW_GEMS:$BREW_RUBY:$BREW_BIN:$BREW_SBIN:$PATH"
|
export PATH="$BREW_PYTHON:$GNUBIN_DIR:$BREW_GEMS:$BREW_RUBY:$BREW_BIN:$BREW_SBIN:$PATH"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# nvm, the node version manager
|
# nvm, the node version manager
|
||||||
@@ -41,10 +42,12 @@ export NVM_COMPLETION=true
|
|||||||
export NVM_AUTO_USE=true
|
export NVM_AUTO_USE=true
|
||||||
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
|
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
|
||||||
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
|
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
|
||||||
|
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
|
||||||
|
|
||||||
# If we have go packages, include them to the PATH
|
# If we have go packages, include them to the PATH
|
||||||
if command -v go &> /dev/null; then
|
if command -v go &> /dev/null; then
|
||||||
export GOPATH=$(go env GOPATH);
|
export GOPATH="$XDG_DATA_HOME/go";
|
||||||
|
mkdir -p "$GOPATH"
|
||||||
if [ -d "$GOPATH/bin" ]; then
|
if [ -d "$GOPATH/bin" ]; then
|
||||||
export PATH="$GOPATH/bin:$PATH"
|
export PATH="$GOPATH/bin:$PATH"
|
||||||
fi
|
fi
|
||||||
@@ -161,3 +164,4 @@ fi
|
|||||||
[[ -f "$XDG_BIN_HOME/iterm2_shell_integration.zsh" ]] && source "$XDG_BIN_HOME/iterm2_shell_integration.zsh"
|
[[ -f "$XDG_BIN_HOME/iterm2_shell_integration.zsh" ]] && source "$XDG_BIN_HOME/iterm2_shell_integration.zsh"
|
||||||
|
|
||||||
eval "$(starship init zsh)"
|
eval "$(starship init zsh)"
|
||||||
|
|
||||||
|
|||||||
Submodule config/astronvim/lua/user updated: df9530784f...6409f428be
@@ -5,7 +5,9 @@ export HIST_STAMPS="yyyy-mm-dd"
|
|||||||
# Larger bash history (allow 32³ entries; default is 500)
|
# Larger bash history (allow 32³ entries; default is 500)
|
||||||
export HISTSIZE=32768
|
export HISTSIZE=32768
|
||||||
export HISTFILESIZE=$HISTSIZE
|
export HISTFILESIZE=$HISTSIZE
|
||||||
export HISTCONTROL=ignoredups
|
# don't put duplicate lines or lines starting with space in the history.
|
||||||
|
# See bash(1) for more options
|
||||||
|
export HISTCONTROL=ignoreboth
|
||||||
|
|
||||||
# Make some commands not show up in history
|
# Make some commands not show up in history
|
||||||
export HISTIGNORE="ls:cd:cd -:pwd:exit:date:* --help"
|
export HISTIGNORE="ls:cd:cd -:pwd:exit:date:* --help"
|
||||||
@@ -21,3 +23,9 @@ export MANPAGER="less -X"
|
|||||||
|
|
||||||
# Always enable colored `grep` output
|
# Always enable colored `grep` output
|
||||||
export GREP_OPTIONS="--color=auto"
|
export GREP_OPTIONS="--color=auto"
|
||||||
|
|
||||||
|
# check the window size after each command and, if necessary,
|
||||||
|
# update the values of LINES and COLUMNS.
|
||||||
|
shopt -s checkwinsize
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -65,3 +65,4 @@ function silent
|
|||||||
{
|
{
|
||||||
"$@" >&/dev/null
|
"$@" >&/dev/null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
git_protocol: ssh
|
git_protocol: https
|
||||||
|
|||||||
@@ -52,10 +52,4 @@
|
|||||||
branch = yellow black bold ul
|
branch = yellow black bold ul
|
||||||
|
|
||||||
[submodule]
|
[submodule]
|
||||||
recurse = true
|
recurse = true
|
||||||
[credential "https://github.com"]
|
|
||||||
helper =
|
|
||||||
helper = !/opt/homebrew/bin/gh auth git-credential
|
|
||||||
[credential "https://gist.github.com"]
|
|
||||||
helper =
|
|
||||||
helper = !/opt/homebrew/bin/gh auth git-credential
|
|
||||||
|
|||||||
Submodule config/nvim updated: e283d6749f...291c43b0bd
1
dotbot-ifplatform
Submodule
1
dotbot-ifplatform
Submodule
Submodule dotbot-ifplatform added at e35b5c0d71
@@ -1,7 +0,0 @@
|
|||||||
# ~/.bash_logout: executed by bash(1) when login shell exits.
|
|
||||||
|
|
||||||
# when leaving the console clear the screen to increase privacy
|
|
||||||
|
|
||||||
if [ "$SHLVL" = 1 ]; then
|
|
||||||
[ -x /usr/bin/clear_console ] && /usr/bin/clear_console -q
|
|
||||||
fi
|
|
||||||
@@ -115,3 +115,4 @@ if ! shopt -oq posix; then
|
|||||||
. /etc/bash_completion
|
. /etc/bash_completion
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -72,3 +72,4 @@
|
|||||||
|
|
||||||
[submodule]
|
[submodule]
|
||||||
recurse = true
|
recurse = true
|
||||||
|
|
||||||
|
|||||||
10
install
10
install
@@ -14,10 +14,10 @@ git submodule update --init --recursive
|
|||||||
|
|
||||||
"${BASEDIR}/${DOTBOT_DIR}/${DOTBOT_BIN}" \
|
"${BASEDIR}/${DOTBOT_DIR}/${DOTBOT_BIN}" \
|
||||||
-d "${BASEDIR}" \
|
-d "${BASEDIR}" \
|
||||||
--plugin-dir=dotbot-plugins/dotbot-brew \
|
--plugin-dir=dotbot-brew \
|
||||||
--plugin-dir=dotbot-plugins/dotbot-gh-extension \
|
--plugin-dir=dotbot-gh-extension \
|
||||||
--plugin-dir=dotbot-plugins/dotbot-golang \
|
--plugin-dir=dotbot-golang \
|
||||||
--plugin-dir=dotbot-plugins/dotbot-if \
|
--plugin-dir=dotbot-if \
|
||||||
-p dotbot-plugins/dotbot-if/if.py \
|
--plugin-dir=dotbot-ifplatform \
|
||||||
-c "${CONFIG}" \
|
-c "${CONFIG}" \
|
||||||
"${@}"
|
"${@}"
|
||||||
|
|||||||
26
install-without-plugins
Executable file
26
install-without-plugins
Executable file
@@ -0,0 +1,26 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
CONFIG="install.conf.yaml"
|
||||||
|
DOTBOT_DIR="dotbot"
|
||||||
|
|
||||||
|
DOTBOT_BIN="bin/dotbot"
|
||||||
|
BASEDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
|
||||||
|
cd "$BASEDIR"
|
||||||
|
git submodule sync --quiet --recursive
|
||||||
|
git submodule update --init --recursive
|
||||||
|
|
||||||
|
"${BASEDIR}/${DOTBOT_DIR}/${DOTBOT_BIN}" \
|
||||||
|
-d "${BASEDIR}" \
|
||||||
|
-c "${CONFIG}" \
|
||||||
|
"${@}"
|
||||||
|
|
||||||
|
# --plugin-dir=dotbot-plugins/dotbot-brew \
|
||||||
|
# --plugin-dir=dotbot-plugins/dotbot-gh-extension \
|
||||||
|
# --plugin-dir=dotbot-plugins/dotbot-golang \
|
||||||
|
# --plugin-dir=dotbot-plugins/dotbot-if \
|
||||||
|
# --plugin-dir=dotbot-plugins/dotbot-ifplatform \
|
||||||
|
# -p dotbot-plugins/dotbot-if/if.py \
|
||||||
|
|
||||||
@@ -1,11 +1,10 @@
|
|||||||
---
|
---
|
||||||
- defaults:
|
- defaults:
|
||||||
brew:
|
|
||||||
stderr: true
|
|
||||||
stdout: true
|
|
||||||
brewfile:
|
brewfile:
|
||||||
stderr: true
|
stderr: true
|
||||||
stdout: true
|
stdout: true
|
||||||
|
create:
|
||||||
|
mode: 755
|
||||||
link:
|
link:
|
||||||
create: true
|
create: true
|
||||||
relink: true
|
relink: true
|
||||||
@@ -29,90 +28,90 @@
|
|||||||
- link:
|
- link:
|
||||||
~/.config/:
|
~/.config/:
|
||||||
glob: true
|
glob: true
|
||||||
path: config/**
|
path: config/*
|
||||||
~/.local/bin/:
|
~/.local/bin/:
|
||||||
glob: true
|
glob: true
|
||||||
path: local/bin/**
|
path: local/bin/*
|
||||||
~/.ssh/:
|
~/.ssh/:
|
||||||
force: true
|
force: true
|
||||||
glob: true
|
glob: true
|
||||||
mode: 600
|
mode: 600
|
||||||
path: ssh/**
|
path: ssh/*
|
||||||
~/:
|
~/:
|
||||||
force: true
|
force: true
|
||||||
glob: true
|
glob: true
|
||||||
path: base/**
|
path: base/*
|
||||||
prefix: '.'
|
prefix: "."
|
||||||
|
|
||||||
- shell:
|
- shell:
|
||||||
- [git submodule update --init --recursive --force]
|
- [git submodule update --init --recursive --force]
|
||||||
- [bash scripts/set-macos-defaults.sh]
|
- [bash scripts/install-npm-packages.sh]
|
||||||
- [bash scripts/install-npm-packages.sh]
|
|
||||||
|
|
||||||
- brewfile:
|
- ifmacos:
|
||||||
- Brewfile
|
- shell:
|
||||||
|
- [bash scripts/set-macos-defaults.sh]
|
||||||
- go:
|
- brewfile:
|
||||||
- github.com/skx/sysbox@latest
|
- Brewfile
|
||||||
|
|
||||||
# hosts: air
|
# hosts: air
|
||||||
- if:
|
- if:
|
||||||
- cond: '[[ $(hostname) = air ]]'
|
- cond: "[[ $(hostname) = air ]]"
|
||||||
met:
|
met:
|
||||||
- go:
|
- go:
|
||||||
- github.com/skx/sysbox@latest
|
- github.com/skx/sysbox@latest
|
||||||
|
- github.com/dotzero/git-profile
|
||||||
|
|
||||||
# hosts: v
|
# hosts: v
|
||||||
- if:
|
- if:
|
||||||
- cond: '[[ $(hostname) = v ]]'
|
- cond: "[[ $(hostname) = v ]]"
|
||||||
met:
|
met:
|
||||||
- link:
|
- link:
|
||||||
~/.config/:
|
~/.config/:
|
||||||
glob: true
|
glob: true
|
||||||
force: true
|
force: true
|
||||||
path: hosts/v/config/**
|
path: hosts/v/config/**
|
||||||
- go:
|
- go:
|
||||||
- github.com/skx/sysbox@latest
|
- github.com/skx/sysbox@latest
|
||||||
|
- github.com/dotzero/git-profile
|
||||||
|
|
||||||
|
# hosts tunkki
|
||||||
|
- if:
|
||||||
|
- cond: "[[ $(hostname) = tunkki ]]"
|
||||||
|
met:
|
||||||
|
- go:
|
||||||
|
- github.com/skx/sysbox@latest
|
||||||
|
- github.com/dotzero/git-profile
|
||||||
|
|
||||||
# hosts: lakka
|
# hosts: lakka
|
||||||
- if:
|
- if:
|
||||||
- cond: '[[ $(hostname) = lakka ]]'
|
- cond: "[[ $(hostname) = lakka ]]"
|
||||||
met:
|
met:
|
||||||
- link:
|
- link:
|
||||||
~/.irssi/*:
|
~/.irssi/*:
|
||||||
force: true
|
force: true
|
||||||
glob: true
|
glob: true
|
||||||
path: hosts/lakka/irssi/**
|
path: hosts/lakka/irssi/**
|
||||||
~/.zshrc*:
|
~/.zshrc:
|
||||||
force: true
|
force: true
|
||||||
path: hosts/lakka/zshrc
|
path: hosts/lakka/zshrc
|
||||||
|
|
||||||
# GitHub CLI Extensions
|
# GitHub CLI Extensions
|
||||||
- ghe:
|
- ghe:
|
||||||
# GitHub CLI extension for generating a report on repository dependencies.
|
# GitHub CLI extension for generating a report on repository dependencies.
|
||||||
- andyfeller/gh-dependency-report
|
- andyfeller/gh-dependency-report
|
||||||
# GitHub CLI extension to generate montage from GitHub user avatars
|
# GitHub CLI extension to generate montage from GitHub user avatars
|
||||||
- andyfeller/gh-montage
|
- andyfeller/gh-montage
|
||||||
# An opinionated GitHub Cli extension for creating
|
# An opinionated GitHub Cli extension for creating
|
||||||
# changelogs that adhere to the keep a changelog specification.
|
# changelogs that adhere to the keep a changelog specification.
|
||||||
- chelnak/gh-changelog
|
- chelnak/gh-changelog
|
||||||
# Safely deletes local branches with no upstream and no un-pushed commits
|
# Safely deletes local branches with no upstream and no un-pushed commits
|
||||||
- davidraviv/gh-clean-branches
|
- davidraviv/gh-clean-branches
|
||||||
# A beautiful CLI dashboard for GitHub 🚀
|
# A beautiful CLI dashboard for GitHub 🚀
|
||||||
- dlvhdr/gh-dash
|
- dlvhdr/gh-dash
|
||||||
# GitHub CLI extension for reviewing Dependabot PRs.
|
# A github-cli extension script to clone all repositories
|
||||||
- einride/gh-dependabot
|
# in an organization, optionally filtering by topic.
|
||||||
# A GitHub CLI extension that provides summary pull request metrics.
|
- matt-bartel/gh-clone-org
|
||||||
- hectcastro/gh-metrics
|
# being an extension to view the overall health of
|
||||||
# A github-cli extension script to clone all repositories
|
# an organization's use of actions
|
||||||
# in an organization, optionally filtering by topic.
|
- rsese/gh-actions-status
|
||||||
- matt-bartel/gh-clone-org
|
#
|
||||||
# being an extension to view the overall health of an organization's use of actions
|
|
||||||
- rsese/gh-actions-status
|
|
||||||
- samcoe/gh-triage
|
|
||||||
# Generate account/organization/enterprise reports
|
|
||||||
- stoe/gh-report
|
|
||||||
# Organisation specific extension for gh cli to retrieve different statistics
|
|
||||||
- VildMedPap/gh-orgstats
|
|
||||||
- vilmibm/gh-screensaver
|
|
||||||
- vilmibm/gh-user-status
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ if [[ $ANTIGEN_CACHE != false ]]; then
|
|||||||
for config in $ANTIGEN_CHECK_FILES; do
|
for config in $ANTIGEN_CHECK_FILES; do
|
||||||
if [[ "$config" -nt "$config.zwc" ]]; then
|
if [[ "$config" -nt "$config.zwc" ]]; then
|
||||||
# Flag configuration file as newer
|
# Flag configuration file as newer
|
||||||
{ zcompile "$config"; } &!
|
{ zcompile "$config" } &!
|
||||||
# Kill cache file in order to force full loading (see a few lines below)
|
# Kill cache file in order to force full loading (see a few lines below)
|
||||||
[[ -f "$ANTIGEN_CACHE" ]] && rm -f "$ANTIGEN_CACHE"
|
[[ -f "$ANTIGEN_CACHE" ]] && rm -f "$ANTIGEN_CACHE"
|
||||||
fi
|
fi
|
||||||
@@ -151,7 +151,7 @@ antigen () {
|
|||||||
# String if record is found
|
# String if record is found
|
||||||
-antigen-find-record () {
|
-antigen-find-record () {
|
||||||
local bundle=$1
|
local bundle=$1
|
||||||
|
|
||||||
if [[ $# -eq 0 ]]; then
|
if [[ $# -eq 0 ]]; then
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
@@ -255,7 +255,7 @@ antigen () {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
# This function check ZSH_EVAL_CONTEXT to determine if running in interactive shell.
|
# This function check ZSH_EVAL_CONTEXT to determine if running in interactive shell.
|
||||||
#
|
#
|
||||||
# Usage
|
# Usage
|
||||||
# -antigen-interactive-mode
|
# -antigen-interactive-mode
|
||||||
@@ -283,7 +283,7 @@ antigen () {
|
|||||||
# Branch name
|
# Branch name
|
||||||
-antigen-parse-branch () {
|
-antigen-parse-branch () {
|
||||||
local url="$1" branch="$2" branches
|
local url="$1" branch="$2" branches
|
||||||
|
|
||||||
local match mbegin mend MATCH MBEGIN MEND
|
local match mbegin mend MATCH MBEGIN MEND
|
||||||
|
|
||||||
if [[ "$branch" =~ '\*' ]]; then
|
if [[ "$branch" =~ '\*' ]]; then
|
||||||
@@ -466,7 +466,7 @@ antigen () {
|
|||||||
|
|
||||||
# Compatibility with oh-my-zsh themes.
|
# Compatibility with oh-my-zsh themes.
|
||||||
-antigen-set-default _ANTIGEN_THEME_COMPAT true
|
-antigen-set-default _ANTIGEN_THEME_COMPAT true
|
||||||
|
|
||||||
# Add default built-in extensions to load at start up
|
# Add default built-in extensions to load at start up
|
||||||
-antigen-set-default _ANTIGEN_BUILTIN_EXTENSIONS 'lock parallel defer cache'
|
-antigen-set-default _ANTIGEN_BUILTIN_EXTENSIONS 'lock parallel defer cache'
|
||||||
|
|
||||||
@@ -555,7 +555,7 @@ antigen () {
|
|||||||
if [[ $#list == 0 ]]; then
|
if [[ $#list == 0 ]]; then
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Using a for rather than `source $list` as we need to check for zsh-themes
|
# Using a for rather than `source $list` as we need to check for zsh-themes
|
||||||
# In order to create antigen-compat file. This is only needed for interactive-mode
|
# In order to create antigen-compat file. This is only needed for interactive-mode
|
||||||
# theme switching, for static loading (cache) there is no need.
|
# theme switching, for static loading (cache) there is no need.
|
||||||
@@ -643,7 +643,7 @@ antigen () {
|
|||||||
|
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
|
|
||||||
# Check if url is just the plugin name. Super short syntax.
|
# Check if url is just the plugin name. Super short syntax.
|
||||||
if [[ "${args[url]}" != */* ]]; then
|
if [[ "${args[url]}" != */* ]]; then
|
||||||
case "$ANTIGEN_DEFAULT_REPO_URL" in
|
case "$ANTIGEN_DEFAULT_REPO_URL" in
|
||||||
@@ -728,13 +728,13 @@ antigen () {
|
|||||||
# if it's local then path is just the "url" argument, loc remains the same
|
# if it's local then path is just the "url" argument, loc remains the same
|
||||||
args[dir]=${args[url]}
|
args[dir]=${args[url]}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Escape url and branch (may contain semver-like and pipe characters)
|
# Escape url and branch (may contain semver-like and pipe characters)
|
||||||
args[url]="${(qq)args[url]}"
|
args[url]="${(qq)args[url]}"
|
||||||
if [[ -n "${args[branch]}" ]]; then
|
if [[ -n "${args[branch]}" ]]; then
|
||||||
args[branch]="${(qq)args[branch]}"
|
args[branch]="${(qq)args[branch]}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Escape bundle name (may contain semver-like characters)
|
# Escape bundle name (may contain semver-like characters)
|
||||||
args[name]="${(qq)args[name]}"
|
args[name]="${(qq)args[name]}"
|
||||||
|
|
||||||
@@ -821,7 +821,7 @@ antigen-bundle () {
|
|||||||
printf "Seems %s is already installed!\n" ${bundle[name]}
|
printf "Seems %s is already installed!\n" ${bundle[name]}
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Clone bundle if we haven't done do already.
|
# Clone bundle if we haven't done do already.
|
||||||
if [[ ! -d "${bundle[dir]}" ]]; then
|
if [[ ! -d "${bundle[dir]}" ]]; then
|
||||||
if ! -antigen-bundle-install ${(kv)bundle}; then
|
if ! -antigen-bundle-install ${(kv)bundle}; then
|
||||||
@@ -835,7 +835,7 @@ antigen-bundle () {
|
|||||||
printf "Antigen: Failed to load %s.\n" ${bundle[btype]} >&2
|
printf "Antigen: Failed to load %s.\n" ${bundle[btype]} >&2
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Only add it to the record if it could be installed and loaded.
|
# Only add it to the record if it could be installed and loaded.
|
||||||
_ANTIGEN_BUNDLE_RECORD+=("$record")
|
_ANTIGEN_BUNDLE_RECORD+=("$record")
|
||||||
}
|
}
|
||||||
@@ -1326,7 +1326,7 @@ antigen-update () {
|
|||||||
local url=""
|
local url=""
|
||||||
local make_local_clone=""
|
local make_local_clone=""
|
||||||
local start=$(date +'%s')
|
local start=$(date +'%s')
|
||||||
|
|
||||||
if [[ $# -eq 0 ]]; then
|
if [[ $# -eq 0 ]]; then
|
||||||
printf "Antigen: Missing argument.\n" >&2
|
printf "Antigen: Missing argument.\n" >&2
|
||||||
return 1
|
return 1
|
||||||
@@ -1340,14 +1340,14 @@ antigen-update () {
|
|||||||
|
|
||||||
url="$(echo "$record" | cut -d' ' -f1)"
|
url="$(echo "$record" | cut -d' ' -f1)"
|
||||||
make_local_clone=$(echo "$record" | cut -d' ' -f4)
|
make_local_clone=$(echo "$record" | cut -d' ' -f4)
|
||||||
|
|
||||||
local branch="master"
|
local branch="master"
|
||||||
if [[ $url == *\|* ]]; then
|
if [[ $url == *\|* ]]; then
|
||||||
branch="$(-antigen-parse-branch ${url%|*} ${url#*|})"
|
branch="$(-antigen-parse-branch ${url%|*} ${url#*|})"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
printf "Updating %s... " $(-antigen-bundle-short-name "$url" "$branch")
|
printf "Updating %s... " $(-antigen-bundle-short-name "$url" "$branch")
|
||||||
|
|
||||||
if [[ $make_local_clone == "false" ]]; then
|
if [[ $make_local_clone == "false" ]]; then
|
||||||
printf "Bundle has no local clone. Will not be updated.\n" >&2
|
printf "Bundle has no local clone. Will not be updated.\n" >&2
|
||||||
return 1
|
return 1
|
||||||
@@ -1358,7 +1358,7 @@ antigen-update () {
|
|||||||
printf "Error! Activate logging and try again.\n" >&2
|
printf "Error! Activate logging and try again.\n" >&2
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local took=$(( $(date +'%s') - $start ))
|
local took=$(( $(date +'%s') - $start ))
|
||||||
printf "Done. Took %ds.\n" $took
|
printf "Done. Took %ds.\n" $took
|
||||||
}
|
}
|
||||||
@@ -1410,7 +1410,7 @@ typeset -g _ANTIGEN_EXTENSIONS; _ANTIGEN_EXTENSIONS=()
|
|||||||
# -antigen-add-hook antigen-apply antigen-apply-hook ["replace"|"pre"|"post"] ["once"|"repeat"]
|
# -antigen-add-hook antigen-apply antigen-apply-hook ["replace"|"pre"|"post"] ["once"|"repeat"]
|
||||||
antigen-add-hook () {
|
antigen-add-hook () {
|
||||||
local target="$1" hook="$2" type="$3" mode="${4:-repeat}"
|
local target="$1" hook="$2" type="$3" mode="${4:-repeat}"
|
||||||
|
|
||||||
if (( ! $+functions[$target] )); then
|
if (( ! $+functions[$target] )); then
|
||||||
printf "Antigen: Function %s doesn't exist.\n" $target
|
printf "Antigen: Function %s doesn't exist.\n" $target
|
||||||
return 1
|
return 1
|
||||||
@@ -1428,7 +1428,7 @@ antigen-add-hook () {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
_ANTIGEN_HOOKS_META[$hook]="target $target type $type mode $mode called 0"
|
_ANTIGEN_HOOKS_META[$hook]="target $target type $type mode $mode called 0"
|
||||||
|
|
||||||
# Do shadow for this function if there is none already
|
# Do shadow for this function if there is none already
|
||||||
local hook_function="${_ANTIGEN_HOOK_PREFIX}$target"
|
local hook_function="${_ANTIGEN_HOOK_PREFIX}$target"
|
||||||
if (( ! $+functions[$hook_function] )); then
|
if (( ! $+functions[$hook_function] )); then
|
||||||
@@ -1441,7 +1441,7 @@ antigen-add-hook () {
|
|||||||
return \$?
|
return \$?
|
||||||
}"
|
}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1454,7 +1454,7 @@ antigen-add-hook () {
|
|||||||
|
|
||||||
typeset -a pre_hooks replace_hooks post_hooks;
|
typeset -a pre_hooks replace_hooks post_hooks;
|
||||||
typeset -a hooks; hooks=(${(s|:|)_ANTIGEN_HOOKS[$target]})
|
typeset -a hooks; hooks=(${(s|:|)_ANTIGEN_HOOKS[$target]})
|
||||||
|
|
||||||
typeset -A meta;
|
typeset -A meta;
|
||||||
for hook in $hooks; do
|
for hook in $hooks; do
|
||||||
meta=(${(s: :)_ANTIGEN_HOOKS_META[$hook]})
|
meta=(${(s: :)_ANTIGEN_HOOKS_META[$hook]})
|
||||||
@@ -1500,7 +1500,7 @@ antigen-add-hook () {
|
|||||||
[[ $? == -1 ]] && WARN "$hook shortcircuited" && return $ret
|
[[ $? == -1 ]] && WARN "$hook shortcircuited" && return $ret
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
if [[ $replace_hook == 0 ]]; then
|
if [[ $replace_hook == 0 ]]; then
|
||||||
WARN "${_ANTIGEN_HOOK_PREFIX}$target $args"
|
WARN "${_ANTIGEN_HOOK_PREFIX}$target $args"
|
||||||
noglob ${_ANTIGEN_HOOK_PREFIX}$target $args
|
noglob ${_ANTIGEN_HOOK_PREFIX}$target $args
|
||||||
@@ -1514,7 +1514,7 @@ antigen-add-hook () {
|
|||||||
noglob $hook $args
|
noglob $hook $args
|
||||||
[[ $? == -1 ]] && WARN "$hook shortcircuited" && return $ret
|
[[ $? == -1 ]] && WARN "$hook shortcircuited" && return $ret
|
||||||
done
|
done
|
||||||
|
|
||||||
LOG "Return from hook ${target} with ${ret}"
|
LOG "Return from hook ${target} with ${ret}"
|
||||||
|
|
||||||
return $ret
|
return $ret
|
||||||
@@ -1533,7 +1533,7 @@ antigen-remove-hook () {
|
|||||||
hooks[$hooks[(I)$hook]]=()
|
hooks[$hooks[(I)$hook]]=()
|
||||||
fi
|
fi
|
||||||
_ANTIGEN_HOOKS[${target}]="${(j|:|)hooks}"
|
_ANTIGEN_HOOKS[${target}]="${(j|:|)hooks}"
|
||||||
|
|
||||||
if [[ $#hooks == 0 ]]; then
|
if [[ $#hooks == 0 ]]; then
|
||||||
# Destroy base hook
|
# Destroy base hook
|
||||||
eval "function $(functions -- ${_ANTIGEN_HOOK_PREFIX}$target | sed s/${_ANTIGEN_HOOK_PREFIX}//)"
|
eval "function $(functions -- ${_ANTIGEN_HOOK_PREFIX}$target | sed s/${_ANTIGEN_HOOK_PREFIX}//)"
|
||||||
@@ -1554,7 +1554,7 @@ antigen-remove-hook () {
|
|||||||
eval "function $(functions -- ${_ANTIGEN_HOOK_PREFIX}$target | sed s/${_ANTIGEN_HOOK_PREFIX}//)"
|
eval "function $(functions -- ${_ANTIGEN_HOOK_PREFIX}$target | sed s/${_ANTIGEN_HOOK_PREFIX}//)"
|
||||||
unfunction -- "${_ANTIGEN_HOOK_PREFIX}$target" 2> /dev/null
|
unfunction -- "${_ANTIGEN_HOOK_PREFIX}$target" 2> /dev/null
|
||||||
done
|
done
|
||||||
|
|
||||||
_ANTIGEN_HOOKS=()
|
_ANTIGEN_HOOKS=()
|
||||||
_ANTIGEN_HOOKS_META=()
|
_ANTIGEN_HOOKS_META=()
|
||||||
_ANTIGEN_EXTENSIONS=()
|
_ANTIGEN_EXTENSIONS=()
|
||||||
@@ -1570,14 +1570,14 @@ antigen-ext () {
|
|||||||
eval $func
|
eval $func
|
||||||
local ret=$?
|
local ret=$?
|
||||||
WARN "$func return code was $ret"
|
WARN "$func return code was $ret"
|
||||||
if (( $ret == 0 )); then
|
if (( $ret == 0 )); then
|
||||||
LOG "LOADED EXTENSION $ext" EXT
|
LOG "LOADED EXTENSION $ext" EXT
|
||||||
-antigen-$ext-execute && _ANTIGEN_EXTENSIONS+=($ext)
|
-antigen-$ext-execute && _ANTIGEN_EXTENSIONS+=($ext)
|
||||||
else
|
else
|
||||||
WARN "IGNORING EXTENSION $func" EXT
|
WARN "IGNORING EXTENSION $func" EXT
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
else
|
else
|
||||||
printf "Antigen: No extension defined or already loaded: %s\n" $func >&2
|
printf "Antigen: No extension defined or already loaded: %s\n" $func >&2
|
||||||
return 1
|
return 1
|
||||||
@@ -1617,7 +1617,7 @@ antigen-ext-init () {
|
|||||||
return -1 # Stop right there
|
return -1 # Stop right there
|
||||||
}
|
}
|
||||||
antigen-add-hook antigen-bundle antigen-bundle-defer replace
|
antigen-add-hook antigen-bundle antigen-bundle-defer replace
|
||||||
|
|
||||||
# Hooks antigen-apply in order to release hooked functions
|
# Hooks antigen-apply in order to release hooked functions
|
||||||
antigen-apply-defer () {
|
antigen-apply-defer () {
|
||||||
WARN "Defer pre-apply" DEFER PRE-APPLY
|
WARN "Defer pre-apply" DEFER PRE-APPLY
|
||||||
@@ -1639,14 +1639,14 @@ antigen-ext-init () {
|
|||||||
# Default lock path.
|
# Default lock path.
|
||||||
-antigen-set-default ANTIGEN_LOCK $ADOTDIR/.lock
|
-antigen-set-default ANTIGEN_LOCK $ADOTDIR/.lock
|
||||||
typeset -g _ANTIGEN_LOCK_PROCESS=false
|
typeset -g _ANTIGEN_LOCK_PROCESS=false
|
||||||
|
|
||||||
# Use env variable to determine if we should load this extension
|
# Use env variable to determine if we should load this extension
|
||||||
-antigen-set-default ANTIGEN_MUTEX true
|
-antigen-set-default ANTIGEN_MUTEX true
|
||||||
# Set ANTIGEN_MUTEX to false to avoid loading this extension
|
# Set ANTIGEN_MUTEX to false to avoid loading this extension
|
||||||
if [[ $ANTIGEN_MUTEX == true ]]; then
|
if [[ $ANTIGEN_MUTEX == true ]]; then
|
||||||
return 0;
|
return 0;
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Do not use mutex
|
# Do not use mutex
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -1714,7 +1714,7 @@ antigen-ext-init () {
|
|||||||
else
|
else
|
||||||
WARN "Bundle ${bundle[name]} already cloned locally." PARALLEL
|
WARN "Bundle ${bundle[name]} already cloned locally." PARALLEL
|
||||||
fi
|
fi
|
||||||
|
|
||||||
repositories+=(${bundle[url]})
|
repositories+=(${bundle[url]})
|
||||||
done
|
done
|
||||||
|
|
||||||
@@ -1734,7 +1734,7 @@ antigen-ext-init () {
|
|||||||
for bundle in ${_PARALLEL_BUNDLE[@]}; do
|
for bundle in ${_PARALLEL_BUNDLE[@]}; do
|
||||||
antigen-bundle $bundle
|
antigen-bundle $bundle
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
WARN "Parallel install done" PARALLEL
|
WARN "Parallel install done" PARALLEL
|
||||||
}
|
}
|
||||||
@@ -1751,7 +1751,7 @@ antigen-ext-init () {
|
|||||||
antigen-add-hook antigen-bundle antigen-bundle-parallel replace
|
antigen-add-hook antigen-bundle antigen-bundle-parallel replace
|
||||||
}
|
}
|
||||||
antigen-add-hook antigen-apply antigen-apply-parallel pre once
|
antigen-add-hook antigen-apply antigen-apply-parallel pre once
|
||||||
|
|
||||||
antigen-apply-parallel-execute () {
|
antigen-apply-parallel-execute () {
|
||||||
WARN "Parallel replace-apply" PARALLEL REPLACE-APPLY
|
WARN "Parallel replace-apply" PARALLEL REPLACE-APPLY
|
||||||
antigen-remove-hook antigen-bundle-parallel
|
antigen-remove-hook antigen-bundle-parallel
|
||||||
@@ -1872,14 +1872,14 @@ EOC
|
|||||||
|
|
||||||
# Cache auto config files to check for changes (.zshrc, .antigenrc etc)
|
# Cache auto config files to check for changes (.zshrc, .antigenrc etc)
|
||||||
-antigen-set-default ANTIGEN_AUTO_CONFIG true
|
-antigen-set-default ANTIGEN_AUTO_CONFIG true
|
||||||
|
|
||||||
# Default cache path.
|
# Default cache path.
|
||||||
-antigen-set-default ANTIGEN_CACHE $ADOTDIR/init.zsh
|
-antigen-set-default ANTIGEN_CACHE $ADOTDIR/init.zsh
|
||||||
-antigen-set-default ANTIGEN_RSRC $ADOTDIR/.resources
|
-antigen-set-default ANTIGEN_RSRC $ADOTDIR/.resources
|
||||||
if [[ $ANTIGEN_CACHE == false ]]; then
|
if [[ $ANTIGEN_CACHE == false ]]; then
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1911,21 +1911,21 @@ EOC
|
|||||||
antigen-remove-hook -antigen-load-source-cached
|
antigen-remove-hook -antigen-load-source-cached
|
||||||
antigen-remove-hook antigen-bundle-cached
|
antigen-remove-hook antigen-bundle-cached
|
||||||
}
|
}
|
||||||
|
|
||||||
antigen-add-hook antigen-apply antigen-apply-cached post once
|
antigen-add-hook antigen-apply antigen-apply-cached post once
|
||||||
|
|
||||||
# Defer antigen-bundle.
|
# Defer antigen-bundle.
|
||||||
antigen-bundle-cached () {
|
antigen-bundle-cached () {
|
||||||
_ZCACHE_CAPTURE_BUNDLE+=("${(j: :)${@}}")
|
_ZCACHE_CAPTURE_BUNDLE+=("${(j: :)${@}}")
|
||||||
}
|
}
|
||||||
antigen-add-hook antigen-bundle antigen-bundle-cached pre
|
antigen-add-hook antigen-bundle antigen-bundle-cached pre
|
||||||
|
|
||||||
# Defer loading.
|
# Defer loading.
|
||||||
-antigen-load-env-cached () {
|
-antigen-load-env-cached () {
|
||||||
local bundle
|
local bundle
|
||||||
typeset -A bundle; bundle=($@)
|
typeset -A bundle; bundle=($@)
|
||||||
local location=${bundle[dir]}/${bundle[loc]}
|
local location=${bundle[dir]}/${bundle[loc]}
|
||||||
|
|
||||||
# Load to path if there is no sourceable
|
# Load to path if there is no sourceable
|
||||||
if [[ ${bundle[loc]} == "/" ]]; then
|
if [[ ${bundle[loc]} == "/" ]]; then
|
||||||
_ZCACHE_BUNDLE_SOURCE+=("${location}")
|
_ZCACHE_BUNDLE_SOURCE+=("${location}")
|
||||||
@@ -1935,13 +1935,13 @@ EOC
|
|||||||
_ZCACHE_BUNDLE_SOURCE+=("${location}")
|
_ZCACHE_BUNDLE_SOURCE+=("${location}")
|
||||||
}
|
}
|
||||||
antigen-add-hook -antigen-load-env -antigen-load-env-cached replace
|
antigen-add-hook -antigen-load-env -antigen-load-env-cached replace
|
||||||
|
|
||||||
# Defer sourcing.
|
# Defer sourcing.
|
||||||
-antigen-load-source-cached () {
|
-antigen-load-source-cached () {
|
||||||
_ZCACHE_BUNDLE_SOURCE+=($@)
|
_ZCACHE_BUNDLE_SOURCE+=($@)
|
||||||
}
|
}
|
||||||
antigen-add-hook -antigen-load-source -antigen-load-source-cached replace
|
antigen-add-hook -antigen-load-source -antigen-load-source-cached replace
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ function section_install
|
|||||||
all)
|
all)
|
||||||
$0 install antigen
|
$0 install antigen
|
||||||
$0 install starship
|
$0 install starship
|
||||||
|
$0 install nvm
|
||||||
$0 install macos
|
$0 install macos
|
||||||
$0 install npm
|
$0 install npm
|
||||||
;;
|
;;
|
||||||
@@ -33,7 +34,10 @@ function section_install
|
|||||||
curl -L git.io/antigen > "$DOTFILES/local/bin/antigen.zsh" && msg_done "🎉 New antigen installed!"
|
curl -L git.io/antigen > "$DOTFILES/local/bin/antigen.zsh" && msg_done "🎉 New antigen installed!"
|
||||||
;;
|
;;
|
||||||
starship)
|
starship)
|
||||||
curl -sS https://starship.rs/install.sh | sh && msg_done "🎉 starship installed!"
|
curl -sS https://starship.rs/install.sh | sh -s -- --bin-dir ~/.local/bin && msg_done "🎉 starship installed!"
|
||||||
|
;;
|
||||||
|
nvm)
|
||||||
|
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash && msg_done " ^=^n^i nvm installed!"
|
||||||
;;
|
;;
|
||||||
macos)
|
macos)
|
||||||
bash "$DOTFILES/scripts/set-macos-defaults.sh" && msg_done "🎉 Brewfile defined apps has been installed!"
|
bash "$DOTFILES/scripts/set-macos-defaults.sh" && msg_done "🎉 Brewfile defined apps has been installed!"
|
||||||
@@ -120,7 +124,7 @@ function section_dotfiles
|
|||||||
shfmt)
|
shfmt)
|
||||||
# Format shell scripts according to following rules.
|
# Format shell scripts according to following rules.
|
||||||
find "$DOTFILES" \
|
find "$DOTFILES" \
|
||||||
\( -name '*.sh' -or -name '*.zsh' -or -name 'x-*' -or -not '*.pl' \) \
|
\( -name '*.sh' -or -name '*.zsh' -or -name 'x-*' \) \
|
||||||
-exec shfmt -fn -l -w -i 2 -ci -sr -bn {} \;
|
-exec shfmt -fn -l -w -i 2 -ci -sr -bn {} \;
|
||||||
msg_done "🎉 dotfiles have been formatted!"
|
msg_done "🎉 dotfiles have been formatted!"
|
||||||
;;
|
;;
|
||||||
@@ -205,3 +209,4 @@ case "$1" in
|
|||||||
tests) section_tests "$2" ;;
|
tests) section_tests "$2" ;;
|
||||||
*) usage && exit 0 ;;
|
*) usage && exit 0 ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
|||||||
@@ -80,3 +80,4 @@ trap 'case $? in
|
|||||||
esac' EXIT
|
esac' EXIT
|
||||||
|
|
||||||
gitdirtyrepos "$GIT_DIRTY_DIR"
|
gitdirtyrepos "$GIT_DIRTY_DIR"
|
||||||
|
|
||||||
|
|||||||
25
local/bin/x-backup-folder.sh
Executable file
25
local/bin/x-backup-folder.sh
Executable file
@@ -0,0 +1,25 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
DIRECTORY=$1
|
||||||
|
FILENAME=$2
|
||||||
|
|
||||||
|
if [ -z "${DIRECTORY}" ]; then
|
||||||
|
echo "DIRECTORY (first argument) is missing"
|
||||||
|
echo "Usage: $0 folder_to_backup"
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "${FILENAME}" ]; then
|
||||||
|
FILENAME=$DIRECTORY
|
||||||
|
fi
|
||||||
|
|
||||||
|
FILENAME=${FILENAME} | \
|
||||||
|
tr '/' _ | \
|
||||||
|
iconv -t ascii//TRANSLIT | \
|
||||||
|
sed -r s/[^a-zA-Z0-9]+/_/g | \
|
||||||
|
sed -r s/^_+\|-+$//g
|
||||||
|
|
||||||
|
TIMESTAMP=$(date "+%Y%m%d_%H%M%S")
|
||||||
|
FILENAME_TIMESTAMP="${FILENAME}_${TIMESTAMP}"
|
||||||
|
|
||||||
|
tar cvzf "${FILENAME_TIMESTAMP}.tar.gz" "${DIRECTORY}/"
|
||||||
@@ -35,9 +35,10 @@ TIMESTAMP=$(date "+%Y%m%d_%H%M%S")
|
|||||||
FILENAME_TIMESTAMP="${DATABASE}_${FILENAME}_${TIMESTAMP}.sql"
|
FILENAME_TIMESTAMP="${DATABASE}_${FILENAME}_${TIMESTAMP}.sql"
|
||||||
|
|
||||||
mysqldump \
|
mysqldump \
|
||||||
${DATABASE} \
|
"${DATABASE}" \
|
||||||
"$(
|
"$(
|
||||||
echo "show tables like '${PREFIX}%';" \
|
echo "show tables like '${PREFIX}%';" \
|
||||||
| mysql ${DATABASE} \
|
| mysql "${DATABASE}" \
|
||||||
| sed '/Tables_in/d'
|
| sed '/Tables_in/d'
|
||||||
)" > "${FILENAME_TIMESTAMP}"
|
)" > "${FILENAME_TIMESTAMP}"
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
if ! command -v git &> /dev/null; then
|
if ! command -v git &> /dev/null; then
|
||||||
echo "git could not be found, please install it first"
|
echo "git could not be found, please install it first"
|
||||||
exit
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
missing_attributes=$(git ls-files | git check-attr -a --stdin | grep "text: auto")
|
missing_attributes=$(git ls-files | git check-attr -a --stdin | grep "text: auto")
|
||||||
@@ -17,3 +17,4 @@ if [[ "$missing_attributes" ]]; then
|
|||||||
else
|
else
|
||||||
echo "All files have a corresponding rule in .gitattributes"
|
echo "All files have a corresponding rule in .gitattributes"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -206,3 +206,4 @@ sub parsedOptions
|
|||||||
return (%vars);
|
return (%vars);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,3 +14,4 @@ for dir in $($cmd); do
|
|||||||
eval "$@" # allow multiple commands like "foo && bar"
|
eval "$@" # allow multiple commands like "foo && bar"
|
||||||
)
|
)
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|||||||
166
local/bin/x-git-largest-files.py
Executable file
166
local/bin/x-git-largest-files.py
Executable file
@@ -0,0 +1,166 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Python script to find the largest files in a git repository.
|
||||||
|
# The general method is based on the script in this blog post:
|
||||||
|
# http://stubbisms.wordpress.com/2009/07/10/git-script-to-show-largest-pack-objects-and-trim-your-waist-line/
|
||||||
|
#
|
||||||
|
# The above script worked for me, but was very slow on my 11GB repository. This version has a bunch
|
||||||
|
# of changes to speed things up to a more reasonable time. It takes less than a minute on repos with 250K objects.
|
||||||
|
#
|
||||||
|
# The MIT License (MIT)
|
||||||
|
# Copyright (c) 2015 Nick Kocharhook
|
||||||
|
#
|
||||||
|
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
|
||||||
|
# associated documentation files (the "Software"), to deal in the Software without restriction,
|
||||||
|
# including without limitation the rights to use, copy, modify, merge, publish, distribute,
|
||||||
|
# sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
|
||||||
|
# furnished to do so, subject to the following conditions:
|
||||||
|
#
|
||||||
|
# The above copyright notice and this permission notice shall be included in all copies or
|
||||||
|
# substantial portions of the Software.
|
||||||
|
#
|
||||||
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
|
||||||
|
# NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||||
|
# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT
|
||||||
|
# OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
|
|
||||||
|
from subprocess import check_output, CalledProcessError, Popen, PIPE
|
||||||
|
import argparse
|
||||||
|
import signal
|
||||||
|
import sys
|
||||||
|
|
||||||
|
sortByOnDiskSize = False
|
||||||
|
|
||||||
|
def main():
|
||||||
|
global sortByOnDiskSize
|
||||||
|
|
||||||
|
signal.signal(signal.SIGINT, signal_handler)
|
||||||
|
|
||||||
|
args = parseArguments()
|
||||||
|
sortByOnDiskSize = args.sortByOnDiskSize
|
||||||
|
sizeLimit = 1024*args.filesExceeding
|
||||||
|
|
||||||
|
if args.filesExceeding > 0:
|
||||||
|
print "Finding objects larger than {}kB…".format(args.filesExceeding)
|
||||||
|
else:
|
||||||
|
print "Finding the {} largest objects…".format(args.matchCount)
|
||||||
|
|
||||||
|
blobs = getTopBlobs(args.matchCount, sizeLimit)
|
||||||
|
|
||||||
|
populateBlobPaths(blobs)
|
||||||
|
printOutBlobs(blobs)
|
||||||
|
|
||||||
|
def getTopBlobs(count, sizeLimit):
|
||||||
|
sortColumn = 4
|
||||||
|
|
||||||
|
if sortByOnDiskSize:
|
||||||
|
sortColumn = 3
|
||||||
|
|
||||||
|
verifyPack = "git verify-pack -v `git rev-parse --git-dir`/objects/pack/pack-*.idx | grep blob | sort -k{}nr".format(sortColumn)
|
||||||
|
output = check_output(verifyPack, shell=True).split("\n")[:-1]
|
||||||
|
|
||||||
|
blobs = dict()
|
||||||
|
compareBlob = Blob("a b {} {} c".format(sizeLimit, sizeLimit)) # use __lt__ to do the appropriate comparison
|
||||||
|
|
||||||
|
for objLine in output:
|
||||||
|
blob = Blob(objLine)
|
||||||
|
|
||||||
|
if sizeLimit > 0:
|
||||||
|
if compareBlob < blob:
|
||||||
|
blobs[blob.sha1] = blob
|
||||||
|
else:
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
blobs[blob.sha1] = blob
|
||||||
|
|
||||||
|
if len(blobs) == count:
|
||||||
|
break
|
||||||
|
|
||||||
|
return blobs
|
||||||
|
|
||||||
|
|
||||||
|
def populateBlobPaths(blobs):
|
||||||
|
if len(blobs):
|
||||||
|
print "Finding object paths…"
|
||||||
|
|
||||||
|
# Only include revs which have a path. Other revs aren't blobs.
|
||||||
|
revList = "git rev-list --all --objects | awk '$2 {print}'"
|
||||||
|
allObjectLines = check_output(revList, shell=True).split("\n")[:-1]
|
||||||
|
|
||||||
|
outstandingKeys = blobs.keys()
|
||||||
|
|
||||||
|
for line in allObjectLines:
|
||||||
|
cols = line.split()
|
||||||
|
sha1, path = cols[0], " ".join(cols[1:])
|
||||||
|
|
||||||
|
if (sha1 in outstandingKeys):
|
||||||
|
outstandingKeys.remove(sha1)
|
||||||
|
blobs[sha1].path = path
|
||||||
|
|
||||||
|
# short-circuit the search if we're done
|
||||||
|
if not len(outstandingKeys):
|
||||||
|
break
|
||||||
|
|
||||||
|
|
||||||
|
def printOutBlobs(blobs):
|
||||||
|
if len(blobs):
|
||||||
|
csvLines = ["size,pack,hash,path"]
|
||||||
|
|
||||||
|
for blob in sorted(blobs.values(), reverse=True):
|
||||||
|
csvLines.append(blob.csvLine())
|
||||||
|
|
||||||
|
p = Popen(["column", "-t", "-s", "','"], stdin=PIPE, stdout=PIPE, stderr=PIPE)
|
||||||
|
stdout, stderr = p.communicate("\n".join(csvLines)+"\n")
|
||||||
|
|
||||||
|
print "\nAll sizes in kB. The pack column is the compressed size of the object inside the pack file.\n"
|
||||||
|
print stdout.rstrip('\n')
|
||||||
|
else:
|
||||||
|
print "No files found which match those criteria."
|
||||||
|
|
||||||
|
|
||||||
|
def parseArguments():
|
||||||
|
parser = argparse.ArgumentParser(description='List the largest files in a git repository')
|
||||||
|
parser.add_argument('-c', '--match-count', dest='matchCount', type=int, default=10,
|
||||||
|
help='The number of files to return. Default is 10. Ignored if --files-exceeding is used.')
|
||||||
|
parser.add_argument('--files-exceeding', dest='filesExceeding', type=int, default=0,
|
||||||
|
help='The cutoff amount, in KB. Files with a pack size (or pyhsical size, with -p) larger than this will be printed.')
|
||||||
|
parser.add_argument('-p', '--physical-sort', dest='sortByOnDiskSize', action='store_true', default=False,
|
||||||
|
help='Sort by the on-disk size of the files. Default is to sort by the pack size.')
|
||||||
|
|
||||||
|
return parser.parse_args()
|
||||||
|
|
||||||
|
|
||||||
|
def signal_handler(signal, frame):
|
||||||
|
print('Caught Ctrl-C. Exiting.')
|
||||||
|
sys.exit(0)
|
||||||
|
|
||||||
|
|
||||||
|
class Blob(object):
|
||||||
|
sha1 = ''
|
||||||
|
size = 0
|
||||||
|
packedSize = 0
|
||||||
|
path = ''
|
||||||
|
|
||||||
|
def __init__(self, line):
|
||||||
|
cols = line.split()
|
||||||
|
self.sha1, self.size, self.packedSize = cols[0], int(cols[2]), int(cols[3])
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
return '{} - {} - {} - {}'.format(self.sha1, self.size, self.packedSize, self.path)
|
||||||
|
|
||||||
|
def __lt__(self, other):
|
||||||
|
if (sortByOnDiskSize):
|
||||||
|
return self.size < other.size
|
||||||
|
else:
|
||||||
|
return self.packedSize < other.packedSize
|
||||||
|
|
||||||
|
def csvLine(self):
|
||||||
|
return "{},{},{},{}".format(self.size/1024, self.packedSize/1024, self.sha1, self.path)
|
||||||
|
|
||||||
|
|
||||||
|
# Default function is main()
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
||||||
@@ -226,3 +226,4 @@ sub parsedOptions
|
|||||||
return (%vars);
|
return (%vars);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
# List open (listened) ports, without the crud that
|
# List open (listened) ports, without the crud that
|
||||||
# usually comes with `lsof -i`
|
# usually comes with `lsof -i`
|
||||||
#
|
#
|
||||||
|
# Modified by: Ismo Vuorinen <https://github.com/ivuorinen> 2020
|
||||||
# Originally from: https://www.commandlinefu.com/commands/view/8951
|
# Originally from: https://www.commandlinefu.com/commands/view/8951
|
||||||
# Original author: https://www.commandlinefu.com/commands/by/wickedcpj
|
# Original author: https://www.commandlinefu.com/commands/by/wickedcpj
|
||||||
#
|
#
|
||||||
@@ -18,3 +19,4 @@ lsof -i 4 -P -n +c 0 \
|
|||||||
| uniq
|
| uniq
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
|
|||||||
85
local/bin/x-quota-usage.php
Executable file
85
local/bin/x-quota-usage.php
Executable file
@@ -0,0 +1,85 @@
|
|||||||
|
#!/usr/bin/env php
|
||||||
|
<?php
|
||||||
|
error_reporting(E_ALL);
|
||||||
|
|
||||||
|
$debug = false;
|
||||||
|
|
||||||
|
$quota = '';
|
||||||
|
$output = [];
|
||||||
|
$fsCharLenght = 0;
|
||||||
|
|
||||||
|
if ($debug) {
|
||||||
|
$quota = "Disk quotas for user viir (uid 2913):
|
||||||
|
Filesystem blocks quota limit grace files quota limit grace
|
||||||
|
10.0.0.89:/www/webroots/2 8277615 52428800 52428800 0 0 0
|
||||||
|
10.0.0.179:/users1/users/2 1999431 52428800 52428800 0 0 0
|
||||||
|
10.0.0.90:/siilo/2 24835106 524288000 524288000 0 0 0";
|
||||||
|
} else {
|
||||||
|
// $quota = system("quota -w");
|
||||||
|
$quota = shell_exec("quota -w");
|
||||||
|
}
|
||||||
|
|
||||||
|
function pad($i, $n = 3, $p = ' ') {
|
||||||
|
return str_pad($i, $n, $p, STR_PAD_LEFT);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($quota)) {
|
||||||
|
var_dump($quota);
|
||||||
|
die("quota was empty\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
$quota = explode("\n", $quota);
|
||||||
|
$quota = array_map('trim', $quota);
|
||||||
|
|
||||||
|
foreach ($quota as $lineNum => $line) {
|
||||||
|
if ($lineNum < 2) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$values = array_filter(explode(" ", $line));
|
||||||
|
|
||||||
|
if (count($values) != 4) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = array_combine(['fs', 'used', 'quota', 'limit'], $values);
|
||||||
|
|
||||||
|
$result['used_percentage'] = round($result['used'] / $result['quota'] * 100, 3);
|
||||||
|
$result['used_gb'] = round($result['used'] / 1024 / 1024, 2);
|
||||||
|
$result['quota_gb'] = round($result['quota'] / 1024 / 1024, 2);
|
||||||
|
|
||||||
|
$char = strlen($result['fs']);
|
||||||
|
if ($char > $fsCharLenght) {
|
||||||
|
$fsCharLenght = $char;
|
||||||
|
}
|
||||||
|
|
||||||
|
$output[] = $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($output)) {
|
||||||
|
|
||||||
|
$header = sprintf("%s | %s | %s | %s",
|
||||||
|
str_pad("Mount", $fsCharLenght),
|
||||||
|
'Usage%',
|
||||||
|
'Used/Total',
|
||||||
|
'Bar'
|
||||||
|
);
|
||||||
|
$headerWidth = strlen($header);
|
||||||
|
|
||||||
|
echo "\n" . $header . "\n";
|
||||||
|
echo str_repeat('-', $headerWidth + 24) . "\n";
|
||||||
|
|
||||||
|
foreach ($output as $i) {
|
||||||
|
$barUsed = round($i['used_percentage']) / 4;
|
||||||
|
echo sprintf(
|
||||||
|
"%s | %s | %s | [%s]",
|
||||||
|
str_pad($i['fs'], $fsCharLenght),
|
||||||
|
str_pad(round($i['used_percentage'], 1) . '%', 6, ' ', STR_PAD_LEFT),
|
||||||
|
str_pad($i['used_gb'] . '/' . $i['quota_gb'], 10, ' ', STR_PAD_LEFT),
|
||||||
|
str_pad(str_repeat('#', $barUsed), 25, '_')
|
||||||
|
) . "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "\n\n";
|
||||||
|
}
|
||||||
|
|
||||||
@@ -4,37 +4,27 @@
|
|||||||
# -----
|
# -----
|
||||||
# Check the expiry date of the SSL certificate on the given host.
|
# Check the expiry date of the SSL certificate on the given host.
|
||||||
#
|
#
|
||||||
#
|
|
||||||
# License
|
# License
|
||||||
# -------
|
# -------
|
||||||
#
|
|
||||||
# Copyright (c) 2013-2015 by Steve Kemp. All rights reserved.
|
# Copyright (c) 2013-2015 by Steve Kemp. All rights reserved.
|
||||||
#
|
#
|
||||||
# This script is free software; you can redistribute it and/or modify it under
|
# This script is free software; you can redistribute it and/or modify it under
|
||||||
# the same terms as Perl itself.
|
# the same terms as Perl itself.
|
||||||
#
|
#
|
||||||
# The LICENSE file contains the full text of the license.
|
# The LICENSE file contains the full text of the license.
|
||||||
#
|
|
||||||
#
|
|
||||||
|
|
||||||
#
|
# 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"
|
echo "Usage: $0 [-d] [-p 443] domain1.org domain2.com .. domainN"
|
||||||
exit 0
|
exit 0
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
# Default settings for flags set by the command-line arguments
|
||||||
# Default settings for flags set by the command-line arguments
|
|
||||||
#
|
|
||||||
days=0
|
days=0
|
||||||
port=443
|
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)
|
||||||
@@ -53,21 +43,15 @@ while getopts "h?dp:" opt; do
|
|||||||
done
|
done
|
||||||
shift $((OPTIND - 1))
|
shift $((OPTIND - 1))
|
||||||
|
|
||||||
#
|
# Ensure we have some arguments
|
||||||
# Ensure we have some arguments
|
|
||||||
#
|
|
||||||
if [ "$#" = "0" ]; then
|
if [ "$#" = "0" ]; then
|
||||||
usage
|
usage
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#
|
|
||||||
# For each domain-name on the command-line.
|
# For each domain-name on the command-line.
|
||||||
#
|
|
||||||
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
|
||||||
@@ -77,27 +61,19 @@ for name in "$@"; do
|
|||||||
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
|
||||||
@@ -115,15 +91,11 @@ for name in "$@"; do
|
|||||||
|
|
||||||
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
|
||||||
@@ -132,3 +104,4 @@ for name in "$@"; do
|
|||||||
echo " Days: ${diff}"
|
echo " Days: ${diff}"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|||||||
@@ -3,13 +3,11 @@
|
|||||||
# About
|
# About
|
||||||
# -----
|
# -----
|
||||||
# Repeat the command until it fails - always run at least once.
|
# Repeat the command until it fails - always run at least once.
|
||||||
#
|
|
||||||
|
|
||||||
"$@"
|
"$@"
|
||||||
|
|
||||||
#
|
# 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
|
||||||
|
|
||||||
|
|||||||
@@ -14,17 +14,12 @@
|
|||||||
# the same terms as Perl itself.
|
# the same terms as Perl itself.
|
||||||
#
|
#
|
||||||
# The LICENSE file contains the full text of the license.
|
# The LICENSE file contains the full text of the license.
|
||||||
#
|
|
||||||
#
|
|
||||||
|
|
||||||
#
|
# Run the first time.
|
||||||
# Run the first time.
|
|
||||||
#
|
|
||||||
"$@"
|
"$@"
|
||||||
|
|
||||||
#
|
# 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
|
||||||
|
|
||||||
|
|||||||
@@ -50,3 +50,4 @@ elif [ "$(get_sha256sum "$filename")" = "$file_hash" ]; then
|
|||||||
else
|
else
|
||||||
error "$filename doesn't match provided sha256sum"
|
error "$filename doesn't match provided sha256sum"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -24,9 +24,10 @@ 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
|
||||||
|
|
||||||
"$@"
|
"$@"
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ if [ $# -lt 2 ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $1 = "ssh" ]; then
|
if [ "$1" = "ssh" ]; then
|
||||||
HOST=$2
|
HOST=$2
|
||||||
else
|
else
|
||||||
HOST=$1
|
HOST=$1
|
||||||
@@ -30,16 +30,17 @@ fi
|
|||||||
|
|
||||||
echo "Waiting for $HOST to come online..."
|
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
|
||||||
# so we can launch the command we were given - along with any arguments.
|
# so we can launch the command we were given - along with any arguments.
|
||||||
if [ $1 != "ssh" ]; then
|
if [ "$1" != "ssh" ]; then
|
||||||
shift
|
shift
|
||||||
fi
|
fi
|
||||||
|
|
||||||
"$@"
|
"$@"
|
||||||
|
|
||||||
|
|||||||
@@ -36,3 +36,4 @@ else
|
|||||||
echo ""
|
echo ""
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -299,3 +299,4 @@ for app in "Activity Monitor" "Address Book" "Calendar" "Contacts" "cfprefsd" \
|
|||||||
killall "${app}" > /dev/null 2>&1
|
killall "${app}" > /dev/null 2>&1
|
||||||
done
|
done
|
||||||
echo "Done. Note that some of these changes require a logout/restart to take effect."
|
echo "Done. Note that some of these changes require a logout/restart to take effect."
|
||||||
|
|
||||||
|
|||||||
@@ -6,9 +6,9 @@
|
|||||||
|
|
||||||
# -- Colors -- #
|
# -- Colors -- #
|
||||||
CLR_RED="\033[1;31m"
|
CLR_RED="\033[1;31m"
|
||||||
CLR_YELLOW='\033[1;33m'
|
CLR_YELLOW="\033[1;33m"
|
||||||
CLR_GREEN="\033[1;32m"
|
CLR_GREEN="\033[1;32m"
|
||||||
CLR_BLUE='\033[1;34m'
|
CLR_BLUE="\033[1;34m"
|
||||||
CLR_RESET="\033[0m"
|
CLR_RESET="\033[0m"
|
||||||
|
|
||||||
# -- Helpers -- #
|
# -- Helpers -- #
|
||||||
@@ -111,3 +111,4 @@ function fn_exists()
|
|||||||
declare -f -F "$1" > /dev/null
|
declare -f -F "$1" > /dev/null
|
||||||
return $?
|
return $?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,11 @@
|
|||||||
Host github.com
|
Host github.com
|
||||||
User git
|
User git
|
||||||
|
|
||||||
Host *
|
Host lakka
|
||||||
# IdentityAgent "~/Library/Group Containers/2BUA8C4S2C.com.1password/t/agent.sock"
|
User viir
|
||||||
|
HostName lakka.kapsi.fi
|
||||||
IdentityFile ~/.ssh/id_rsa
|
IdentityFile ~/.ssh/id_rsa
|
||||||
|
|
||||||
|
Host *
|
||||||
|
# IdentityAgent "~/Library/Group Containers/2BUA8C4S2C.com.1password/t/agent.sock"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user