2nd commit

This commit is contained in:
2021-08-11 17:57:04 +02:00
parent 3fa8197f07
commit 823865f0e3
3 changed files with 295 additions and 0 deletions

63
.bash_aliases Executable file
View File

@@ -0,0 +1,63 @@
# ---------------------------
# 6. NETWORKING
# ---------------------------
#alias flushDNS='dscacheutil -flushcache' # flushDNS: Flush out the DNS Cache
alias flushDNS='sudo killall -HUP mDNSResponder;sudo killall mDNSResponderHelper;sudo dscacheutil -flushcache'
# ---------------------------------------
# 8. WEB DEVELOPMENT
# ---------------------------------------
alias apacheTools='~/Documents/Scripts/bash/apache_tools.sh'
alias apacheEdit='bbedit /usr/local/etc/httpd/httpd.conf' # apacheEdit: Edit httpd.conf
alias apacheRestart='sudo apachectl -k restart' # apacheRestart: Restart Apache
alias apal='tail -f /usr/local/var/log/httpd/access_log'
alias apel='tail -f /usr/local/var/log/httpd/error_log'
alias multiapa='multitail -s 2 /usr/local/var/log/httpd/error_log /usr/local/var/log/httpd/access_log'
alias log2='less +F /usr/local/var/log/httpd/error_log'
alias editHosts='sudo edit /etc/hosts' # editHosts: Edit /etc/hosts file
httpHeaders () { /usr/bin/curl -I -L $@ ; } # httpHeaders: Grabs headers from web page
#alias apacheLogs="less +F /var/log/apache2/error_log" # Apachelogs: Shows apache error logs
#alias herr='tail /var/log/apache2/error_log' # herr: Tails HTTP error logs
# ---------------------------------------
# 10. DIVERS
# ---------------------------------------
alias bashTools='~/Documents/Scripts/bash/bash_tools.sh'
# Convert contents of clipboard to plain text.
alias txt='pbpaste | textutil -convert txt -stdin -stdout -encoding 30 | pbcopy'
#recupere le presse-papier et le met dans un fichier .txt
#dld() { pbpaste >> "$1".txt; }
dld() { pbpaste >> /Users/bruno/Downloads/"$1".txt; }
# Convertit en minuscule
alias tolowercase='pbpaste | tr "[:upper:]" "[:lower:]" | pbcopy'
#Convertit en majuscule
alias touppercase='pbpaste | tr "[:lower:]" "[:upper:]" | pbcopy'
# Ouvrir un fichier markdow dans Typora
alias typora="open -a typora"
# De-quarantine
alias quarantine="sudo xattr -rd com.apple.quarantine"
# Optimise la base Mail
alias mailoptimiser="curl -sS https://raw.githubusercontent.com/pbihq/tools/master/MailDBOptimiser/MailDBOptimiser.sh | bash"
# Mkdocs
# servir Mkdocs (Python3) à 127.0.0.1 (-v verbose)
alias mkserve="cd ~/project/ ; /usr/local/bin/mkdocs serve"
# construire et envoyer les docs sur le serveur
alias mkbuild="/Users/bruno/Documents/Scripts/bash/mkbuild.sh"
alias backpi='sudo rsync -av --exclude ".*/" pi@192.168.1.100:/home/pi/ ~/RPi-backup'

227
.bash_profile Executable file
View File

