Last active
October 11, 2021 13:10
-
-
Save NicHub/a319c780220dea8bd14bf05bf99833ba to your computer and use it in GitHub Desktop.
bash_profile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ** | |
# .bash_profile | |
# * | |
source ~/.bashrc | |
shopt -s expand_aliases | |
# ** | |
# prompt PS1 | |
# * | |
# source /usr/local/bin/prompt.sh | |
# export PS1="\[\033[36m\]\u\[\033[m\]@\[\033[32m\]\h:\[\033[33;1m\]\w\[\033[m\]\$ " | |
# Raspberry | |
# export PS1=$'\n\n\xf0\x9f\x98\xBA'" \t – \[\033[01;32m\]\u@\h\[\033[00m\]:\W > " | |
# export PS1="$PS1\$(git-radar --bash --fetch) > " | |
# http://bashrcgenerator.com/ | |
# export CLICOLOR=1 | |
# export LSCOLORS=ExFxBxDxCxegedabagacad | |
export PS1=$'\n\n\xf0\x9f\x98\x88'" \t – \[\033[01m\]\u@\h\[\033[00m\]:\W > " | |
# ** | |
# TIMEFORMAT | |
# * | |
TIMEFORMAT='time : %3R s' | |
# ** | |
# Alias | |
# To retrieve the definition of an alias type `type ls` (where `ls` is the alias) | |
# * | |
alias ll='ls -lGhF' | |
alias la='ll -a' | |
alias gs='git status' | |
alias gd='git difftool' | |
alias rpisshready='RPI=raspberrypi.local; time( until nc -zw 2 $RPI 22; do sleep 2; done ); ping -c1 $RPI' | |
alias rpisshlogin='rpisshready; ssh rpi' | |
alias sha='shasum -a 256' | |
alias nw='/Applications/nwjs.app/Contents/MacOS/nwjs' | |
alias inkscape="/Applications/Inkscape.app/Contents/Resources/bin/inkscape" | |
alias vlc='/Applications/VLC.app/Contents/MacOS/VLC' | |
alias slic3r='/Applications/Slic3r.app/Contents/MacOS/slic3r' | |
alias lynx='lynx --display_charset=utf8' | |
alias msp430-gcc='/Applications/Energia.app/Contents/Resources/Java/hardware/tools/msp430/bin/msp430-gcc' | |
alias chromedev="/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --remote-debugging-port=9222" | |
alias vb="VirtualBoxVM --startvm Win10_1809Oct_French_x64" | |
alias tiff2pdf='file=`date "+%Y-%m-%d_%H-%M-%S_out.pdf"`; gm convert *.tiff -monochrome -compress Fax $file && open $file' | |
alias gpsd=/usr/local/Cellar/gpsd/3.17/sbin/gpsd | |
alias gpsdctl=/usr/local/Cellar/gpsd/3.17/sbin/gpsdctl | |
# ** | |
# Variables autre que PATH | |
# * | |
export P4CONFIG=.p4config # Perforce | |
export EDITOR=nano # Default terminal editor | |
export PATH="/usr/local/heroku/bin:$PATH" # Added by the Heroku Toolbelt | |
export PATH="/opt/local/bin:/opt/local/sbin:$PATH" # MacPorts | |
# ** | |
# Outils d’édition | |
# * | |
PATH=$PATH:$HOME/Documents/mes_livres/tools/ | |
# Trouve les apostrophes droites dans les fichiers Markdown et les remplace par des apostrophes courbes. | |
alias verifapos='grep -nPUIr --include=*.md --color "\x27"' | |
alias changeapos='find . -type f -iname \*.md -print0 | xargs -0 sed -i "s/\x27/’/g"' | |
# ** | |
# Git completion | |
# * | |
# https://github.com/git/git/blob/master/contrib/completion/git-completion.bash | |
source ~/.git-completion.sh | |
# ** | |
# Arduino | |
# * | |
# PATH=$PATH:/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin | |
# AVRDUDECONF=/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/etc/avrdude.conf | |
# PATH=$PATH:/Applications/Arduino_1.0.6.app/Contents/Resources/Java/hardware/tools/avr/bin | |
# PATH=$PATH:$HOME/Library/Arduino15/packages/arduino/tools/avrdude/6.3.0-arduino6/bin | |
# export AVRDUDECONF=$HOME/Library/Arduino15/packages/arduino/tools/avrdude/6.3.0-arduino6/etc/avrdude.conf | |
# alias avrdude=/Applications/Arduino.app/Contents/Java/hardware/tools/avr/bin/avrdude | |
# alias avrdude=$HOME/Library/Arduino15/packages/arduino/tools/avrdude/6.3.0-arduino6/bin/avrdude | |
# export AVRDUDECONF=$HOME/Library/Arduino15/packages/arduino/tools/avrdude/6.3.0-arduino6/etc/avrdude.conf | |
# export PATH=$PATH:/Applications/Arduino.app/Contents/Java/hardware/tools/avr/bin | |
export AVRDUDECONF=$HOME/Library/Arduino15/packages/MiniCore/hardware/avr/1.0.3/avrdude.conf | |
alias arduino='/Applications/Arduino.app/Contents/MacOS/Arduino' | |
# ** | |
# Nordic Semiconductor nRF51 | |
# * | |
# export PATH="/Applications/Zed.app/bin":$PATH | |
# export PATH=$PATH:/usr/local/bin/gcc-arm-none-eabi-4_9-2015q2/bin | |
# export PATH=$PATH:/Applications/SEGGER/JLink | |
# ** | |
# Calibre | |
# * | |
PATH=$PATH:/Applications/calibre.app/Contents/MacOS/ | |
# ** | |
# VSCODE | |
# * | |
# code () { VSCODE_CWD="$PWD" open -n -b "com.microsoft.VSCode" --args $* ;} | |
# ** | |
# acd_func => cd with browsing history. | |
# * | |
# http://unix.stackexchange.com/questions/157763/do-we-have-more-history-for-cd?newreg=45f4c0eef59d42dcb22b7394b10596d3 | |
# Télécharger acd_func.sh de http://linuxgazette.net/109/marinov.html | |
# ou de https://github.com/djoot/all-bash-history/blob/master/acd_func.sh | |
# et le copier dans /usr/local/bin | |
# | |
# usage : | |
# cd -- # ⇒ liste des répertoires visités | |
# cd -3 # ⇒ revient 3 répertoires en arrière dans l’historique | |
source acd_func.sh | |
# ** | |
# Ouvre le répertoire contenant les fichier de l’application Kindle. | |
# * | |
alias KindleDirOpen='open "$HOME/Library/Containers/com.amazon.Kindle/Data/Library/Application Support/Kindle/My Kindle Content"' | |
# ** | |
# Get IP address of default interface | |
# * | |
function getIPofDefaultInterface() | |
{ | |
local __resultvar=$1 | |
# Get default route interface | |
if=$(route -n get 0.0.0.0 2>/dev/null | awk '/interface: / {print $2}') | |
if [ -n "$if" ]; then | |
# Get IP of the default route interface | |
local __IP=$( ipconfig getifaddr $if ) | |
eval $__resultvar="'$__IP'" | |
else | |
# echo "No default route found" | |
eval $__resultvar="'0.0.0.0'" | |
fi | |
} | |
alias getIP='getIPofDefaultInterface IP; echo $IP' | |
# ** | |
# live-server | |
# https://www.npmjs.com/package/live-server | |
# * | |
alias live-server='getIPofDefaultInterface IP && live-server --host=$IP' | |
# ** | |
# pyserver | |
# sudo ufw allow 4000/tcp | |
# ss -ltn | |
# * | |
# python 2.7 | |
# alias pyserver='PORT=4000; echo -e "\nhttp://localhost:$PORT"; getIPofDefaultInterface IP; echo -e "http://$IP:$PORT\n"; python -m SimpleHTTPServer $PORT' | |
# python 3.6 | |
alias pyserver='PORT=4000; echo -e "\nhttp://localhost:$PORT"; getIPofDefaultInterface IP; echo -e "http://$IP:$PORT\n"; python3 -m http.server $PORT' | |
# ** | |
# php server | |
# * | |
alias php-server='PORT=8080; getIPofDefaultInterface IP && open http://$IP:$PORT && php -S $IP:$PORT' | |
# ** | |
# lsserial | |
# * | |
alias lsserial='ls -d1 /dev/tty.* | grep -v Bluetooth' | |
# ** | |
# Node-Red | |
# ** | |
# Start Node-Red at startup | |
# https://nodered.org/docs/getting-started/running | |
# pm2 start $HOME/.npm-packages/bin/node-red -- -v | |
# pm2 info node-red | |
# pm2 logs node-red | |
# ** | |
# mosquitto | |
# * | |
# /usr/local/etc/mosquitto/mosquitto.conf | |
# mosquitto_pub --host nicobook.local --topic "WEMOS_2/pub/altitude" --message "GET" | |
# alias wemos_1.off='mosquitto_pub --host nicobook.local --topic "WEMOS_1/switch1" --message "OFF"' | |
# alias wemos_1.on='mosquitto_pub --host nicobook.local --topic "WEMOS_1/switch1" --message "ON"' | |
# alias wemos_1.sub='mosquitto_sub --host nicobook.local --topic "WEMOS_1/#" --verbose' | |
# alias wemos_1.toggle='mosquitto_pub --host nicobook.local --topic "WEMOS_1/switch1" --message "TOGGLE"' | |
# alias wemos_1.toggle50='for i in {1..50}; do echo "$i"; wemos_1.on; sleep 1; wemos_1.off; sleep 1; done' | |
# ** | |
# Ruby on Rails | |
# * | |
# https://gorails.com/setup/osx/10.12-sierra | |
# echo 'if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi' >> ~/.bash_profile | |
if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi | |
# ** | |
# JAVA | |
# * | |
# Fonctionne, mais n’affiche pas la bonne version | |
# export JAVA_HOME8=`/usr/libexec/java_home --version 1.8` | |
# export JAVA_HOME9=`/usr/libexec/java_home --version 9` | |
# Dans les préférences système, il est indiqué | |
# export JAVA_HOME8="/Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin" | |
# export JAVA_HOME=`/System/Library/Frameworks/JavaVM.framework/Versions/Current/commands/java_home` | |
# export JAVA_HOME=$JAVA_HOME8 | |
# export PATH=$JAVA_HOME/bin:$PATH | |
export JAVA_HOME=$(/usr/libexec/java_home) | |
# ** | |
# SASS | |
# * | |
export PATH=$PATH:/usr/local/bin/dart-sass/ | |
# ** | |
# Blender | |
# * | |
alias blender=/Applications/Blender/blender.app/Contents/MacOS/blender | |
# ** | |
# esptool.py | |
# * | |
alias esptool=$HOME/Documents/Arduino/hardware/espressif/esp32/tools/esptool.py | |
# ** | |
# Racket | |
# https://docs.racket-lang.org/pollen/Installation.html | |
# | |
# Documentation | |
# raco docs pollen | |
# * | |
export PATH="/Applications/Racket\ v7.2/bin/:$PATH" | |
# ** | |
# Android Studio Tools | |
# adb | |
# * | |
# export PATH="$PATH:$HOME/Library/Android/sdk/platform-tools" | |
export ANDROID_HOME=$HOME/Library/Android/sdk | |
export PATH=$PATH:$ANDROID_HOME/emulator | |
export PATH=$PATH:$ANDROID_HOME/tools | |
export PATH=$PATH:$ANDROID_HOME/tools/bin | |
export PATH=$PATH:$ANDROID_HOME/platform-tools | |
# ** | |
# Scilab | |
# * | |
alias scilab="/Applications/scilab-6.0.2.app/Contents/MacOS/bin/scilab-cli" | |
# ** | |
# NPM | |
# https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally | |
# * | |
export PATH=~/.npm-global/bin:$PATH | |
# ** | |
# perlbrew | |
# https://perlbrew.pl | |
# * | |
source ~/perl5/perlbrew/etc/bashrc | |
# added by Anaconda3 2019.07 installer | |
# >>> conda init >>> | |
# !! Contents within this block are managed by 'conda init' !! | |
__conda_setup="$(CONDA_REPORT_ERRORS=false '/Users/nico/anaconda3/bin/conda' shell.bash hook 2> /dev/null)" | |
if [ $? -eq 0 ]; then | |
\eval "$__conda_setup" | |
else | |
if [ -f "/Users/nico/anaconda3/etc/profile.d/conda.sh" ]; then | |
. "/Users/nico/anaconda3/etc/profile.d/conda.sh" | |
CONDA_CHANGEPS1=false conda activate base | |
else | |
\export PATH="/Users/nico/anaconda3/bin:$PATH" | |
fi | |
fi | |
unset __conda_setup | |
# <<< conda init <<< |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment