all local changes

This commit is contained in:
MorganGeek 2021-06-07 11:51:29 +02:00
parent 87d138f1a5
commit 923f0ba039
6 changed files with 61 additions and 15 deletions

5
dot_scripts/install_bach.sh Executable file
View File

@ -0,0 +1,5 @@
#!/usr/bin/env bash
echo "Installing Bach (Bash Testing Framework)"
sudo curl -L https://raw.githubusercontent.com/bach-sh/bach/master/bach.sh -o /usr/local/bin/bach
chmod +x "$_"

View File

@ -8,7 +8,8 @@ sudo python3 get-pip.py
case "$(uname -s)" in case "$(uname -s)" in
Darwin) Darwin)
echo "(Mac OS X) Updating PATH for loading pip user installed packages" echo "(Mac OS X) Updating PATH for loading pip user installed packages"
ln -snf /usr/local/opt/python/bin//pip3.8 /usr/local/bin/pip3 ln -snf /usr/local/lib/python3.9/site-packages/pip /usr/local/bin/pip21
ln -snf /usr/local/lib/python3.9/site-packages/pip /usr/local/bin/pip3
export PATH="$PATH:/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/bin/:/usr/local/Cellar/python/3.7.4/Frameworks/Python.framework/Versions/3.7/bin:/usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/bin:/usr/local/opt/python/bin/" export PATH="$PATH:/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/bin/:/usr/local/Cellar/python/3.7.4/Frameworks/Python.framework/Versions/3.7/bin:/usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/bin:/usr/local/opt/python/bin/"
;; ;;
esac esac

View File

@ -3,3 +3,9 @@
echo "Installing Rust compiler and package manager" echo "Installing Rust compiler and package manager"
rustup-init -y rustup-init -y
rustup component add rustfmt rustup component add rustfmt
git clone git@github.com:njaremko/podcast.git "$HOME/Code/podcast"
cd "$HOME/Code/podcast" || exit
cargo install --path=.
mkdir "$ZSH_CUSTOM/plugins/podcast" && podcast completion zsh >"$ZSH_CUSTOM/plugins/podcast/_podcast"
cd "$HOME" || exit

View File

