mirror of
https://github.com/ivuorinen/dotfiles.git
synced 2026-02-05 07:48:58 +00:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8a8699bf0c | ||
|
|
8814c777f5 |
@@ -14,7 +14,6 @@ trim_trailing_whitespace = true
|
|||||||
indent_size = 2
|
indent_size = 2
|
||||||
|
|
||||||
[*.sh]
|
[*.sh]
|
||||||
indent_style = space
|
|
||||||
indent_size = 2
|
indent_size = 2
|
||||||
tab_width = 2
|
tab_width = 2
|
||||||
|
|
||||||
@@ -22,6 +21,6 @@ shell_variant = posix # like -ln=posix
|
|||||||
binary_next_line = true # like -bn
|
binary_next_line = true # like -bn
|
||||||
switch_case_indent = true # like -ci
|
switch_case_indent = true # like -ci
|
||||||
space_redirects = true # like -sr
|
space_redirects = true # like -sr
|
||||||
keep_padding = false # like -kp
|
keep_padding = false # like -kp
|
||||||
function_next_line = false # like -fn
|
function_next_line = true # like -fn
|
||||||
never_split = true # like -ns
|
never_split = true # like -ns
|
||||||
|
|||||||
75
config/alias
75
config/alias
@@ -1,32 +1,69 @@
|
|||||||
# shellcheck shell=bash
|
# shellcheck shell=bash
|
||||||
# macOS specific
|
# macOS specific
|
||||||
|
|
||||||
|
# Get installed php versions from brew and setup aliases
|
||||||
|
function x-set-php-aliases
|
||||||
|
{
|
||||||
|
local php_versions=()
|
||||||
|
while IFS="" read -r line; do php_versions+=("$line"); done < <(brew list | grep '^php')
|
||||||
|
|
||||||
|
php_error_reporting='-d error_reporting=22527'
|
||||||
|
|
||||||
|
for version in "${php_versions[@]}"; do
|
||||||
|
# drop the dot from version (8.0 -> 80)
|
||||||
|
local php_abbr="${version//\./}"
|
||||||
|
# replace "php@" with "p" so "php@80" becomes "p80"
|
||||||
|
local php_alias="${php_abbr//php@/p}"
|
||||||
|
|
||||||
|
# Skip php = php aliasing
|
||||||
|
# if [[ "$php_abbr" == "$php_alias" ]]; then continue; fi;
|
||||||
|
|
||||||
|
# Fetch the exec path once
|
||||||
|
php_exec="$(brew --prefix "$version")/bin/php"
|
||||||
|
|
||||||
|
# Raw PHP without error_reporting flag.
|
||||||
|
# shellcheck disable=SC2139
|
||||||
|
alias ${php_alias}r="$php_exec"
|
||||||
|
# PHP with error_reporting flag.
|
||||||
|
# shellcheck disable=SC2139
|
||||||
|
alias $php_alias="$php_exec $php_error_reporting"
|
||||||
|
# Local PHP Server.
|
||||||
|
# shellcheck disable=SC2139
|
||||||
|
alias ${php_alias}s="$php_exec -S localhost:9000"
|
||||||
|
# Use composer with specific PHP and error_reporting flag on.
|
||||||
|
# shellcheck disable=SC2139
|
||||||
|
alias ${php_alias}c="$php_exec $php_error_reporting $(which composer)"
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
if [[ $(uname) == 'Darwin' ]]; then
|
if [[ $(uname) == 'Darwin' ]]; then
|
||||||
alias file_hide="chflags hidden"
|
|
||||||
alias file_show="chflags nohidden"
|
|
||||||
alias brewUp='brew update && brew outdated && brew upgrade && brew cleanup'
|
|
||||||
|
|
||||||
alias php74='$(brew --prefix php@7.4)/bin/php'
|
x-set-php-aliases
|
||||||
alias php80='$(brew --prefix php@8.0)/bin/php -d error_reporting=22527'
|
|
||||||
alias phpc='$(brew --prefix php)/bin/php -d error_reporting=22527'
|
|
||||||
alias php80raw='$(brew --prefix php@8.0)/bin/php'
|
|
||||||
|
|
||||||
alias php-server='php -S localhost:9000'
|
|
||||||
|
|
||||||
alias p74c='$(brew --prefix php@7.4)/bin/php -d error_reporting=22527 $(which composer)'
|
|
||||||
alias p80c='$(brew --prefix php@8.0)/bin/php -d error_reporting=22527 $(which composer)'
|
|
||||||
alias p8c='$(brew --prefix php)/bin/php -d error_reporting=22527 $(which composer)'
|
|
||||||
alias p7a='$(brew --prefix php@7.4)/bin/php artisan'
|
|
||||||
alias p8a='$(brew --prefix php)/bin/php artisan'
|
|
||||||
|
|
||||||
alias sail='[ -f sail ] && bash sail || bash vendor/bin/sail'
|
alias sail='[ -f sail ] && bash sail || bash vendor/bin/sail'
|
||||||
|
|
||||||
|
# Flush Directory Service cache
|
||||||
|
alias flushdns="sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder"
|
||||||
|
|
||||||
|
# Lock the screen
|
||||||
|
alias afk="osascript -e 'tell application \"System Events\" to keystroke \"q\" using {command down,control down}'"
|
||||||
|
|
||||||
|
# Empty the Trash on all mounted volumes and the main HDD
|
||||||
|
# Also, clear Apple’s System Logs to improve shell startup speed
|
||||||
|
alias emptytrash="sudo rm -rfv /Volumes/*/.Trashes; sudo rm -rfv ~/.Trash; sudo rm -rfv /private/var/log/asl/*.asl"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
alias watchx='watch -dpbc'
|
alias watchx='watch -dpbc' # watch with: differences, precise, beep and color
|
||||||
alias zapds='find . -name ".DS_Store" -print -delete'
|
alias zapds='find . -name ".DS_Store" -print -delete'
|
||||||
alias t='tail -f'
|
alias t='tail -f' # tail with follow flag on
|
||||||
alias dn='du -chd1'
|
alias dn='du -chd1' # directory usage, return only the total
|
||||||
|
|
||||||
alias codescanner='docker run --env SOURCE_CODE="$PWD" --volume "$PWD":/code --volume /var/run/docker.sock:/var/run/docker.sock registry.gitlab.com/gitlab-org/ci-cd/codequality:${VERSION:-latest} /code'
|
alias code_scanner='docker run \
|
||||||
|
--env SOURCE_CODE="$PWD" \
|
||||||
|
--volume "$PWD":/code \
|
||||||
|
--volume /var/run/docker.sock:/var/run/docker.sock \
|
||||||
|
registry.gitlab.com/gitlab-org/ci-cd/codequality:${CODEQUALITY_VERSION:-latest} \
|
||||||
|
/code'
|
||||||
|
|
||||||
alias composerUp='composer global update'
|
alias composerUp='composer global update'
|
||||||
alias npmUp='npm -g up'
|
alias npmUp='npm -g up'
|
||||||
|
|||||||
@@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
23
config/exports
Normal file
23
config/exports
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
# shellcheck shell=bash
|
||||||
|
|
||||||
|
export HIST_STAMPS="yyyy-mm-dd"
|
||||||
|
|
||||||
|
# Larger bash history (allow 32³ entries; default is 500)
|
||||||
|
export HISTSIZE=32768
|
||||||
|
export HISTFILESIZE=$HISTSIZE
|
||||||
|
export HISTCONTROL=ignoredups
|
||||||
|
|
||||||
|
# Make some commands not show up in history
|
||||||
|
export HISTIGNORE="ls:cd:cd -:pwd:exit:date:* --help"
|
||||||
|
|
||||||
|
# And include the parameter for ZSH
|
||||||
|
export HISTORY_IGNORE="(ls|cd|cd -|pwd|exit|date|* --help)"
|
||||||
|
|
||||||
|
# Highlight section titles in manual pages
|
||||||
|
export LESS_TERMCAP_md="$ORANGE"
|
||||||
|
|
||||||
|
# Don’t clear the screen after quitting a manual page
|
||||||
|
export MANPAGER="less -X"
|
||||||
|
|
||||||
|
# Always enable colored `grep` output
|
||||||
|
export GREP_OPTIONS="--color=auto"
|
||||||
67
config/functions
Normal file
67
config/functions
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
# shellcheck shell=bash
|
||||||
|
#
|
||||||
|
# shell functions
|
||||||
|
#
|
||||||
|
|
||||||
|
# Weather in Tampere, or other city
|
||||||
|
function weather
|
||||||
|
{
|
||||||
|
# https://github.com/chubin/wttr.in#usage
|
||||||
|
local city="${1:-Tampere}"
|
||||||
|
curl "http://wttr.in/${city// /+}?2nFQM&lang=fi"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Docker
|
||||||
|
function ssh-docker
|
||||||
|
{
|
||||||
|
docker exec -it "$@" bash
|
||||||
|
}
|
||||||
|
|
||||||
|
# Create a new directory and enter it
|
||||||
|
function mkd
|
||||||
|
{
|
||||||
|
mkdir -p "$@" && cd "$@" || exit
|
||||||
|
}
|
||||||
|
|
||||||
|
# All the dig info
|
||||||
|
function digga
|
||||||
|
{
|
||||||
|
dig +nocmd "$1" any +multiline +noall +answer
|
||||||
|
}
|
||||||
|
|
||||||
|
# Rector project to php version 8.0 by default.
|
||||||
|
function rector
|
||||||
|
{
|
||||||
|
local php="${1:-80}"
|
||||||
|
docker run -v "$(pwd)":/project rector/rector:latest process \
|
||||||
|
"/project/$1" \
|
||||||
|
--set "php${php}" \
|
||||||
|
--autoload-file /project/vendor/autoload.php
|
||||||
|
}
|
||||||
|
|
||||||
|
# Commit everything
|
||||||
|
function commit
|
||||||
|
{
|
||||||
|
commitMessage="$*"
|
||||||
|
|
||||||
|
if [ "$commitMessage" = "" ]; then
|
||||||
|
commitMessage="Automated commit"
|
||||||
|
fi
|
||||||
|
|
||||||
|
git add .
|
||||||
|
eval "git commit -a -m '${commitMessage}'"
|
||||||
|
}
|
||||||
|
|
||||||
|
function scheduler
|
||||||
|
{
|
||||||
|
while :; do
|
||||||
|
php artisan schedule:run
|
||||||
|
echo "Sleeping 60 seconds..."
|
||||||
|
sleep 60
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
function silent
|
||||||
|
{
|
||||||
|
"$@" >&/dev/null
|
||||||
|
}
|
||||||
@@ -58,3 +58,9 @@
|
|||||||
allowedSignersFile = ~/.ssh/allowed_signers
|
allowedSignersFile = ~/.ssh/allowed_signers
|
||||||
[commit]
|
[commit]
|
||||||
gpgsign = true
|
gpgsign = 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
|
||||||
|
|||||||
4
huskyrc
4
huskyrc
@@ -1,7 +1,7 @@
|
|||||||
#!/bin/env bash
|
#!/bin/env bash
|
||||||
|
|
||||||
export NVM_DIR="$HOME/.nvm"
|
export NVM_DIR="$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
|
[ -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"
|
||||||
|
|||||||
@@ -22,12 +22,14 @@
|
|||||||
: ${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
|
||||||
@@ -45,7 +47,8 @@ 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
|
||||||
|
|||||||
@@ -4,33 +4,46 @@
|
|||||||
# (c) Ismo Vuorinen <https://github.com/ivuorinen> 2022
|
# (c) Ismo Vuorinen <https://github.com/ivuorinen> 2022
|
||||||
# Licensed under MIT, see LICENSE
|
# Licensed under MIT, see LICENSE
|
||||||
#
|
#
|
||||||
|
# shellcheck source-path=SCRIPTDIR
|
||||||
|
#
|
||||||
# Helper variables, override with ENVs like `VERBOSE=1 helpers.sh help`
|
# Helper variables, override with ENVs like `VERBOSE=1 helpers.sh help`
|
||||||
: "${VERBOSE:=0}"
|
: "${VERBOSE:=0}"
|
||||||
: "${DOTFILES:=$HOME/.dotfiles}"
|
: "${DOTFILES:=$HOME/.dotfiles}"
|
||||||
: "${INSTALL_SCRIPT:=$DOTFILES/install.sh}"
|
: "${INSTALL_SCRIPT:=$DOTFILES/install.sh}"
|
||||||
: "${BREWFILE:=$DOTFILES/Brewfile}"
|
: "${BREWFILE:=$DOTFILES/Brewfile}"
|
||||||
|
|
||||||
function usage() {
|
function usage
|
||||||
echo $"Usage: $0 [install | brew | dotfiles | other]"
|
{
|
||||||
|
echo $"Usage: $0 [install | brew | dotfiles]"
|
||||||
echo $" All commands have their own subcommands."
|
echo $" All commands have their own subcommands."
|
||||||
echo $" When in doubt run the subcommand to show list."
|
echo $" When in doubt run the subcommand to show list."
|
||||||
}
|
}
|
||||||
|
|
||||||
function section_install() {
|
function section_install
|
||||||
|
{
|
||||||
USAGE_PREFIX="Usage: $0 install"
|
USAGE_PREFIX="Usage: $0 install"
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
|
antigen)
|
||||||
|
curl -L git.io/antigen > "$DOTFILES/config/antigen.zsh" && echo "🎉 Done!"
|
||||||
|
;;
|
||||||
|
defaults)
|
||||||
|
bash "$DOTFILES/scripts/set-defaults.sh" && echo "🎉 Done!"
|
||||||
|
;;
|
||||||
|
gh-extensions)
|
||||||
|
bash "$DOTFILES/scripts/gh-extensions.sh" && echo "🎉 Done!"
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
echo "$USAGE_PREFIX [link | update]"
|
echo "$USAGE_PREFIX [antigen | defaults | gh-extensions]"
|
||||||
echo " * link: Use rcrc to update dotfile links"
|
echo " * antigen: Updates the antigen.zsh file"
|
||||||
echo " * update: Updates and upgrades brew packages"
|
echo " * defaults: Setup nice macOS defaults"
|
||||||
echo " * updatebundle: Updates Brewfile with descriptions"
|
echo " * gh-extensions: Install GitHub CLI Extensions"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
function section_brew() {
|
function section_brew
|
||||||
|
{
|
||||||
USAGE_PREFIX="Usage: $0 brew"
|
USAGE_PREFIX="Usage: $0 brew"
|
||||||
|
|
||||||
if ! command -v brew &> /dev/null; then
|
if ! command -v brew &> /dev/null; then
|
||||||
@@ -40,15 +53,16 @@ function section_brew() {
|
|||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
install)
|
install)
|
||||||
brew bundle install --file="$BREWFILE"; echo "🎉 Done!"
|
brew bundle install --file="$BREWFILE"
|
||||||
|
echo "🎉 Done!"
|
||||||
;;
|
;;
|
||||||
update)
|
update)
|
||||||
brew update && brew upgrade; echo "🎉 Done!"
|
brew update && brew outdated && brew upgrade && brew cleanup
|
||||||
|
echo "🎉 Done!"
|
||||||
;;
|
;;
|
||||||
updatebundle)
|
updatebundle)
|
||||||
# Updates .dotfiles/Brewfile with descriptions
|
# Updates .dotfiles/Brewfile with descriptions
|
||||||
brew bundle dump --force --file="$BREWFILE" --describe
|
brew bundle dump --force --file="$BREWFILE" --describe && echo "🎉 Done!"
|
||||||
echo "🎉 Done!"
|
|
||||||
;;
|
;;
|
||||||
autoupdate)
|
autoupdate)
|
||||||
brew autoupdate start 43200 --upgrade --cleanup --immediate
|
brew autoupdate start 43200 --upgrade --cleanup --immediate
|
||||||
@@ -63,7 +77,8 @@ function section_brew() {
|
|||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
function section_dotfiles() {
|
function section_dotfiles
|
||||||
|
{
|
||||||
USAGE_PREFIX="Usage: $0 dotfiles"
|
USAGE_PREFIX="Usage: $0 dotfiles"
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
@@ -72,24 +87,37 @@ function section_dotfiles() {
|
|||||||
;;
|
;;
|
||||||
update)
|
update)
|
||||||
# Updates .dotfiles/install.sh and formats it
|
# Updates .dotfiles/install.sh and formats it
|
||||||
rcup -B 0 -g | \
|
rcup -B 0 -g \
|
||||||
tee "$INSTALL_SCRIPT" 1> /dev/null && \
|
| tee "$INSTALL_SCRIPT" 1> /dev/null \
|
||||||
shfmt -w -l "$INSTALL_SCRIPT" && \
|
&& shfmt -w -l "$INSTALL_SCRIPT" \
|
||||||
echo "🎉 Done!"
|
&& echo "🎉 Done!"
|
||||||
|
;;
|
||||||
|
shfmt)
|
||||||
|
# Format shell scripts according to following rules.
|
||||||
|
shfmt \
|
||||||
|
--list \
|
||||||
|
--write \
|
||||||
|
--diff \
|
||||||
|
--simplify \
|
||||||
|
--language-dialect bash \
|
||||||
|
--indent 2 \
|
||||||
|
--binary-next-line \
|
||||||
|
--case-indent \
|
||||||
|
--space-redirects \
|
||||||
|
--func-next-line \
|
||||||
|
"$DOTFILES" \
|
||||||
|
"$DOTFILES/local/bin/dotfiles" \
|
||||||
|
"$DOTFILES/local/bin/x-check-git-attributes" \
|
||||||
|
"$DOTFILES/local/bin/x-open-ports" \
|
||||||
|
"$DOTFILES/config/alias" \
|
||||||
|
"$DOTFILES/config/exports" \
|
||||||
|
"$DOTFILES/config/functions"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "$USAGE_PREFIX [link | update]"
|
echo "$USAGE_PREFIX [link | update | shfmt]"
|
||||||
echo " * link: Use rcrc to update dotfile links"
|
echo " * link: Use rcrc to update dotfile links"
|
||||||
echo " * update: Updates dotfile links, installs host specific overrides automatically"
|
echo " * update: Updates dotfile links, installs host specific overrides automatically"
|
||||||
;;
|
echo " * shfmt: Run shfmt to all dotfiles"
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
function section_other() {
|
|
||||||
case "$1" in
|
|
||||||
*)
|
|
||||||
echo "section_other"
|
|
||||||
echo "$1"
|
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
@@ -99,6 +127,5 @@ case "$1" in
|
|||||||
install) section_install "$2" ;;
|
install) section_install "$2" ;;
|
||||||
brew) section_brew "$2" ;;
|
brew) section_brew "$2" ;;
|
||||||
dotfiles) section_dotfiles "$2" ;;
|
dotfiles) section_dotfiles "$2" ;;
|
||||||
other) section_other "$2" ;;
|
*) usage && exit 1 ;;
|
||||||
*) usage; exit 1 ;;
|
|
||||||
esac
|
esac
|
||||||
|
|||||||
@@ -6,15 +6,14 @@
|
|||||||
# 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
|
||||||
#
|
#
|
||||||
echo 'User: Command: Port:';
|
echo 'User: Command: Port:'
|
||||||
echo '=====================================================';
|
echo '====================================================='
|
||||||
|
|
||||||
lsof -i 4 -P -n +c 0 | \
|
lsof -i 4 -P -n +c 0 \
|
||||||
grep -i 'listen' | \
|
| grep -i 'listen' \
|
||||||
awk '{print $3, $1, $9}' | \
|
| awk '{print $3, $1, $9}' \
|
||||||
sed 's/ [a-z0-9\.\*]*:/ /' | \
|
| sed 's/ [a-z0-9\.\*]*:/ /' \
|
||||||
sort -k 3 -n | \
|
| sort -k 3 -n \
|
||||||
xargs printf '%-20s %-25s %-5s\n' | uniq
|
| xargs printf '%-20s %-25s %-5s\n' | uniq
|
||||||
|
|
||||||
echo "";
|
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
|||||||
@@ -1,29 +1,39 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# Install GitHub CLI extensions
|
# Install GitHub CLI extensions
|
||||||
|
|
||||||
# GitHub CLI extension for reviewing Dependabot PRs.
|
extensions=(
|
||||||
gh extension install einride/gh-dependabot
|
# GitHub CLI extension for reviewing Dependabot PRs.
|
||||||
# A GitHub CLI extension that provides summary pull request metrics.
|
einride/gh-dependabot
|
||||||
gh extension install hectcastro/gh-metrics
|
# A GitHub CLI extension that provides summary pull request metrics.
|
||||||
# being an extension to view the overall health of an organization's use of actions
|
hectcastro/gh-metrics
|
||||||
gh extension install rsese/gh-actions-status
|
# being an extension to view the overall health of an organization's use of actions
|
||||||
# GitHub CLI extension for label management
|
rsese/gh-actions-status
|
||||||
gh extension install heaths/gh-label
|
# GitHub CLI extension for label management
|
||||||
# An opinionated GitHub Cli extension for creating
|
heaths/gh-label
|
||||||
# changelogs that adhere to the keep a changelog specification.
|
# An opinionated GitHub Cli extension for creating
|
||||||
gh extension install chelnak/gh-changelog
|
# changelogs that adhere to the keep a changelog specification.
|
||||||
# Safely deletes local branches with no upstream and no un-pushed commits
|
chelnak/gh-changelog
|
||||||
gh extension install davidraviv/gh-clean-branches
|
# Safely deletes local branches with no upstream and no un-pushed commits
|
||||||
# A beautiful CLI dashboard for GitHub 🚀
|
davidraviv/gh-clean-branches
|
||||||
gh extension install dlvhdr/gh-dash
|
# A beautiful CLI dashboard for GitHub 🚀
|
||||||
# A github-cli extension script to clone all repositories
|
dlvhdr/gh-dash
|
||||||
# in an organization, optionally filtering by topic.
|
# A github-cli extension script to clone all repositories
|
||||||
gh extension install matt-bartel/gh-clone-org
|
# in an organization, optionally filtering by topic.
|
||||||
# GitHub CLI extension to generate montage from GitHub user avatars
|
matt-bartel/gh-clone-org
|
||||||
gh extension install andyfeller/gh-montage
|
# GitHub CLI extension to generate montage from GitHub user avatars
|
||||||
# Organisation specific extension for gh cli to retrieve different statistics
|
andyfeller/gh-montage
|
||||||
gh extension install VildMedPap/gh-orgstats
|
# Organisation specific extension for gh cli to retrieve different statistics
|
||||||
# GitHub CLI extension for generating a report on repository dependencies.
|
VildMedPap/gh-orgstats
|
||||||
gh extension install andyfeller/gh-dependency-report
|
# GitHub CLI extension for generating a report on repository dependencies.
|
||||||
# gh cli extension to generate account/organization/enterprise reports
|
andyfeller/gh-dependency-report
|
||||||
gh extension install stoe/gh-report
|
# gh cli extension to generate account/organization/enterprise reports
|
||||||
|
stoe/gh-report
|
||||||
|
)
|
||||||
|
|
||||||
|
for ext in "${extensions[@]}"; do
|
||||||
|
# Skip comments
|
||||||
|
if [[ ${ext:0:1} == "#" ]]; then continue; fi
|
||||||
|
|
||||||
|
echo "-> Installing $ext"
|
||||||
|
gh extensions install "$ext"
|
||||||
|
done
|
||||||
|
|||||||
@@ -5,7 +5,11 @@ echo 'start osx/set-defaults.sh'
|
|||||||
sudo -v
|
sudo -v
|
||||||
|
|
||||||
# Keep-alive: update existing `sudo` time stamp until `.osx` has finished
|
# Keep-alive: update existing `sudo` time stamp until `.osx` has finished
|
||||||
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null &
|
while true; do
|
||||||
|
sudo -n true
|
||||||
|
sleep 60
|
||||||
|
kill -0 "$$" || exit
|
||||||
|
done 2> /dev/null &
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# General UI/UX #
|
# General UI/UX #
|
||||||
@@ -165,9 +169,9 @@ defaults write com.apple.finder WarnOnEmptyTrash -bool false
|
|||||||
# Expand the following File Info panes:
|
# Expand the following File Info panes:
|
||||||
# “General”, “Open with”, and “Sharing & Permissions”
|
# “General”, “Open with”, and “Sharing & Permissions”
|
||||||
defaults write com.apple.finder FXInfoPanesExpanded -dict \
|
defaults write com.apple.finder FXInfoPanesExpanded -dict \
|
||||||
General -bool true \
|
General -bool true \
|
||||||
OpenWith -bool true \
|
OpenWith -bool true \
|
||||||
Privileges -bool true
|
Privileges -bool true
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# Screenshots #
|
# Screenshots #
|
||||||
@@ -273,8 +277,8 @@ defaults write com.apple.messageshelper.MessageController SOInputLineSettings -d
|
|||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
for app in "Activity Monitor" "Address Book" "Calendar" "Contacts" "cfprefsd" \
|
for app in "Activity Monitor" "Address Book" "Calendar" "Contacts" "cfprefsd" \
|
||||||
"Dock" "Finder" "Mail" "Messages" "Safari" "SizeUp" "SystemUIServer" \
|
"Dock" "Finder" "Mail" "Messages" "Safari" "SizeUp" "SystemUIServer" \
|
||||||
"Terminal" "Transmission" "Twitter" "iCal"; do
|
"Terminal" "Transmission" "Twitter" "iCal"; do
|
||||||
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."
|
||||||
|
|||||||
31
zshrc
31
zshrc
@@ -2,21 +2,12 @@
|
|||||||
[[ -f "$HOME/.fig/shell/zshrc.pre.zsh" ]] && builtin source "$HOME/.fig/shell/zshrc.pre.zsh"
|
[[ -f "$HOME/.fig/shell/zshrc.pre.zsh" ]] && builtin source "$HOME/.fig/shell/zshrc.pre.zsh"
|
||||||
# shellcheck shell=bash
|
# shellcheck shell=bash
|
||||||
|
|
||||||
LOCAL_BIN="$HOME/.local/bin"
|
export PATH="/opt/homebrew/bin:/usr/local/sbin:$PATH"
|
||||||
|
|
||||||
PYTHON_38="$HOME/Library/Python/3.8/bin"
|
|
||||||
COMPOSER_DIR="$HOME/.composer/vendor/bin"
|
|
||||||
USR_SBIN=/usr/local/sbin
|
|
||||||
|
|
||||||
export PATH="/opt/homebrew/bin:$USR_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
|
||||||
BREW_SBIN=$(brew --prefix)/sbin
|
BREW_SBIN=$(brew --prefix)/sbin
|
||||||
|
|
||||||
# PHP_74=$(brew --prefix php@7.4)/bin
|
|
||||||
# PHP_80=$(brew --prefix php@8.0)/bin
|
|
||||||
# PHP_CUR=$(brew --prefix php)/bin
|
|
||||||
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
|
||||||
@@ -25,8 +16,9 @@ if [ command -v brew &> /dev/null ]; then
|
|||||||
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
|
||||||
|
|
||||||
export PATH="$LOCAL_BIN:$PYTHON_38:$COMPOSER_DIR:$PATH"
|
LOCAL_BIN="$HOME/.local/bin"
|
||||||
export HIST_STAMPS="yyyy-mm-dd"
|
COMPOSER_DIR="$HOME/.composer/vendor/bin"
|
||||||
|
export PATH="$LOCAL_BIN:$COMPOSER_DIR:$PATH"
|
||||||
|
|
||||||
export NVM_DIR="$HOME/.nvm"
|
export NVM_DIR="$HOME/.nvm"
|
||||||
export NVM_LAZY_LOAD=true
|
export NVM_LAZY_LOAD=true
|
||||||
@@ -35,8 +27,19 @@ export NVM_AUTO_USE=true
|
|||||||
[ -s "/opt/homebrew/opt/nvm/nvm.sh" ] && \. "/opt/homebrew/opt/nvm/nvm.sh"
|
[ -s "/opt/homebrew/opt/nvm/nvm.sh" ] && \. "/opt/homebrew/opt/nvm/nvm.sh"
|
||||||
[ -s "/opt/homebrew/opt/nvm/etc/bash_completion.d/nvm" ] && \. "/opt/homebrew/opt/nvm/etc/bash_completion.d/nvm"
|
[ -s "/opt/homebrew/opt/nvm/etc/bash_completion.d/nvm" ] && \. "/opt/homebrew/opt/nvm/etc/bash_completion.d/nvm"
|
||||||
|
|
||||||
[[ -f "$HOME/.dotfiles/alias" ]] && source "$HOME/.dotfiles/alias"
|
# Run x-load-configs in your terminal to reload the files.
|
||||||
[[ -f "$HOME/.dotfiles/alias-$HOSTNAME" ]] && source "$HOME/.dotfiles/alias-$HOSTNAME"
|
function x-load-configs()
|
||||||
|
{
|
||||||
|
# Load the shell dotfiles, and then some:
|
||||||
|
for file in ~/.dotfiles/config/{exports,alias,functions}; do
|
||||||
|
[ -r "$file" ] && [ -f "$file" ] && source "$file"
|
||||||
|
[ -r "$file-$HOSTNAME" ] && [ -f "$file-$HOSTNAME" ] && source "$file-$HOSTNAME"
|
||||||
|
done
|
||||||
|
}
|
||||||
|
x-load-configs
|
||||||
|
|
||||||
|
# Import ssh keys in keychain
|
||||||
|
ssh-add -A 2>/dev/null;
|
||||||
|
|
||||||
# Try to load antigen, if present
|
# Try to load antigen, if present
|
||||||
[[ -f "$HOME/.config/antigen.zsh" ]] && source "$HOME/.config/antigen.zsh"
|
[[ -f "$HOME/.config/antigen.zsh" ]] && source "$HOME/.config/antigen.zsh"
|
||||||
|
|||||||
Reference in New Issue
Block a user