@@ -0,0 +1,227 @@
# -------------------------------
# 1. ENVIRONMENT CONFIGURATION
# -------------------------------
# Set Paths
# ------------------------------------------------------------
#export PATH="/usr/local/bin:/usr/local/sbin:/usr/local/opt:/opt/local/bin:/opt/local/sbin:$HOME/.npm-packages/bin:/usr/local/opt/yarn/bin:$HOME/Library/Python/2.7/bin:/usr/local/opt/python/libexec/bin:/usr/local/opt/go/libexec/bin:$(go env GOPATH)/bin:$HOME/Documents/Scripts:$PATH"
# Homebrew
export PATH="/usr/local/sbin:$PATH"
# MySQL
#export PATH=/usr/local/mysql/bin:$PATH
# Homebrew Python 3.7
export PATH=/usr/local/opt/python/libexec/bin:$PATH
export PATH=/Users/bruno/Library/Python/3.7/bin:$PATH
# macOS Pyhton 2.7
#export PATH=$HOME/Library/Python/2.7/bin:$PATH
# golang
#export PATH=/usr/local/opt/go/libexec/bin:$(go env GOPATH)/bin:$PATH
# Scripts perso
export PATH=$HOME/Documents/Scripts:$PATH
# sqlite
export PATH="/usr/local/opt/sqlite/bin:$PATH"
# echo $PATH sans export ci-dessus
# /Users/bruno/.nvm/versions/node/v8.11.4/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/usr/local/MacGPG2/bin:/opt/X11/bin
# /Users/bruno/.nvm/versions/node/v8.11.4/bin:/usr/local/opt/python/libexec/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/usr/local/MacGPG2/bin:/opt/X11/bin
# Python
# ------------------------------------------------------------
export PYTHONPATH=/usr/local/lib/python3.7/site-packages
export PYTHONSTARTUP=~/.pythonrc
# Set Prompt
# ------------------------------------------------------------
#export PS1="\u@\h:\w\\$ \[$(tput sgr0)\]"
#export PS1="\u@\h \w> "
#export PS1="\u@\h:\w\\$ "
export PS1="\[\e[36m\]\u\[\e[m\]@\[\e[33m\]\h\[\e[m\]: \[\e[32m\]\w\[\e[m\] \$ "
#scripts=$HOME/Documents/Scripts
#export scripts
#export NVM_DIR=~/.nvm
#source $(brew --prefix nvm)/nvm.sh
#export NVM_DIR="$HOME/.nvm"
#[ -s "/usr/local/opt/nvm/nvm.sh" ] && . "/usr/local/opt/nvm/nvm.sh" # This loads nvm
#[ -s "/usr/local/opt/nvm/etc/bash_completion" ] && . "/usr/local/opt/nvm/etc/bash_completion" # This loads nvm bash_completion
export NVM_DIR="$HOME/.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
# Set Default Editor (change 'Nano' to the editor of your choice)
# ------------------------------------------------------------
#export EDITOR=/usr/bin/nano
export EDITOR="/usr/local/bin/bbedit"
# -----------------------------
# 2. MAKE TERMINAL BETTER
# -----------------------------
# The Fuck
# https://github.com/nvbn/thefuck
eval "$(thefuck --alias)"
# cd Documents
#cd() { builtin cd "$@" && ls -la; }
#alias cdls='cd "$@" && ls -la'
alias ex='exa --tree --level=4'
# mcd Test
mcd () { mkdir -p "$1" && cd "$1"; }
# go back x directories
b() {
str=""
count=0
while [ "$count" -lt "$1" ];
do
str=$str"../"
let count=count+1
done
cd $str
}
# -----------------------------
# 3. FINDER
# -----------------------------
# cdf: 'Cd's to frontmost window of MacOS Finder
# ------------------------------------------------------
cdf () {
currFolderPath=$( /usr/bin/osascript <<EOT
tell application "Finder"
try
set currFolder to (folder of the front window as alias)
on error
set currFolder to (path to desktop folder as alias)
end try
POSIX path of currFolder
end tell
EOT
)
echo "cd to \"$currFolderPath\""
cd "$currFolderPath"
}
# view man pages in Preview
pman() { ps=`mktemp -t manpageXXXX`.ps ; man -t $@ > "$ps" ; open "$ps" ; }
# cleanupDS: Recursively delete .DS_Store files
# -------------------------------------------------------------------
alias cleanupDS="find . -type f -name '*.DS_Store' -ls -delete"
# showHidden: Show hidden files in Finder
# hideHidden: Hide hidden files in Finder
# -------------------------------------------------------------------
alias showHidden='defaults write com.apple.finder ShowAllFiles TRUE'
alias hideHidden='defaults write com.apple.finder ShowAllFiles FALSE'
# ---------------------------
# 4. PROCESS MANAGEMENT
# ---------------------------
# topForever: Continual 'top' listing (every 10 seconds)
# -----------------------------------------------------
alias topForever='top -l 9999999 -s 10 -o cpu'
# ttop: Recommended 'top' invocation to minimize resources
# ------------------------------------------------------------
# Taken from this macosxhints article
# http://www.macosxhints.com/article.php?story=20060816123853639
# ------------------------------------------------------------
alias ttop="top -R -F -s 10 -o rsize"
#top -ocpu -R -F -s 2 -n30
# my_ps: List processes owned by my user:
# ------------------------------------------------------------
my_ps() { ps $@ -u $USER -o pid,%cpu,%mem,start,time,bsdtime,command ; }
# ---------------------------------------
# 5. ENVIRONEMENT
# ---------------------------------------
export HOMEBREW_NO_AUTO_UPDATE=1
export GOPATH=$HOME/Documents/go
export GOBIN=$HOME/Documents/go/bin
export CLICOLOR=1
export LSCOLORS=GxFxCxDxBxegedabagaced
# ---------------------------------------
# 6. SYSTEMS OPERATIONS & INFORMATION
# ---------------------------------------
# ii: display useful host related informaton
# -------------------------------------------------------------------
ii() {
echo -e "\nYou are logged on ${RED}$HOST"
echo -e "\nAdditionnal information:$NC " ; uname -a
echo -e "\n${RED}Users logged on:$NC " ; w -h
echo -e "\n${RED}Current date :$NC " ; date
echo -e "\n${RED}Machine stats :$NC " ; uptime
echo -e "\n${RED}Current network location :$NC " ; scselect
echo -e "\n${RED}Public facing IP Address :$NC " ;myip
#echo -e "\n${RED}DNS Configuration:$NC " ; scutil --dns
echo
}
# ---------------------------------------
# 7. BASH
# ---------------------------------------
# grabs the latest .bash_profile file and reloads the prompt
#alias restorebashprofile="curl https://clicclac.info/backup/.bash_profile_silverbook > ~/.bash_profile && reload"
#alias backupbashprofile="scp .bash_profile funnymac@ftp.cluster011.ovh.net:www/backup/ .bash_profile_silverbook"
#alias backupbash="cd && zip - .bash_profile .bash_aliases .sh_aliases | ssh funnymac@ftp.cluster011.ovh.net 'cat > www/backup/bash_silverbook.zip'"
alias backupbash="cd && COPYFILE_DISABLE=1 tar -czvf - .bash_profile .bash_aliases .sh_aliases | ssh funnymac@ftp.cluster011.ovh.net 'cat > www/backup/bash_silverbook.tar.gz'"
#alias restorebash="curl https://clicclac.info/backup/bash_silverbook.zip > bash_silverbook.zip"
alias restorebash="cd && curl https://clicclac.info/backup/bash_silverbook.tar.gz | tar -xzv && reload"
# reloads the prompt, usefull to take new modifications into account
alias reload="source ~/.bash_profile && echo 'source ~/.bash_profile'"
source ~/.sh_aliases
test -e "${HOME}/.iterm2_shell_integration.bash" && source "${HOME}/.iterm2_shell_integration.bash"
[ -f /usr/local/etc/bash_completion ] && . /usr/local/etc/bash_completion
source ~/Documents/Scripts/wp-completion.bash
# venv
#source /usr/local/bin/activate.sh
# Alias definitions.
# You may want to put all your additions into a separate file like
# ~/.bash_aliases, instead of adding them here directly.
# See /usr/share/doc/bash-doc/examples in the bash-doc package.
if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi
# ---------------------------------------
# 8. OTHERS
# ---------------------------------------
# A mettre après 'source /usr/local/bin/activate.sh'
cd() { builtin cd "$@" && ls -la; }

5
.bashrc Normal file
View File

@@ -0,0 +1,5 @@
[ -f ~/.fzf.bash ] && source ~/.fzf.bash
export NVM_DIR="$HOME/.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