@ -43,6 +43,9 @@ function substring() {
function browse() { function browse() {
open -na "$DEFAULT_BROWSER" --args "$1" open -na "$DEFAULT_BROWSER" --args "$1"
} }
function incognito() {
open -na "$DEFAULT_BROWSER" --args --incognito "$1"
}
function google() { function google() {
browse "https://www.google.com/search?q=$*" browse "https://www.google.com/search?q=$*"
} }
@ -139,9 +142,7 @@ function whichfunc() {
whence -v $1 whence -v $1
type -a $1 type -a $1
} }
source "$HOME/Code/dotfiles/dot_scripts/suggest_readable_parameters.sh"
source $HOME/Code/dotfiles/dot_scripts/suggest_readable_parameters.sh
# TODO : suggest spelling fixes # TODO : suggest spelling fixes
function suggest_code_refactoring() { function suggest_code_refactoring() {
#inspired by : \grep 'awk '\''{$1=$1};1'\' $HOME/Code/dotfiles/dot_zsh* #inspired by : \grep 'awk '\''{$1=$1};1'\' $HOME/Code/dotfiles/dot_zsh*
@ -166,7 +167,7 @@ function suggest_aliases() {
local search_input_size=${1:-'50'} local search_input_size=${1:-'50'}
header "alias recommendations" header "alias recommendations"
while read -r line; do while read -r line; do
local matching_aliases=$(ag "$line") local matching_aliases=$(ag --multiline "$line")
if [ ! -z "$matching_aliases" ]; then if [ ! -z "$matching_aliases" ]; then
success "there is an alias for $line :" success "there is an alias for $line :"
while read -r alias_line; do while read -r alias_line; do
@ -224,7 +225,7 @@ source $HOME/Code/dotfiles/dot_scripts/sendmail.sh
function mute_device() { function mute_device() {
local current_device=$(SwitchAudioSource -c) local current_device=$(SwitchAudioSource -c)
local target_device="$1" local target_device="$1"
if SwitchAudioSource -a | grep "$target_device" 1>/dev/null; then if SwitchAudioSource -a G "$target_device" 1>/dev/null; then
SwitchAudioSource -s "$1" 1>/dev/null SwitchAudioSource -s "$1" 1>/dev/null
osascript -e 'set volume output muted true' osascript -e 'set volume output muted true'
success "device $target_device muted" success "device $target_device muted"
@ -232,14 +233,14 @@ function mute_device() {
if [ "$current_device" != "$target_device" ]; then if [ "$current_device" != "$target_device" ]; then
arrow "switching back to $current_device" arrow "switching back to $current_device"
fi fi
arrow "currently using $target_device" arrow "currently using $current_device"
else else
error "sound device not found : $target_device (maybe it's disconnected ?)" error "sound device not found : $target_device (maybe it's disconnected ?)"
fi fi
} }
function switch_device() { function switch_device() {
local target_device="$1" local target_device="$1"
if SwitchAudioSource -a | grep "$target_device" 1>/dev/null; then if SwitchAudioSource -a G "$target_device" 1>/dev/null; then
if SwitchAudioSource -s "$1" 1>/dev/null; then if SwitchAudioSource -s "$1" 1>/dev/null; then
success "switched to $target_device" success "switched to $target_device"
unmute unmute
@ -364,12 +365,22 @@ function checkenlist() {
} }
function checkenremote() { function checkenremote() {
local target_url=$(echo "$1" | sed 's/github.com/raw.githubusercontent.com/g' | sed 's;blob/;;') local target_url="$1"
if [[ "$target_url" =~ "githubusercontent.com" && ! "$target_url" =~ "README" ]]; then if [[ ! "$target_url" =~ "githubusercontent.com" && ! "$target_url" =~ "README" && ! "$target_url" =~ "readme" ]]; then
target_url=$(echo "$target_url/master/README.md") arrow "no readme found"
local guess_readme_url=$(http "$target_url" | \grep -ioP 'href="\K.*REAdme.(md|rst)(?=")' | head -1)
arrow "does https://github.com${guess_readme_url} exist "
arrow "guess url : $guess_readme_url"
if http --check-status "https://github.com${guess_readme_url}" &>/dev/null; then
target_url="https://github.com${guess_readme_url}"
arrow "target url changed to ${target_url}"
else
arrow "https://github.com${guess_readme_url} do not exist"
fi fi
fi
target_url=$(echo "$target_url" | sed 's/github.com/raw.githubusercontent.com/g' | sed 's;blob/;;')
arrow "checking $target_url" arrow "checking $target_url"
curl --location --insecure --silent "$target_url" > /tmp/file && checkenlist /tmp/file && write-good --no-passive /tmp/file && proselint /tmp/file && \cat /tmp/file > alex -q --stdin curl --location --insecure --silent "$target_url" > /tmp/file && checkenlist /tmp/file #&& write-good --no-passive /tmp/file && proselint /tmp/file && \cat /tmp/file > alex -q --stdin
} }
# Time management # Time management
@ -610,7 +621,8 @@ function fork() {
else else
gitperso gitperso
fi fi
checkenlist README* checkreadme
# TODO : check all the codebase for spelling mistakes in info/debug/error messages etc.
} }
function git-project() { function git-project() {
if [ -d "$REPO_PATH" ]; then if [ -d "$REPO_PATH" ]; then
@ -749,3 +761,13 @@ function runiflucky() {
fi fi
fi fi
} }
function aws-login() {
profile_list=$(aws-vault list --profiles | fzf --ansi)
login_url=$(export AWS_SESSION_TOKEN_TTL=3h && aws-vault login $profile_list -s)
echo "$login_url $1"
browse "$login_url $1" 1>/dev/null 2>&1 &
}
function aws-exec() {
profile_list=$(aws-vault list --profiles | fzf --ansi)
aws-vault exec $profile_list
}

View File

@ -16,6 +16,7 @@ fi
# load a random theme each time oh-my-zsh is loaded, in which case, # load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME # to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes # See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
#
ZSH_THEME="powerlevel10k/powerlevel10k" ZSH_THEME="powerlevel10k/powerlevel10k"
ZSH_COLORIZE_STYLE="monokai" ZSH_COLORIZE_STYLE="monokai"
@ -96,7 +97,7 @@ POWERLEVEL9K_CONTEXT_DEFAULT_BACKGROUND='clear'
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/ # Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse) # Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup. # Add wisely, as too many plugins slow down shell startup.
plugins=(reminder common-aliases extract git sdk zsh-syntax-highlighting zsh-autosuggestions ansible brew colorize docker pipenv pip python terraform aws helm kubectl) plugins=(reminder common-aliases extract git sdk zsh-syntax-highlighting zsh-autosuggestions ansible brew colorize docker pipenv pip python terraform aws helm kubectl fzf alias-finder)
source $ZSH/oh-my-zsh.sh source $ZSH/oh-my-zsh.sh
# User configuration # User configuration
@ -136,6 +137,13 @@ export GIT_PERSONAL_EMAIL=""
export GIT_PERSONAL_USER="" export GIT_PERSONAL_USER=""
export GIT_PRO_EMAIL="" export GIT_PRO_EMAIL=""
export GIT_PRO_USER="" export GIT_PRO_USER=""
export GMAIL_APP_USER=""
export GMAIL_APP_PASSWORD=""
export KINDLE_ACCOUNT_EMAIL="" # e.g : john.doe@kindle.com
export PRINCIPAL_ACCOUNT_EMAIL="" # e.g : john.doe@gmail.com
export PRINCIPAL_ACCOUNT_FULLNAME="" # e.g : John Doe
export BB_TOKEN="" # Bitbucket server PAT (personal access token)
export GITHUB_TOKEN="" # GitHub PAT (personal access token)
source "$HOME/Code/dotfiles/dot_aliases/misc.sh" source "$HOME/Code/dotfiles/dot_aliases/misc.sh"
@ -171,7 +179,8 @@ export SDKMAN_DIR="$HOME/.sdkman"
case "$(uname -s)" in case "$(uname -s)" in
Darwin) Darwin)
ln -snf /usr/local/opt/python/bin//pip3.8 /usr/local/bin/pip3 ln -snf /usr/local/lib/python3.9/site-packages/pip /usr/local/bin/pip21
ln -snf /usr/local/lib/python3.9/site-packages/pip /usr/local/bin/pip3
export PATH="$PATH:/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/bin/:/usr/local/Cellar/python/3.7.4/Frameworks/Python.framework/Versions/3.7/bin:/usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/bin" export PATH="$PATH:/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/bin/:/usr/local/Cellar/python/3.7.4/Frameworks/Python.framework/Versions/3.7/bin:/usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/bin"
;; ;;
esac esac

View File

@ -5,3 +5,6 @@ Host *
IdentityFile ~/.ssh/id_ed25519 IdentityFile ~/.ssh/id_ed25519
IdentityFile ~/.ssh/id_rsa IdentityFile ~/.ssh/id_rsa
ServerAliveInterval 3600 ServerAliveInterval 3600
Match all
Include banyan.config