Skip to content

Instantly share code, notes, and snippets.

@nic-o
Last active May 28, 2020 06:08
Show Gist options
  • Save nic-o/e425204bbd22a38d090fdcb700583ba4 to your computer and use it in GitHub Desktop.
Save nic-o/e425204bbd22a38d090fdcb700583ba4 to your computer and use it in GitHub Desktop.
Init shell session
#-------------------------------------------------------------------------------
# Alias can also redefine a command to add options
#-------------------------------------------------------------------------------
alias mv='mv -v' # Move w/ verbose mode
alias cp='cp -v' # Copy w/ verbose mode
alias rm='rm -Rfv' # Remove Directory w/ recusrive, force and
# verbose mode
alias df='df -kTh' # Display Free Disk space
alias du='du -sh' # Disk Usage w/ option 'Human Readable' and
# display for folder too
alias pdw='pwd' # Print Working Directory misspelled
alias mkdir='mkdir -vp' # Make Directory with option 'Create
# intermediate directories' & verbose mode
alias top='top -F -R -o cpu' # top
alias nettop='nettop -m route' # nettop
alias ping='ping -c 5' # Ping 5 times
alias mate='mate -wl1' # Binary Mate
alias screen='screen -Rd' # Screen w/ resume the first detached screen
# session and Reattach a session
alias nano='nano -c' # Nano w/ number lines
alias ssh='ssh -v' # SSH mode verbose
alias curl='curl -vOL' # curl with mode verbose (-v), file downloaded
# with its remote name (-O), and follow the
# redirection (-L)
alias brew='brew -v' # verbose mode
alias vpngate='sudo vpn-gate' # npm VPN Gate (https://www.npmjs.com/package/vpn-gate)
# Private Alias
alias ll='ls -aFlhGpF'
alias lf='ls -CF'
alias home='cd ~'
alias up='cd ..'
alias ..='cd ..'
alias h='history'
alias q='exit'
# alias speedtest='speedtest --server 3681'
alias sha1='openssl sha1' # Generate sha1 digest
alias lynx='lynx -accept_all_cookies'
alias bandwidth='wget http://cachefly.cachefly.net/100mb.test -O /dev/null'
# source ~/.profile
if [ -f ~/.bashrc ]; then
source ~/.bashrc
fi
#if [ -f ~/.git-completion.bash ]; then
# source ~/.git-completion.bash
#fi
# export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
test -e ${HOME}/.iterm2_shell_integration.bash && source ${HOME}/.iterm2_shell_integration.bash
#-------------------------------------------------------------------------------
# History
#-------------------------------------------------------------------------------
export HISTSIZE=10000 # 500 is default, 0 will disable history
export HISTFILESIZE=1000000
export HISTTIMEFORMAT='%b %d %I:%M %p '
#export HISTCONTROL=ignoredups
#export HISTCONTROL=ignorespace
export HISTCONTROL=ignoreboth
export HISTIGNORE="history:h:pwd:exit:q:df:ls:ls -la:ll"
# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
xterm-color) color_prompt=yes;;
esac
#-------------------------------------------------------------------------------
# Git
#-------------------------------------------------------------------------------
if [ -f ~/.git-completion.bash ]; then
source ~/.git-completion.bash
source ~/.git-prompt.sh
fi
#-------------------------------------------------------------------------------
# Customs Command Prompt
#-------------------------------------------------------------------------------
# \u Username
# \s Current Shell
# \w current working directory
# \W Basename of the current working dyrectory
# \d Date in weekday month date format ("Mon Jan 16")
# \D{format} Date in strftime format ("%Y-%m-%d")
# \A time in 24-hour HH:MM format
# \t time in 24-hour HH:MM:SS format
# \@ time in 12-hour HH:MM am/pm format
# \T time in 12-hour HH:MM:SS format
# \H Hostname
# \h hostname up to first "."
# \! history number of this command
# \$ when UID is 0 (root) a "#", otherwise a "$"
# \# command number
PS1="\[\e[\033[7m\][\t #\!/\#] \u@\H:\[\e[\033[5m\]\[\e[\033[1m\]\w \[\e[0m\] "
#-------------------------------------------------------------------------------
# Alias can also redefine a command to add options
alias mv='mv -v' # Move w/ verbose mode
alias cp='cp -v' # Copy w/ verbose mode
alias rm='rm -Rfv' # Remove Directory w/ recusrive, force and
# verbose mode
alias df='df -kTh' # Display Free Disk space
alias du='du -sh' # Disk Usage w/ option 'Human Readable' and
# display for folder too
alias pdw='pwd' # Print Working Directory misspelled
alias mkdir='mkdir -vp' # Make Directory with option 'Create
# intermediate directories' & verbose mode
alias top='top -F -R -o cpu' # top
alias nettop='nettop -m route' # nettop
alias ping='ping -c 5' # Ping 5 times
alias mate='mate -wl1' # Binary Mate
alias screen='screen -Rd' # Screen w/ resume the first detached screen
# session and Reattach a session
alias nano='nano -c' # Nano w/ number lines
alias ssh='ssh -v' # SSH mode verbose
alias curl='curl -vOL' # curl with mode verbose (-v), file downloaded
# with its remote name (-O), and follow the
# redirection (-L)
alias brew='brew -v' # verbose mode
alias vpngate='sudo vpn-gate' # npm VPN Gate (https://www.npmjs.com/package/vpn-gate)
# Private Alias
alias ll='ls -aFlhGpF'
alias lf='ls -CF'
alias home='cd ~'
alias up='cd ..'
alias ..='cd ..'
alias h='history'
alias q='exit'
# alias speedtest='speedtest --server 3681'
alias sha1='openssl sha1' # Generate sha1 digest
alias lynx='lynx -accept_all_cookies'
alias bandwidth='wget http://cachefly.cachefly.net/100mb.test -O /dev/null'
# drush
# using PHP config https://drupal.org/node/1302418
# alias drush='DRUSH_PHP=/Applications/MAMP/bin/php/php5.4.34/bin/php /Users/nico/Copy/Development/drush/drush'
# export PATH=$PATH:/Applications/MAMP/Library/bin
# Add homwbrew/sbin
export PATH=/usr/local/sbin:$PATH
#-------------------------------------------------------------------------------
# Environement variables
#-------------------------------------------------------------------------------
export EDITOR=vi # Default editor
#export LESS='-M' # less with line numbers & long prompt
export LC_ALL=en_US.UTF-8 # force all applications use this lang
export LANG=en_US.UTF-8 # Language
#-------------------------------------------------------------------------------
# Color
#-------------------------------------------------------------------------------
# This string is a concatenation of pairs of the
# format fb, where f is the foreground color and b is the background color.
# a black | A bold black, usually shows up as dark grey
# b red | B bold red
# c green | C bold green
# d brown | D bold brown, usually shows up as yellow
# e blue | E bold blue
# f magenta | F bold magenta
# g cyan | G bold cyan
# h light grey | H bold light grey; looks like bright white
# x default foreground or background
# ------------------------------------------------------------------------------
# 1. directory | 6. block special
# 2. symbolic link | 7. character special
# 3. socket | 8. executable with setuid bit set
# 4. pipe | 9. executable with setgid bit set
# 5. executable | 10. directory writable to others, with sticky bit
# 11. directory writable to others, without sticky bit
# ------------------------------------------------------------------------------
# COLORS
# Attributes: Text color: Background:
# 0 reset all 30 black 40 black
# 1 bright 31 red 41 red
# 2 dim 32 green 42 green
# 4 underscore 33 yellow 43 yellow
# 5 blink 34 blue 44 blue
# 7 reverse 35 purple 45 purple
# 8 hidden 36 cyan 46 cyan
# 37 white 47 white
# Separate with ";"
# ------------------------------------------------------------------------------
# https://wiki.archlinux.org/index.php/Color_Bash_Prompt
# http://misc.flogisoft.com/bash/tip_colors_and_formatting
# ------------------------------------------------------------------------------
# Color Manpages
export LESS_TERMCAP_mb=$'\E[01;31m' # begin blinking
export LESS_TERMCAP_md=$'\E[01;31m' # begin bold
export LESS_TERMCAP_me=$'\E[0m' # end mode
export LESS_TERMCAP_se=$'\E[0m' # end standout-mode
export LESS_TERMCAP_so=$'\E[01;44;33m' # begin standout-mode - info box
export LESS_TERMCAP_ue=$'\E[0m' # end underline
export LESS_TERMCAP_us=$'\E[01;32m' # begin underline
#export MANPAGER="/usr/bin/most -s" # color using most
# Colorized few Commands
export GREP_OPTIONS='--color=auto' # workds for grep, egrep & fgrep
export CLICOLOR=1 # for ls
# export LSCOLORS='Hx'
# export LSCOLORS=HxBxhxDxfxhxhxhxhxcxcx
# http://geoff.greer.fm/lscolors/
# export LSCOLORS=HeBxhxDxfxhxhxhxhxcxcx
# ------------------------------------------------------------------------------
# Color name variables
# Syntaxe: \033[<style>;<color>m]
# Reset
COLOR_OFF='\033[0m' # ${Color_Off} Text Reset
# Styles:
BOLD='\033[1m'
DIM='\033[2m'
UNDERLINED='\033[4m'
BLINK='\033[5m'
REVERSE='\033[7m'
HIDDEN='\033[8m' # Password
# Regular Colors
BLACK='\033[0;30m' # ${BLACK}
RED='\033[0;31m' # ${RED}
GREEN='\033[0;32m' # ${GREEN}
YELLOW='\033[0;33m' # ${YELLOW}
Blue='\033[0;34m' # ${BLUE}
MAGENTA='\033[0;35m' # ${MAGENTA}
CYAN='\033[0;36m' # ${CYAN}
LIGHTGRAY='\033[0;37m' # ${LIGHTGRAY}
DARKGRAY='\033[0;90m' # ${DARKGRAY}
LIGHTRED='\033[0;91m' # ${LIGHTRED}
LIGHTGREEN='\033[0;92m' # ${LIGHTGREEN}
LIGHTYELLOW='\033[0;93m' # ${LIGHTYELLOW}
LIGHTBLUE='\033[0;94m' # ${LIGHTBLUE}
LIGHTMAGENTA='\033[0;95m' # ${LIGHTCYAN}
LIGHTCYAN='\033[0;96m' # ${LIGHTCYAN}
WHITE='\033[0;97m' # ${WHITE}
# Bold
Bold_Black='\033[1;30m' # ${Bold_Black}
Bold_Red='\033[1;31m' # ${Bold_Red}
Bold_Green='\033[1;32m' # ${Bold_Green}
Bold_Yellow='\033[1;33m' # ${Bold_Yellow}
Bold_Blue='\033[1;34m' # ${Bold_Blue}
Bold_Magenta='\033[1;35m' # ${Bold_Magenta}
Bold_Cyan='\033[1;36m' # ${Bold_Cyan}
Bold_LightGray='\033[1;37m' # ${Bold_LightGray}
Bold_DarkGray='\033[1;90m' # ${Bold_DarkGray}
Bold_LightRed='\033[1;91m' # ${Bold_LightRed}
Bold_LightGreen='\033[1;92m' # ${Bold_LightGreen}
Bold_LightYellow='\033[1;93m' # ${Bold_LightYellow}
Bold_LightBlue='\033[1;94m' # ${Bold_LightBlue}
Bold_LightMagenta='\033[1;95m' # ${Bold_LightCyan}
Bold_LightCyan='\033[1;96m' # ${Bold_LightCyan}
Bold_White='\033[1;97m' # ${Bold_White}
# Underline
Underlined_Black='\033[1;30m' # ${Underlined_Black}
Underlined_Red='\033[1;31m' # ${Underlined_Red}
Underlined_Green='\033[1;32m' # ${Underlined_Green}
Underlined_Yellow='\033[1;33m' # ${Underlined_Yellow}
Underlined_Blue='\033[1;34m' # ${Underlined_Blue}
Underlined_Magenta='\033[1;35m' # ${Underlined_Magenta}
Underlined_Cyan='\033[1;36m' # ${Underlined_Cyan}
Underlined_LightGray='\033[1;37m' # ${Underlined_LightGray}
Underlined_DarkGray='\033[1;90m' # ${Underlined_DarkGray}
Underlined_LightRed='\033[1;91m' # ${Underlined_LightRed}
Underlined_LightGreen='\033[1;92m' # ${Underlined_LightGreen}
Underlined_LightYellow='\033[1;93m' # ${Underlined_LightYellow}
Underlined_LightBlue='\033[1;94m' # ${Underlined_LightBlue}
Underlined_LightMagenta='\033[1;95m' # ${Underlined_LightCyan}
Underlined_LightCyan='\033[1;96m' # ${Underlined_LightCyan}
Underlined_White='\033[1;97m' # ${Underlined_White}
# Background
Background_Black='\033[40m' # ${Background_Black}
Background_Red='\033[41m' # ${Background_Red}
Background_Green='\033[42m' # ${Background_Green}
Background_Yellow='\033[43m' # ${Background_Yellow}
Background_Blue='\033[44m' # ${Background_Blue}
Background_Magenta='\033[45m' # ${Background_Magenta}
Background_Cyan='\033[46m' # ${Background_Cyan}
Background_LightGray='\033[47m' # ${Background_LightGray}
Background_DarkGray='\033[100m' # ${Background_DarkGray}
Background_LightRed='\033[101m' # ${Background_LightRed}
Background_LightGreen='\033[102m' # ${Background_LightGreen}
Background_LightYellow='\033[103m' # ${Background_LightYellow}
Background_LightBlue='\033[104m' # ${Background_LightBlue}
Background_LightMagenta='\033[105m' # ${Background_LightCyan}
Background_LightCyan='\033[106m' # ${Background_LightCyan}
Background_White='\033[107m' # ${Background_White}
#-------------------------------------------------------------------------------
# Functions
# All functions must be loaded before (startup, etc....)
#-------------------------------------------------------------------------------
# Startup Screen
function menu() {
# cal
# date
echo -e "$REVERSE$BOLD Main Menu $COLOR_OFF"
echo -e " $BOLD Process & Network:$COLOR_OFF"
echo -e " 1. Display and update sorted information about processes"
echo -e " 2. Display updated information about the network"
echo -e " 3. Show my current IP [public | private]"
echo -e " 4. Speedtest to Server #5427 (Eureka / CA, United States)"
echo -e " $BOLD SSH Tunnels:$COLOR_OFF"
echo -e " 5. List of SSH tunnels available (shorcuts)"
echo -e " 6. SSH to Superman as AdminServer"
echo -e " 7. SSH to Integrity Wordpress Host"
echo -e " 8. Secure Copy scp"
echo -e " $BOLD Commands & Shortcuts:$COLOR_OFF"
echo -e " 9. List of command aliases defined"
echo -e " 10. Search files or directory"
echo -e " 11. Zip a folder / unzip an archive"
echo -e " 12. Tar and compress a folder (gz) / Untar an archive"
echo -e " 13. Rar a folder / Unrar an archive"
echo -e " 14. Create disk images (DMG)"
echo -e " 15. cURL (and resume)"
echo -e " 16. Force copy "
echo -e " $RED$BOLD Q. Exit$COLOR_OFF"
# Check if there's any arguments passed: menu <number>
if [ -z $1 ]
then
local c
read -p " Enter your choice [ 1 - 16 ] " c
else
c=$1
fi
echo ""
case $c in
[qQ]) echo -e " Bye!"; kill -INT $$;;
1) top ;;
2) nettop;;
3) my_ip ;;
4) write_header " Testing the internet connection... ";
speedtest --server 5427;;
5) list_ssh ;;
6) write_header " Connect to Superman... ";
ssh -p 2222 adminserver@layout.sophieparis.com;;
7) write_header " Connect to Integitry Corporate host... ";
ssh -p 18765 integ833@securesgp21.sgcpanel.com;;
8) echo " scp -Eprv -P 2222 user@host:/path/to/folder/source.txt ~/Destination";
echo " -E Preserves extended attributes, resource forks, and ACLs.";
echo " -p Preserves modification times, access times, and modes from the original file. ";
echo " -r Recursively copy entire directories.";
echo " -v Verbose mode.";
echo " -P <port> Specifies the port to connect to on the remote host.";;
9) list_alias ;;
10) echo " find ~/Path/To/Folder -type f -iname '*.jpg' <commands>";
echo " -type d = directory | f = regular file | l = symbolic link";
echo " -name (sensitive case) | iname (no sensitive case)";
echo " <commands> PRIMARIES: -delete";
echo " -empty";
echo " -exec";
echo " -ls";;
11) echo " zip -r -X <archive.zip> ~/Path/To/Folder";
echo " unzip <archive.zip>";;
12) echo " Compress: tar -zcvf <archive.tar.gz> ~/Path/To/Folder";
echo " Extract: tar -zxvf <archive.tar.gz>";;
13) echo " Compress: rar a -r <archive.rar> ~/Path/To/Folder";
echo " Extract: unrar e <archive.rar>";;
14) echo " hdiutil create -format UDZO -srcfolder ~/Path/To/Folder <archive.dmg>";;
15) echo " curl -vOL <url>";
echo " -v mode verbose";
echo " -O Write output to a local file named like the remote file we get.";
echo " -L follow the 3xx header: moved or different location";
echo " -C - resume file (if interrupted). Do not forget the end dash";;
16) echo " cp -RfXv <source> <destination>";
echo " -R recursive copy (including hidden files).";
echo " -f forces the command to copy everything without stopping for errors.";
echo " -X Do not copy Extended Attributes.";
echo " -v Mode verbose, showing files as they are copied.";;
*) echo -e "Please select between 1 to 16 choice only.";;
esac
}
#-------------------------------------------------------------------------------
# Reload the bash config file
function reload() {
source ~/.bashrc
}
#-------------------------------------------------------------------------------
# Display header message
# $1 - message
function write_header() {
local h="$@"
echo -e "+-------------------------------------------------------------+"
echo -e "$REVERSE${h}$COLOR_OFF"
# echo -e "+-------------------------------------------------------------+"
}
#-------------------------------------------------------------------------------
# liste les alias et functions
function list_alias() {
# cat ~/.bashrc|egrep "alias|function"|grep -v "^#"
write_header " List of aliases defined "
cat ~/.bashrc | grep "alias " | egrep -v "^#|echo|cat|list_alias|unalias"
# alias
# typeset -F
}
#-------------------------------------------------------------------------------
# List of all SSH tunnels in ~/.ssh/config
function list_ssh() {
write_header " List of SSH Tunnels "
cat ~/.ssh/config | grep "Host "
}
#-------------------------------------------------------------------------------
function my_ip() {
if [[ -z $* ]]; then
echo "usage: my_ip [public | private (en0, en1, enx, fw0, interface-name) ]"
read -p "Command: " cmd arg
else
cmd=$1
fi
case $cmd in
[pP]ublic)
unalias curl
IP=$(curl -s ipecho.net/plain)
echo "Your current public IP: $IP" ;;
[pP]rivate)
if [[ -n $arg ]]; then
ipconfig getifaddr $arg
elif [[ -n $2 ]]; then
ipconfig getifaddr $2
else
ipconfig getifaddr en3
fi
;;
*) echo "Invalid command. Use <public> or <private>"
;;
esac
unset cmd arg
}
#------------------------------------------------------------------------------
function display_color() {
if [[ -z $* ]]; then
echo "Usage: display all available colors. Choose how many:"
read -p "[16] or [256]: " color
elif [[ $# -gt 1 ]]; then
echo "Too many arguments. Usage: displayColor <16> | <256>"
return
else
color=$1
fi
case $color in
16)
for clbg in {40..47} {100..107} 49 ; do
#Foreground
for clfg in {30..37} {90..97} 39 ; do
#Formatting
for attr in 0 1 2 4 5 7 ; do
#Print the result
echo -en "\033[${attr};${clbg};${clfg}m ^[${attr};${clbg};${clfg}m \033[0m"
done
echo #Newline
done
done
;;
256)
for fgbg in 38 48 ; do #Foreground/Background
for color in {0..256} ; do #Colors
#Display the color
echo -en "\033[${fgbg};5;${color}m ${color}\t\033[0m"
#Display 10 colors per lines
if [ $((($color + 1) % 10)) == 0 ] ; then
echo #New line
fi
done
echo #New line
done
;;
*)
echo "Usage: Use only 16 colors or 256 colors. $color is not available."
;;
esac
}
#-------------------------------------------------------------------------------
# Find a file with a pattern in name - dans le rep local:
function ff() { find . -type f -iname '*'$*'*' -ls ; }
# Find a file with a pattern in name - dans /:
function ffslash() { sudo find / -type f -iname '*'$*'*' -ls ; }
# Creates an archive (*.tar.gz) from given directory.
function maketar() { tar -cvzf "${1%%/}.tar.gz" "${1%%/}/"; }
# Create a ZIP archive of a file or folder.
function makezip() { zip -r "${1%%/}.zip" "$1" ; }
# Make your directories and files access rights sane.
function sanitize() { chmod -R u=rwX,g=rX,o= "$@" ;}
#-------------------------------------------------------------------------------
# Connect to TOR network functions
# https://kremalicious.com/simple-tor-setup-on-mac-os-x/
function thor() {
function enable_proxy() {
INTERFACE=$1
# trap ctrl-c and call disable_proxy()
function disable_proxy() {
sudo networksetup -setsocksfirewallproxystate "$INTERFACE" off
echo "$(tput setaf 64)" #green
echo "SOCKS proxy disabled for interface $INTERFACE"
echo "$(tput sgr0)" # color reset
sudo killall tor
}
# # Ask for the administrator password upfront
sudo -v
# Keep-alive: update existing `sudo` time stamp until finished
# while true
# do
# sudo -n true
# sleep 60
# kill -0 "$$" || exit;
# done 2>/dev/null &
# trap ctrl-c and call disable_proxy()
trap disable_proxy INT
# Let's roll
sudo networksetup -setsocksfirewallproxy "$INTERFACE" 127.0.0.1 9050 off
sudo networksetup -setsocksfirewallproxystate "$INTERFACE" on
echo "$(tput setaf 64)" # green
echo "SOCKS proxy 127.0.0.1:9050 enabled for interface $INTERFACE"
echo "$(tput setaf 136)" # orange
echo "Starting Tor..."
echo "$(tput sgr0)" # color reset
tor & wait
}
# Main
# Check if there's any arguments pased: tor.sh <option>
if [ -z $1 ]
then
echo -e " $BOLD Network Interfaces available:$COLOR_OFF"
echo -e " 1. Display Ethernet"
echo -e " 2. Wi-Fi"
echo -e " 3. Thunderbolt Ethernet"
echo -e " 4. Thunderbolt Bridge"
echo -e " 5. Display FireWire"
echo -e " 6. iPhone USB"
echo -e " 7. iPad USB"
echo -e " 8. Bluetooth PAN"
echo -e " $BOLD Other Options:$COLOR_OFF"
echo -e " All. List current network interface"
echo -e " Chk. Check if you are using Tor"
echo -e " Q. Exit"
local c
read -p " Enter your choice [ 1 - 8 ] or options " c
else
c=$1
fi
echo ""
case $c in
1) enable_proxy "Display Ethernet";;
2) enable_proxy "Wi-Fi";;
3) enable_proxy "Thunderbolt Ethernet";;
4) enable_proxy "Thunderbolt Bridge";;
5) enable_proxy "Display FireWire";;
6) enable_proxy "iPhone USB";;
7) enable_proxy "iPad USB";;
8) enable_proxy "Bluetooth PAN";;
[qQ]) echo -e " Bye!"; kill -INT $$;;
[aA]ll) networksetup -listallnetworkservices;;
[Cc]hk) open https://check.torproject.org
esac
}
#-------------------------------------------------------------------------------
# Usage: compresspdf [input file] [output file] [screen|ebook*|printer|prepress]
function compresspdf() {
gs -sDEVICE=pdfwrite -dNOPAUSE -dQUIET -dBATCH -dPDFSETTINGS=/${3:-"ebook"} -dCompatibilityLevel=1.4 -sOutputFile="$2" "$1"
}
#-------------------------------------------------------------------------------
# Startup
#-------------------------------------------------------------------------------
# Startup Menu
# menu # Display menu
test -e ${HOME}/.iterm2_shell_integration.bash && source ${HOME}/.iterm2_shell_integration.bash
#-------------------------------------------------------------------------------
# Color
#-------------------------------------------------------------------------------
# This string is a concatenation of pairs of the
# format fb, where f is the foreground color and b is the background color.
# a black | A bold black, usually shows up as dark grey
# b red | B bold red
# c green | C bold green
# d brown | D bold brown, usually shows up as yellow
# e blue | E bold blue
# f magenta | F bold magenta
# g cyan | G bold cyan
# h light grey | H bold light grey; looks like bright white
# x default foreground or background
# ------------------------------------------------------------------------------
# 1. directory | 6. block special
# 2. symbolic link | 7. character special
# 3. socket | 8. executable with setuid bit set
# 4. pipe | 9. executable with setgid bit set
# 5. executable | 10. directory writable to others, with sticky bit
# 11. directory writable to others, without sticky bit
# ------------------------------------------------------------------------------
# COLORS
# Attributes: Text color: Background:
# 0 reset all 30 black 40 black
# 1 bright 31 red 41 red
# 2 dim 32 green 42 green
# 4 underscore 33 yellow 43 yellow
# 5 blink 34 blue 44 blue
# 7 reverse 35 purple 45 purple
# 8 hidden 36 cyan 46 cyan
# 37 white 47 white
# Separate with ";"
# ------------------------------------------------------------------------------
# https://wiki.archlinux.org/index.php/Color_Bash_Prompt
# http://misc.flogisoft.com/bash/tip_colors_and_formatting
# ------------------------------------------------------------------------------
# Color Manpages
export LESS_TERMCAP_mb=$'\E[01;31m' # begin blinking
export LESS_TERMCAP_md=$'\E[01;31m' # begin bold
export LESS_TERMCAP_me=$'\E[0m' # end mode
export LESS_TERMCAP_se=$'\E[0m' # end standout-mode
export LESS_TERMCAP_so=$'\E[01;44;33m' # begin standout-mode - info box
export LESS_TERMCAP_ue=$'\E[0m' # end underline
export LESS_TERMCAP_us=$'\E[01;32m' # begin underline
#export MANPAGER="/usr/bin/most -s" # color using most
# Colorized few Commands
export GREP_OPTIONS='--color=auto' # workds for grep, egrep & fgrep
export CLICOLOR=1 # for ls
# export LSCOLORS='Hx'
# export LSCOLORS=HxBxhxDxfxhxhxhxhxcxcx
# http://geoff.greer.fm/lscolors/
# export LSCOLORS=HeBxhxDxfxhxhxhxhxcxcx
# ------------------------------------------------------------------------------
# Color name variables
# Syntaxe: \033[<style>;<color>m]
# Reset
COLOR_OFF='\033[0m' # ${Color_Off} Text Reset
# Styles:
BOLD='\033[1m'
DIM='\033[2m'
UNDERLINED='\033[4m'
BLINK='\033[5m'
REVERSE='\033[7m'
HIDDEN='\033[8m' # Password
# Regular Colors
BLACK='\033[0;30m' # ${BLACK}
RED='\033[0;31m' # ${RED}
GREEN='\033[0;32m' # ${GREEN}
YELLOW='\033[0;33m' # ${YELLOW}
Blue='\033[0;34m' # ${BLUE}
MAGENTA='\033[0;35m' # ${MAGENTA}
CYAN='\033[0;36m' # ${CYAN}
LIGHTGRAY='\033[0;37m' # ${LIGHTGRAY}
DARKGRAY='\033[0;90m' # ${DARKGRAY}
LIGHTRED='\033[0;91m' # ${LIGHTRED}
LIGHTGREEN='\033[0;92m' # ${LIGHTGREEN}
LIGHTYELLOW='\033[0;93m' # ${LIGHTYELLOW}
LIGHTBLUE='\033[0;94m' # ${LIGHTBLUE}
LIGHTMAGENTA='\033[0;95m' # ${LIGHTCYAN}
LIGHTCYAN='\033[0;96m' # ${LIGHTCYAN}
WHITE='\033[0;97m' # ${WHITE}
# Bold
Bold_Black='\033[1;30m' # ${Bold_Black}
Bold_Red='\033[1;31m' # ${Bold_Red}
Bold_Green='\033[1;32m' # ${Bold_Green}
Bold_Yellow='\033[1;33m' # ${Bold_Yellow}
Bold_Blue='\033[1;34m' # ${Bold_Blue}
Bold_Magenta='\033[1;35m' # ${Bold_Magenta}
Bold_Cyan='\033[1;36m' # ${Bold_Cyan}
Bold_LightGray='\033[1;37m' # ${Bold_LightGray}
Bold_DarkGray='\033[1;90m' # ${Bold_DarkGray}
Bold_LightRed='\033[1;91m' # ${Bold_LightRed}
Bold_LightGreen='\033[1;92m' # ${Bold_LightGreen}
Bold_LightYellow='\033[1;93m' # ${Bold_LightYellow}
Bold_LightBlue='\033[1;94m' # ${Bold_LightBlue}
Bold_LightMagenta='\033[1;95m' # ${Bold_LightCyan}
Bold_LightCyan='\033[1;96m' # ${Bold_LightCyan}
Bold_White='\033[1;97m' # ${Bold_White}
# Underline
Underlined_Black='\033[1;30m' # ${Underlined_Black}
Underlined_Red='\033[1;31m' # ${Underlined_Red}
Underlined_Green='\033[1;32m' # ${Underlined_Green}
Underlined_Yellow='\033[1;33m' # ${Underlined_Yellow}
Underlined_Blue='\033[1;34m' # ${Underlined_Blue}
Underlined_Magenta='\033[1;35m' # ${Underlined_Magenta}
Underlined_Cyan='\033[1;36m' # ${Underlined_Cyan}
Underlined_LightGray='\033[1;37m' # ${Underlined_LightGray}
Underlined_DarkGray='\033[1;90m' # ${Underlined_DarkGray}
Underlined_LightRed='\033[1;91m' # ${Underlined_LightRed}
Underlined_LightGreen='\033[1;92m' # ${Underlined_LightGreen}
Underlined_LightYellow='\033[1;93m' # ${Underlined_LightYellow}
Underlined_LightBlue='\033[1;94m' # ${Underlined_LightBlue}
Underlined_LightMagenta='\033[1;95m' # ${Underlined_LightCyan}
Underlined_LightCyan='\033[1;96m' # ${Underlined_LightCyan}
Underlined_White='\033[1;97m' # ${Underlined_White}
# Background
Background_Black='\033[40m' # ${Background_Black}
Background_Red='\033[41m' # ${Background_Red}
Background_Green='\033[42m' # ${Background_Green}
Background_Yellow='\033[43m' # ${Background_Yellow}
Background_Blue='\033[44m' # ${Background_Blue}
Background_Magenta='\033[45m' # ${Background_Magenta}
Background_Cyan='\033[46m' # ${Background_Cyan}
Background_LightGray='\033[47m' # ${Background_LightGray}
Background_DarkGray='\033[100m' # ${Background_DarkGray}
Background_LightRed='\033[101m' # ${Background_LightRed}
Background_LightGreen='\033[102m' # ${Background_LightGreen}
Background_LightYellow='\033[103m' # ${Background_LightYellow}
Background_LightBlue='\033[104m' # ${Background_LightBlue}
Background_LightMagenta='\033[105m' # ${Background_LightCyan}
Background_LightCyan='\033[106m' # ${Background_LightCyan}
Background_White='\033[107m' # ${Background_White}
#-------------------------------------------------------------------------------
# Environement variables
#-------------------------------------------------------------------------------
export EDITOR=vi # Default editor
export LESS='-M' # less with line numbers & long prompt
export LC_ALL=en_US.UTF-8 # force all applications use this lang
export LANG=en_US.UTF-8 # Language
# drush
# using PHP config https://drupal.org/node/1302418
# alias drush='DRUSH_PHP=/Applications/MAMP/bin/php/php5.4.34/bin/php /Users/nico/Copy/Development/drush/drush'
# export PATH=$PATH:/Applications/MAMP/Library/bin
# Add homwbrew/sbin
export PATH=/usr/local/sbin:$PATH
#-------------------------------------------------------------------------------
# Functions
# All functions must be loaded before (startup, etc....)
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# Startup Screen
function menu() {
# cal
# date
echo -e "$REVERSE$BOLD Main Menu $COLOR_OFF"
echo -e " $BOLD Process & Network:$COLOR_OFF"
echo -e " 1. Display and update sorted information about processes"
echo -e " 2. Display updated information about the network"
echo -e " 3. Show my current IP [public | private]"
echo -e " 4. Speedtest to Server #5427 (Eureka / CA, United States)"
echo -e " $BOLD SSH Tunnels:$COLOR_OFF"
echo -e " 5. List of SSH tunnels available (shorcuts)"
echo -e " 6. SSH to Superman as AdminServer"
echo -e " 7. SSH to Integrity Wordpress Host"
echo -e " 8. Secure Copy scp"
echo -e " $BOLD Commands & Shortcuts:$COLOR_OFF"
echo -e " 9. List of command aliases defined"
echo -e " 10. Search files or directory"
echo -e " 11. Zip a folder / unzip an archive"
echo -e " 12. Tar and compress a folder (gz) / Untar an archive"
echo -e " 13. Rar a folder / Unrar an archive"
echo -e " 14. Create disk images (DMG)"
echo -e " 15. cURL (and resume)"
echo -e " 16. Force copy "
echo -e " $RED$BOLD Q. Exit$COLOR_OFF"
# Check if there's any arguments passed: menu <number>
if [ -z $1 ]
then
local c
read -p " Enter your choice [ 1 - 16 ] " c
else
c=$1
fi
echo ""
case $c in
[qQ]) echo -e " Bye!"; kill -INT $$;;
1) top ;;
2) nettop;;
3) my_ip ;;
4) write_header " Testing the internet connection... ";
speedtest --server 5427;;
5) list_ssh ;;
6) write_header " Connect to Superman... ";
ssh -p 2222 adminserver@layout.sophieparis.com;;
7) write_header " Connect to Integitry Corporate host... ";
ssh -p 18765 integ833@securesgp21.sgcpanel.com;;
8) echo " scp -Eprv -P 2222 user@host:/path/to/folder/source.txt ~/Destination";
echo " -E Preserves extended attributes, resource forks, and ACLs.";
echo " -p Preserves modification times, access times, and modes from the original file. ";
echo " -r Recursively copy entire directories.";
echo " -v Verbose mode.";
echo " -P <port> Specifies the port to connect to on the remote host.";;
9) list_alias ;;
10) echo " find ~/Path/To/Folder -type f -iname '*.jpg' <commands>";
echo " -type d = directory | f = regular file | l = symbolic link";
echo " -name (sensitive case) | iname (no sensitive case)";
echo " <commands> PRIMARIES: -delete";
echo " -empty";
echo " -exec";
echo " -ls";;
11) echo " zip -r -X <archive.zip> ~/Path/To/Folder";
echo " unzip <archive.zip>";;
12) echo " Compress: tar -zcvf <archive.tar.gz> ~/Path/To/Folder";
echo " Extract: tar -zxvf <archive.tar.gz>";;
13) echo " Compress: rar a -r <archive.rar> ~/Path/To/Folder";
echo " Extract: unrar e <archive.rar>";;
14) echo " hdiutil create -format UDZO -srcfolder ~/Path/To/Folder <archive.dmg>";;
15) echo " curl -vOL <url>";
echo " -v mode verbose";
echo " -O Write output to a local file named like the remote file we get.";
echo " -L follow the 3xx header: moved or different location";
echo " -C - resume file (if interrupted). Do not forget the end dash";;
16) echo " cp -RfXv <source> <destination>";
echo " -R recursive copy (including hidden files).";
echo " -f forces the command to copy everything without stopping for errors.";
echo " -X Do not copy Extended Attributes.";
echo " -v Mode verbose, showing files as they are copied.";;
*) echo -e "Please select between 1 to 16 choice only.";;
esac
}
#-------------------------------------------------------------------------------
# Reload the bash config file
function reload() {
source ~/.bashrc
}
#-------------------------------------------------------------------------------
# Display header message
# $1 - message
function write_header() {
local h="$@"
echo -e "+-------------------------------------------------------------+"
echo -e "$REVERSE${h}$COLOR_OFF"
# echo -e "+-------------------------------------------------------------+"
}
#-------------------------------------------------------------------------------
# liste les alias et functions
function list_alias() {
# cat ~/.bashrc|egrep "alias|function"|grep -v "^#"
write_header " List of aliases defined "
cat ~/.bashrc | grep "alias " | egrep -v "^#|echo|cat|list_alias|unalias"
# alias
# typeset -F
}
#-------------------------------------------------------------------------------
# List of all SSH tunnels in ~/.ssh/config
function list_ssh() {
write_header " List of SSH Tunnels "
cat ~/.ssh/config | grep "Host "
}
#-------------------------------------------------------------------------------
function my_ip() {
if [[ -z $* ]]; then
echo "usage: my_ip [public | private (en0, en1, enx, fw0, interface-name) ]"
read -p "Command: " cmd arg
else
cmd=$1
fi
case $cmd in
[pP]ublic)
unalias curl
IP=$(curl -s ipecho.net/plain)
echo "Your current public IP: $IP" ;;
[pP]rivate)
if [[ -n $arg ]]; then
ipconfig getifaddr $arg
elif [[ -n $2 ]]; then
ipconfig getifaddr $2
else
ipconfig getifaddr en3
fi
;;
*) echo "Invalid command. Use <public> or <private>"
;;
esac
unset cmd arg
}
#------------------------------------------------------------------------------
function display_color() {
if [[ -z $* ]]; then
echo "Usage: display all available colors. Choose how many:"
read -p "[16] or [256]: " color
elif [[ $# -gt 1 ]]; then
echo "Too many arguments. Usage: displayColor <16> | <256>"
return
else
color=$1
fi
case $color in
16)
for clbg in {40..47} {100..107} 49 ; do
#Foreground
for clfg in {30..37} {90..97} 39 ; do
#Formatting
for attr in 0 1 2 4 5 7 ; do
#Print the result
echo -en "\033[${attr};${clbg};${clfg}m ^[${attr};${clbg};${clfg}m \033[0m"
done
echo #Newline
done
done
;;
256)
for fgbg in 38 48 ; do #Foreground/Background
for color in {0..256} ; do #Colors
#Display the color
echo -en "\033[${fgbg};5;${color}m ${color}\t\033[0m"
#Display 10 colors per lines
if [ $((($color + 1) % 10)) == 0 ] ; then
echo #New line
fi
done
echo #New line
done
;;
*)
echo "Usage: Use only 16 colors or 256 colors. $color is not available."
;;
esac
}
#-------------------------------------------------------------------------------
# Find a file with a pattern in name - dans le rep local:
function ff() { find . -type f -iname '*'$*'*' -ls ; }
# Find a file with a pattern in name - dans /:
function ffslash() { sudo find / -type f -iname '*'$*'*' -ls ; }
# Creates an archive (*.tar.gz) from given directory.
function maketar() { tar -cvzf "${1%%/}.tar.gz" "${1%%/}/"; }
# Create a ZIP archive of a file or folder.
function makezip() { zip -r "${1%%/}.zip" "$1" ; }
# Make your directories and files access rights sane.
function sanitize() { chmod -R u=rwX,g=rX,o= "$@" ;}
#-------------------------------------------------------------------------------
# Connect to TOR network functions
# https://kremalicious.com/simple-tor-setup-on-mac-os-x/
function thor() {
function enable_proxy() {
INTERFACE=$1
# trap ctrl-c and call disable_proxy()
function disable_proxy() {
sudo networksetup -setsocksfirewallproxystate "$INTERFACE" off
echo "$(tput setaf 64)" #green
echo "SOCKS proxy disabled for interface $INTERFACE"
echo "$(tput sgr0)" # color reset
sudo killall tor
}
# # Ask for the administrator password upfront
sudo -v
# Keep-alive: update existing `sudo` time stamp until finished
# while true
# do
# sudo -n true
# sleep 60
# kill -0 "$$" || exit;
# done 2>/dev/null &
# trap ctrl-c and call disable_proxy()
trap disable_proxy INT
# Let's roll
sudo networksetup -setsocksfirewallproxy "$INTERFACE" 127.0.0.1 9050 off
sudo networksetup -setsocksfirewallproxystate "$INTERFACE" on
echo "$(tput setaf 64)" # green
echo "SOCKS proxy 127.0.0.1:9050 enabled for interface $INTERFACE"
echo "$(tput setaf 136)" # orange
echo "Starting Tor..."
echo "$(tput sgr0)" # color reset
tor & wait
}
# Main
# Check if there's any arguments pased: tor.sh <option>
if [ -z $1 ]
then
echo -e " $BOLD Network Interfaces available:$COLOR_OFF"
echo -e " 1. Display Ethernet"
echo -e " 2. Wi-Fi"
echo -e " 3. Thunderbolt Ethernet"
echo -e " 4. Thunderbolt Bridge"
echo -e " 5. Display FireWire"
echo -e " 6. iPhone USB"
echo -e " 7. iPad USB"
echo -e " 8. Bluetooth PAN"
echo -e " $BOLD Other Options:$COLOR_OFF"
echo -e " All. List current network interface"
echo -e " Chk. Check if you are using Tor"
echo -e " Q. Exit"
local c
read -p " Enter your choice [ 1 - 8 ] or options " c
else
c=$1
fi
echo ""
case $c in
1) enable_proxy "Display Ethernet";;
2) enable_proxy "Wi-Fi";;
3) enable_proxy "Thunderbolt Ethernet";;
4) enable_proxy "Thunderbolt Bridge";;
5) enable_proxy "Display FireWire";;
6) enable_proxy "iPhone USB";;
7) enable_proxy "iPad USB";;
8) enable_proxy "Bluetooth PAN";;
[qQ]) echo -e " Bye!"; kill -INT $$;;
[aA]ll) networksetup -listallnetworkservices;;
[Cc]hk) open https://check.torproject.org
esac
}
#-------------------------------------------------------------------------------
function fixperms() {
# type f for file --> -rw-r--r-- (0644)
# type d for directory --> drwxr-xr-x (0775)
find . -type d -exec chmod 775 {} \;
find . -type f -exec chmod 644 {} \;
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# Git
#-------------------------------------------------------------------------------
if [ -f ~/.git-completion.bash ]; then
source ~/.git-completion.bash
source ~/.git-prompt.sh
fi
[user]
name = nic-o
email = nicolas.georget@gmail.com
#-------------------------------------------------------------------------------
# History
#-------------------------------------------------------------------------------
export HISTSIZE=10000 # 500 is default, 0 will disable history
export HISTFILESIZE=1000000
export HISTTIMEFORMAT='%b %d %I:%M %p '
#export HISTCONTROL=ignoredups
#export HISTCONTROL=ignorespace
export HISTCONTROL=ignoreboth
export HISTIGNORE="history:h:pwd:exit:q:df:ls:ls -la:ll"
# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
xterm-color) color_prompt=yes;;
esac
#-------------------------------------------------------------------------------
# Customs Command Prompt
#-------------------------------------------------------------------------------
# \u Username
# \s Current Shell
# \w current working directory
# \W Basename of the current working dyrectory
# \d Date in weekday month date format ("Mon Jan 16")
# \D{format} Date in strftime format ("%Y-%m-%d")
# \A time in 24-hour HH:MM format
# \t time in 24-hour HH:MM:SS format
# \@ time in 12-hour HH:MM am/pm format
# \T time in 12-hour HH:MM:SS format
# \H Hostname
# \h hostname up to first "."
# \! history number of this command
# \$ when UID is 0 (root) a "#", otherwise a "$"
# \# command number
PS1="\[\e[\033[7m\][\t #\!/\#] \u@\H:\[\e[\033[5m\]\[\e[\033[1m\]\w \[\e[0m\] "
#
# $HOME/.screenrc
#
# ------------------------------------------------------------------------------
# SCREEN SETTINGS
# ------------------------------------------------------------------------------
#escape ^ww
startup_message off
#nethack on
#defflow on # will force screen to process ^S/^Q
#deflogin on
autodetach on
# turn visual bell on
vbell on
vbell_msg " Wuff ---- Wuff!! "
# define a bigger scrollback, default is 100 lines
defscrollback 1024
altscreen on
# ------------------------------------------------------------------------------
# SCREEN KEYBINDINGS
# ------------------------------------------------------------------------------
# KeyBindings
#bindkey -k k; detach # bind F10 to detach screen session from this terminal
#bindkey -k F1 kill # bind f11 to kill current screen window
#bindkey -k F2 quit # bind f12 to quit screen
#bindkey "^[[1;5D" prev # to move to previous window with ctrl-left
#bindkey "^[[1;5C" next # to move to next window with ctrl-right
# Remove some stupid / dangerous key bindings
#bind ^k
#bind L
#bind ^\
# Make them better
#bind \\ quit
#bind K kill
#bind I login on
#bind O login off
#bind } history
# make them safer
#bind 'K' kill
#bind 'W' windowlist
#bind 'V' split -v
# Window numbering starts at 1, not 0
bind c screen 1
# An example of a "screen scraper" which will launch urlview on the current
# screen window
#
#bind ^B eval "hardcopy_append off" "hardcopy -h $HOME/.screen-urlview" "screen urlview $HOME/.screen-urlview"
# ------------------------------------------------------------------------------
# TERMINAL SETTINGS
# ------------------------------------------------------------------------------
# The vt100 description does not mention "dl". *sigh*
termcapinfo vt100 dl=5\E[M
# turn sending of screen messages to hardstatus off
hardstatus on
# Set the hardstatus prop on gui terms to set the titlebar/icon title
termcapinfo xterm*|rxvt*|kterm*|terminator*|Eterm* hs:ts=\E]0;:fs=\007:ds=\E]0;\007
# use this for the hard status string
#change the hardstatus settings to give an window list at the bottom of the
#screen, with the time and date and with the current window highlighted
hardstatus alwayslastline
#hardstatus string '%{= kG}%-Lw%{= kW}%50> %n%f* %t%{= kG}%+Lw%< %{= kG}%-=%c:%s%{-}'
#hardstatus string '%{= mK}%-Lw%{= KW}%50>%n%f* %t%{= mK}%+Lw%< %{= kG}%-=%D %d %M %Y %c:%s%{-}'
######hardstatus string "%{bk}%?%-Lw%?%{wb}%n*%f %t%?(%u)%?%{bk}%?%+Lw%= %{mk}@ %H %{ck}%Y%{bk}-%{ck}%m%{bk}-%{ck}%d %{yk}%D %{gk}%c:%s{-}"
#hardstatus string "%{=b .r}%D %d/%m %{w}- %{r}%c%{w} || [%{g}@%H%{w}] %w %= %1` | %{b}%l%{w}"
#hardstatus string '%{= kG}[ %{G}%H %{g}][%= %{= kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{B} %d/%m %{W}%c %{g}]'
#hardstatus string '%{= dW}[ %{dg}%H %{dW}][%{dc}%= %?%-Lw%?%{dy}(%{dW}%n*%f %t%?(%u)%?%{dy})%{= dc}%?%+Lw%?%?%= %{dW}][%{dM}%l%{dW}][%{dy} %m/%d %c %{dW}]'
#hardstatus string '%{gk}[ %{G}%H %{g}][%= %{wk}%?%-Lw%?%{=b kR}(%{W}%n*%f %t%?(%u)%?%{=b kR})%{= kw}%?%+Lw%?%?%= %{g}][%{Y}%l%{g}]%{=b C}[ %m/%d %c ]%{W}'
#hardstatus string '%{= mK}%-Lw%{= KW}%50>%n%f* %t%{= mK}%+Lw%< %{= kG}%-=%D %d %M %Y %c:%s%{-}'
#hardstatus string "%{+b Rk}(%{-b g}$LOGNAME@%H%{+b R}) (%{-b g}%C %a%{+b R}) %{-b g} %n %t %h"
#hardstatus string '%{= kG}%-Lw%{= kW}%50> %n%f* %t%{= kG}%+Lw%< %{= kG}%-=%c:%s%{-}'
#hardstatus string '%{= kG}[ %{G}%H %{g}][%= %{= kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{B} %m-%d %{W}%c %{g}]'
#hardstatus string '%{= kG}%{C}Screen: %{c}%{= kG}[%= %{= kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{C} %d-%m %{W}%c %{g}]'
#hardstatus string "%{= kG}%{g}[ %{B}$LOGNAME@%H%{g} ] [%= %{= kw}%?%-Lw%?%{B}<< %n*%f%t%?(%u)%? >>%{w}%?%+Lw%?%?%= %{g}] [ %{B}%c:%s%{g} ]"
hardstatus string "%{bk}%{W}Screen: %{bk}%?%-Lw%?%{wb}%n*%f %t%?(%u)%?%{bk}%?%+Lw%= %{+u bk}$LOGNAME@%H | %{bk}%D%{bk} %{bk}%d%{bk} %{bk}%M %{bk}%Y %{bk}%c:%s"
# set these terminals up to be 'optimal' instead of vt100
termcapinfo xterm*|linux*|rxvt*|Eterm* OP
# Change the xterm initialization string from is2=\E[!p\E[?3;4l\E[4l\E>
# (This fixes the "Aborted because of window size change" konsole symptoms found
# in bug #134198)
termcapinfo xterm 'is=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;4;6l'
# To get screen to add lines to xterm's scrollback buffer, uncomment the
# following termcapinfo line which tells xterm to use the normal screen buffer
# (which has scrollback), not the alternate screen buffer.
#
#termcapinfo xterm|xterms|xs|rxvt ti@:te@
# Enable non-blocking mode to better cope with flaky ssh connections.
defnonblock 5
# ------------------------------------------------------------------------------
# STARTUP SCREENS
# ------------------------------------------------------------------------------
# screen -t 'Processing Tasks' 1 top -F -R -o cpu
# screen -t 'Server Process' 1 ssh -v -t -p 2222 adminserver@layout.sophieparis.com 'top -F -R -o cpu -n 19; bash -l'
# creen -t 'System Log' 2 sh -c 'tail -f /var/log/system.log'
#screen -t 'Images Queuing' 3 ssh -v -t -p 2222 adminserver@layout.sophieparis.com 'cd /Library/Server/Web/Data/Sites/layout/sites/default/files/images/import/; ls -aFlhGpF; bash -l'
# screen -t 'Images Logs' 4 ssh -v -t -p 2222 nico@layout.sophieparis.com 'cd /Library/Server/Web/Data/Sites/layout/sites/default/files/logs/import_images/; ls -aFlhGpF; bash -l'
# screen -t 'Transmission' 5 transmission
# screen -t 'WeeChat' 6 ssh -v -t -p 2222 nico@layout.sophieparis.com '/opt/local/bin/weechat; bash -l'
# split -h
# resize 25
# select 1
# focus down
# select 6
Host *
UseKeychain yes
AddKeysToAgent yes
Host siteground
Hostname sgp21.siteground.asia
User integ833
Port 18765
UseKeychain yes
AddKeysToAgent yes
PubKeyAuthentication yes
IdentityFile ~/.ssh/siteground-integrity
Host ebouc
Hostname 185.207.207.23
User root
Port 22
Host acti
Hostname sm1000.siteground.biz
User u85-wcqzce5q3vw8
Port 18765
UseKeychain yes
AddKeysToAgent yes
PubKeyAuthentication yes
#IdentityFile ~/.ssh/siteground
Host staging
Hostname 103.216.188.148
User marketing
Port 2123
Host CC1119.github.com
HostName github.com
UseKeychain yes
AddKeysToAgent yes
IdentityFile ~/.ssh/CC1119
# http://mutelight.org/practical-tmux
# C-b is not acceptable -- Vim uses it
set-option -g prefix C-a
bind-key C-a last-window
# Start numbering at 1
set -g base-index 1
# Allows for faster key repetition
set -s escape-time 0
# Set status bar
#set -g status-bg white
#set -g status-fg black
#set -g status-left ""
#set -g status-right "#[fg=green]#H"
# Rather than constraining window size to the maximum size of any client
# connected to the *session*, constrain window size to the maximum size of any
# client connected to *that window*. Much more reasonable.
setw -g aggressive-resize on
# Allows us to use C-a a <command> to send commands to a TMUX session inside
# another TMUX session
bind-key a send-prefix
# Activity monitoring
#setw -g monitor-activity on
#set -g visual-activity on
# Example of using a shell command in the status line
#set -g status-right "#[fg=yellow]#(uptime | cut -d ',' -f 2-)"
# Highlight active window
#set-window-option -g window-status-current-bg red
# Roots of the synchronization
#root = /var/www
#root = ssh://192.168.1.102//var/www
# Paths to synchronize
#path = current
#path = common
#path = .netscape/bookmarks.html
# Some regexps specifying names and paths to ignore
#ignore = Path stats ## ignores /var/www/stats
#ignore = Path stats/* ## ignores /var/www/stats/*
#ignore = Path */stats ## ignores /var/www/somedir/stats, but not /var/www/a/b/c/stats
#ignore = Name *stats ## ignores all files/directories that end with "stats"
#ignore = Name stats* ## ignores all files/directories that begin with "stats"
#ignore = Name *.tmp ## ignores all files with the extension .tmp
# When set to true, this flag causes the user interface to skip
# asking for confirmations on non-conflicting changes. (More
# precisely, when the user interface is done setting the
# propagation direction for one entry and is about to move to the
# next, it will skip over all non-conflicting entries and go
# directly to the next conflict.)
auto=true
# When this is set to true, the user interface will ask no
# questions at all. Non-conflicting changes will be propagated;
# conflicts will be skipped.
batch=true
# !When this is set to true, Unison will request an extra
# confirmation if it appears that the entire replica has been
# deleted, before propagating the change. If the batch flag is
# also set, synchronization will be aborted. When the path
# preference is used, the same confirmation will be requested for
# top-level paths. (At the moment, this flag only affects the
# text user interface.) See also the mountpoint preference.
confirmbigdel=true
# When this preference is set to true, Unison will use the
# modification time and length of a file as a `pseudo inode
# number' when scanning replicas for updates, instead of reading
# the full contents of every file. Under Windows, this may cause
# Unison to miss propagating an update if the modification time
# and length of the file are both unchanged by the update.
# However, Unison will never overwrite such an update with a
# change from the other replica, since it always does a safe
# check for updates just before propagating a change. Thus, it is
# reasonable to use this switch under Windows most of the time
# and occasionally run Unison once with fastcheck set to false,
# if you are worried that Unison may have overlooked an update.
# The default value of the preference is auto, which causes
# Unison to use fast checking on Unix replicas (where it is safe)
# and slow checking on Windows replicas. For backward
# compatibility, yes, no, and default can be used in place of
# true, false, and auto. See the section "Fast Checking" for more
# information.
fastcheck=true
# When this flag is set to true, the group attributes of the
# files are synchronized. Whether the group names or the group
# identifiers are synchronizeddepends on the preference numerids.
group=true
# When this flag is set to true, the owner attributes of the
# files are synchronized. Whether the owner names or the owner
# identifiers are synchronizeddepends on the preference
# extttnumerids.
owner=true
# Including the preference -prefer root causes Unison always to
# resolve conflicts in favor of root, rather than asking for
# guidance from the user. (The syntax of root is the same as for
# the root preference, plus the special values newer and older.)
# This preference is overridden by the preferpartial preference.
# This preference should be used only if you are sure you know
# what you are doing!
prefer=newer
# When this preference is set to true, the textual user interface
# will print nothing at all, except in the case of errors.
# Setting silent to true automatically sets the batch preference
# to true.
#silent=true
# When this flag is set to true, file modification times (but not
# directory modtimes) are propagated.
times=true
# LogFile path
logfile=/Users/nico/Documents/unison.log
# This viminfo file was generated by Vim 8.0.
# You may edit it if you're careful!
# Viminfo version
|1,4
# Value of 'encoding' when this file was written
*encoding=utf-8
# hlsearch on (H) or off (h):
~h
# Last Search Pattern:
~MSle0~/*
# Last Substitute Search Pattern:
~MSle0&the
# Last Substitute String:
$POPO
# Command Line History (newest to oldest):
:wq
|2,0,1570011053,,"wq"
:q!
|2,0,1567751984,,"q!"
:q
|2,0,1567665518,,"q"
:qw
|2,0,0,,"qw"
:w
|2,0,0,,"w"
:!q
|2,0,0,,"!q"
:ls
|2,0,0,,"ls"
:%s/the/POPO/g
|2,0,0,,"%s/the/POPO/g"
:qa
|2,0,0,,"qa"
:n
|2,0,0,,"n"
:new
|2,0,0,,"new"
:new ./test.txt
|2,0,0,,"new ./test.txt"
:vsplit
|2,0,0,,"vsplit "
:unhide
|2,0,0,,"unhide"
:hide
|2,0,0,,"hide"
:vsplit ./toratorapa.cron.inc
|2,0,0,,"vsplit ./toratorapa.cron.inc"
:split toratorapa.api.inc
|2,0,0,,"split toratorapa.api.inc"
:q~
|2,0,0,,"q~"
:help
|2,0,0,,"help"
:$
|2,0,0,,"$"
:87
|2,0,0,,"87"
:0
|2,0,0,,"0"
:G
|2,0,0,,"G"
:bd
|2,0,0,,"bd"
:b2
|2,0,0,,"b2"
:quitall
|2,0,0,,"quitall"
:split ~/Desktop/test1
|2,0,0,,"split ~/Desktop/test1"
:b 1
|2,0,0,,"b 1"
:split
|2,0,0,,"split"
:b1
|2,0,0,,"b1"
:e ~/Desktop/test2
|2,0,0,,"e ~/Desktop/test2"
:e ~/.bashrc
|2,0,0,,"e ~/.bashrc"
:se wm=80
|2,0,0,,"se wm=80"
:quit
|2,0,0,,"quit"
# Search String History (newest to oldest):
?/*
|2,1,0,47,"*"
? \<INTERFACE\>
|2,1,0,,"\\<INTERFACE\\>"
? \<while\>
|2,1,0,,"\\<while\\>"
? \<url\>
|2,1,0,,"\\<url\\>"
? the
|2,1,0,,"the"
?/%s/the/POPO/g
|2,1,0,47,"%s/the/POPO/g"
?/editor
|2,1,0,47,"editor"
? >
|2,1,0,,">"
?/incl
|2,1,0,47,"incl"
?/the
|2,1,0,47,"the"
?/this
|2,1,0,47,"this"
# Expression History (newest to oldest):
# Input Line History (newest to oldest):
# Debug Line History (newest to oldest):
# Registers:
"1 LINE 0
push "redirect-gateway def1"
|3,0,1,1,1,0,0,"push \"redirect-gateway def1\""
"2 LINE 0
// https://kremalicious.com/simple-tor-setup-on-mac-os-x/
|3,0,2,1,1,0,0,"// https://kremalicious.com/simple-tor-setup-on-mac-os-x/"
"3 LINE 0
dsdsds
|3,0,3,1,1,0,0,"dsdsds"
"4 LINE 0
> Any other information you want to share that is relevant to the issue being
|3,0,4,1,1,0,0,"> Any other information you want to share that is relevant to the issue being"
"5 LINE 0
// exiting with the correct exit code.
|3,0,5,1,1,0,0," // exiting with the correct exit code."
"6 CHAR 0
<
|3,0,6,0,1,0,0,"<"
"7 LINE 0
"------------------------------------------------------------------------------
|3,0,7,1,1,0,0,"\"------------------------------------------------------------------------------"
"8 LINE 0
I dont nown dsakdskamdklasdlkajs dskldjsakljdlkjkl jdkslajdklsajlk djksajdsklajdkl dskajdklsndsa dmsakmdaksl
|3,0,8,1,1,0,0,"I dont nown dsakdskamdklasdlkajs dskldjsakljdlkjkl jdkslajdklsajlk djksajdsklajdkl dskajdklsndsa dmsakmdaksl"
"9 LINE 0
syntax on
|3,0,9,1,1,0,0," syntax on"
"l CHAR 0
<
|3,0,21,0,1,0,0,"<"
""- CHAR 0
s
|3,1,36,0,1,0,1567751974,"s"
# File marks:
'0 1 0 ~/Desktop/SymlinkDesktop
|4,48,1,0,1570011053,"~/Desktop/SymlinkDesktop"
'1 75 0 ~/.bashrc
|4,49,75,0,1568177582,"~/.bashrc"
'2 59 0 ~/.bashrc
|4,50,59,0,1567751984,"~/.bashrc"
'3 59 0 ~/.bashrc
|4,51,59,0,1567751984,"~/.bashrc"
'4 1 0 ~/.ssh/config
|4,52,1,0,1567665518,"~/.ssh/config"
'5 64 0 ~/.bashrc
|4,53,64,0,1567665490,"~/.bashrc"
'6 64 0 ~/.bashrc
|4,54,64,0,1567665490,"~/.bashrc"
'7 64 0 ~/.bashrc
|4,55,64,0,1567665490,"~/.bashrc"
'8 64 0 ~/.bashrc
|4,56,64,0,1567665490,"~/.bashrc"
'9 32 5 ~/.ssh/config
|4,57,32,5,1567665267,"~/.ssh/config"
# Jumplist (newest first):
-' 1 0 ~/Desktop/SymlinkDesktop
|4,39,1,0,1570011053,"~/Desktop/SymlinkDesktop"
-' 75 0 ~/.bashrc
|4,39,75,0,1568177582,"~/.bashrc"
-' 75 0 ~/.bashrc
|4,39,75,0,1568177582,"~/.bashrc"
-' 1 0 ~/.bashrc
|4,39,1,0,1568171249,"~/.bashrc"
-' 1 0 ~/.bashrc
|4,39,1,0,1568171249,"~/.bashrc"
-' 59 0 ~/.bashrc
|4,39,59,0,1567751984,"~/.bashrc"
-' 59 0 ~/.bashrc
|4,39,59,0,1567751984,"~/.bashrc"
-' 59 0 ~/.bashrc
|4,39,59,0,1567751984,"~/.bashrc"
-' 59 0 ~/.bashrc
|4,39,59,0,1567751984,"~/.bashrc"
-' 1 0 ~/.bashrc
|4,39,1,0,1567751756,"~/.bashrc"
-' 1 0 ~/.bashrc
|4,39,1,0,1567751756,"~/.bashrc"
-' 1 0 ~/.ssh/config
|4,39,1,0,1567665518,"~/.ssh/config"
-' 1 0 ~/.ssh/config
|4,39,1,0,1567665518,"~/.ssh/config"
-' 1 0 ~/.ssh/config
|4,39,1,0,1567665518,"~/.ssh/config"
-' 1 0 ~/.ssh/config
|4,39,1,0,1567665518,"~/.ssh/config"
-' 1 0 ~/.ssh/config
|4,39,1,0,1567665518,"~/.ssh/config"
-' 1 0 ~/.ssh/config
|4,39,1,0,1567665518,"~/.ssh/config"
-' 1 0 ~/.ssh/config
|4,39,1,0,1567665518,"~/.ssh/config"
-' 1 0 ~/.ssh/config
|4,39,1,0,1567665518,"~/.ssh/config"
-' 64 0 ~/.bashrc
|4,39,64,0,1567665490,"~/.bashrc"
-' 64 0 ~/.bashrc
|4,39,64,0,1567665490,"~/.bashrc"
-' 64 0 ~/.bashrc
|4,39,64,0,1567665490,"~/.bashrc"
-' 64 0 ~/.bashrc
|4,39,64,0,1567665490,"~/.bashrc"
-' 64 0 ~/.bashrc
|4,39,64,0,1567665490,"~/.bashrc"
-' 64 0 ~/.bashrc
|4,39,64,0,1567665490,"~/.bashrc"
-' 64 0 ~/.bashrc
|4,39,64,0,1567665490,"~/.bashrc"
-' 64 0 ~/.bashrc
|4,39,64,0,1567665490,"~/.bashrc"
-' 1 0 ~/.bashrc
|4,39,1,0,1567665470,"~/.bashrc"
-' 1 0 ~/.bashrc
|4,39,1,0,1567665470,"~/.bashrc"
-' 1 0 ~/.bashrc
|4,39,1,0,1567665470,"~/.bashrc"
-' 1 0 ~/.bashrc
|4,39,1,0,1567665470,"~/.bashrc"
-' 32 5 ~/.ssh/config
|4,39,32,5,1567665267,"~/.ssh/config"
-' 32 5 ~/.ssh/config
|4,39,32,5,1567665267,"~/.ssh/config"
-' 32 5 ~/.ssh/config
|4,39,32,5,1567665267,"~/.ssh/config"
-' 32 5 ~/.ssh/config
|4,39,32,5,1567665267,"~/.ssh/config"
-' 32 5 ~/.ssh/config
|4,39,32,5,1567665267,"~/.ssh/config"
-' 32 5 ~/.ssh/config
|4,39,32,5,1567665267,"~/.ssh/config"
-' 32 5 ~/.ssh/config
|4,39,32,5,1567665267,"~/.ssh/config"
-' 32 5 ~/.ssh/config
|4,39,32,5,1567665267,"~/.ssh/config"
-' 32 5 ~/.ssh/config
|4,39,32,5,1567665267,"~/.ssh/config"
-' 32 5 ~/.ssh/config
|4,39,32,5,1567665267,"~/.ssh/config"
-' 32 5 ~/.ssh/config
|4,39,32,5,1567665267,"~/.ssh/config"
-' 32 5 ~/.ssh/config
|4,39,32,5,1567665267,"~/.ssh/config"
-' 32 5 ~/.ssh/config
|4,39,32,5,1567665267,"~/.ssh/config"
-' 32 5 ~/.ssh/config
|4,39,32,5,1567665267,"~/.ssh/config"
-' 32 5 ~/.ssh/config
|4,39,32,5,1567665267,"~/.ssh/config"
-' 32 5 ~/.ssh/config
|4,39,32,5,1567665267,"~/.ssh/config"
-' 32 5 ~/.ssh/config
|4,39,32,5,1567665267,"~/.ssh/config"
-' 32 5 ~/.ssh/config
|4,39,32,5,1567665267,"~/.ssh/config"
-' 32 5 ~/.ssh/config
|4,39,32,5,1567665267,"~/.ssh/config"
-' 32 5 ~/.ssh/config
|4,39,32,5,1567665267,"~/.ssh/config"
-' 32 5 ~/.ssh/config
|4,39,32,5,1567665267,"~/.ssh/config"
-' 32 5 ~/.ssh/config
|4,39,32,5,1567665267,"~/.ssh/config"
-' 32 5 ~/.ssh/config
|4,39,32,5,1567665267,"~/.ssh/config"
-' 32 5 ~/.ssh/config
|4,39,32,5,1567665267,"~/.ssh/config"
-' 1 0 ~/.ssh/config
|4,39,1,0,1567665227,"~/.ssh/config"
-' 1 0 ~/.ssh/config
|4,39,1,0,1567665227,"~/.ssh/config"
-' 1 0 ~/.ssh/config
|4,39,1,0,1567665227,"~/.ssh/config"
-' 1 0 ~/.ssh/config
|4,39,1,0,1567665227,"~/.ssh/config"
-' 1 0 ~/.ssh/config
|4,39,1,0,1567665227,"~/.ssh/config"
-' 1 0 ~/.ssh/config
|4,39,1,0,1567665227,"~/.ssh/config"
-' 1 0 ~/.ssh/config
|4,39,1,0,1567665227,"~/.ssh/config"
-' 1 0 ~/.ssh/config
|4,39,1,0,1567665227,"~/.ssh/config"
-' 1 0 ~/.ssh/config
|4,39,1,0,1567665227,"~/.ssh/config"
-' 1 0 ~/.ssh/config
|4,39,1,0,1567665227,"~/.ssh/config"
-' 1 0 ~/.ssh/config
|4,39,1,0,1567665227,"~/.ssh/config"
-' 1 0 ~/.ssh/config
|4,39,1,0,1567665227,"~/.ssh/config"
-' 1 0 ~/.ssh/config
|4,39,1,0,1567665227,"~/.ssh/config"
-' 1 0 ~/.ssh/config
|4,39,1,0,1567665227,"~/.ssh/config"
-' 1 0 ~/.ssh/config
|4,39,1,0,1567665227,"~/.ssh/config"
-' 1 0 ~/.ssh/config
|4,39,1,0,1567665227,"~/.ssh/config"
-' 31 12 ~/.ssh/config
|4,39,31,12,1567665012,"~/.ssh/config"
-' 31 12 ~/.ssh/config
|4,39,31,12,1567665012,"~/.ssh/config"
-' 31 12 ~/.ssh/config
|4,39,31,12,1567665012,"~/.ssh/config"
-' 31 12 ~/.ssh/config
|4,39,31,12,1567665012,"~/.ssh/config"
-' 31 12 ~/.ssh/config
|4,39,31,12,1567665012,"~/.ssh/config"
-' 31 12 ~/.ssh/config
|4,39,31,12,1567665012,"~/.ssh/config"
-' 31 12 ~/.ssh/config
|4,39,31,12,1567665012,"~/.ssh/config"
-' 31 12 ~/.ssh/config
|4,39,31,12,1567665012,"~/.ssh/config"
-' 31 12 ~/.ssh/config
|4,39,31,12,1567665012,"~/.ssh/config"
-' 31 12 ~/.ssh/config
|4,39,31,12,1567665012,"~/.ssh/config"
-' 31 12 ~/.ssh/config
|4,39,31,12,1567665012,"~/.ssh/config"
-' 31 12 ~/.ssh/config
|4,39,31,12,1567665012,"~/.ssh/config"
-' 31 12 ~/.ssh/config
|4,39,31,12,1567665012,"~/.ssh/config"
-' 31 12 ~/.ssh/config
|4,39,31,12,1567665012,"~/.ssh/config"
-' 31 12 ~/.ssh/config
|4,39,31,12,1567665012,"~/.ssh/config"
-' 31 12 ~/.ssh/config
|4,39,31,12,1567665012,"~/.ssh/config"
-' 31 12 ~/.ssh/config
|4,39,31,12,1567665012,"~/.ssh/config"
-' 31 12 ~/.ssh/config
|4,39,31,12,1567665012,"~/.ssh/config"
-' 31 12 ~/.ssh/config
|4,39,31,12,1567665012,"~/.ssh/config"
-' 31 12 ~/.ssh/config
|4,39,31,12,1567665012,"~/.ssh/config"
-' 31 12 ~/.ssh/config
|4,39,31,12,1567665012,"~/.ssh/config"
-' 31 12 ~/.ssh/config
|4,39,31,12,1567665012,"~/.ssh/config"
-' 31 12 ~/.ssh/config
|4,39,31,12,1567665012,"~/.ssh/config"
-' 31 12 ~/.ssh/config
|4,39,31,12,1567665012,"~/.ssh/config"
-' 1 0 ~/.ssh/config
|4,39,1,0,1567664939,"~/.ssh/config"
-' 1 0 ~/.ssh/config
|4,39,1,0,1567664939,"~/.ssh/config"
-' 1 0 ~/.ssh/config
|4,39,1,0,1567664939,"~/.ssh/config"
-' 1 0 ~/.ssh/config
|4,39,1,0,1567664939,"~/.ssh/config"
-' 1 0 ~/.ssh/config
|4,39,1,0,1567664939,"~/.ssh/config"
# History of marks within files (newest to oldest):
> ~/Desktop/SymlinkDesktop
* 1570011052 0
" 1 0
^ 1 1
. 1 0
+ 1 0
> ~/.bashrc
* 1568171264 0
" 75 0
^ 59 4
. 59 3
+ 88 19
+ 68 46
+ 59 3
> ~/.ssh/config
* 1567665517 0
" 1 0
^ 32 6
. 32 5
+ 39 11
+ 14 0
+ 5 0
+ 4 4
+ 18 12
+ 6 14
+ 13 35
+ 10 7
+ 13 17
+ 10 21
+ 11 23
+ 20 9
+ 30 26
+ 32 12
+ 31 17
+ 32 5
> /private/etc/hosts
* 1514368046 0
" 13 26
^ 13 27
. 13 26
+ 13 0
+ 10 43
+ 13 0
+ 12 26
+ 10 0
+ 11 0
+ 12 0
+ 10 0
+ 11 0
+ 12 46
+ 13 12
+ 13 26
> /usr/local/etc/openvpn/server.conf
" 193 0
^ 193 0
. 193 0
+ 192 0
+ 195 0
+ 192 40
+ 201 0
+ 202 0
+ 141 0
+ 192 42
+ 193 0
> ~/.bmonrc
" 9 6
^ 9 9
. 9 7
+ 9 7
> ~/.tmux.conf
" 1 36
^ 1 37
. 1 2
+ 1 24
+ 35 0
+ 1 2
> /usr/local/bin/tor.sh
" 48 1
^ 48 2
. 49 0
+ 68 73
+ 69 0
+ 70 0
+ 71 0
+ 72 0
+ 73 0
+ 74 0
+ 76 0
+ 57 0
+ 62 0
+ 63 0
+ 64 0
+ 70 0
+ 71 0
+ 72 0
+ 73 0
+ 74 0
+ 71 0
+ 70 0
+ 72 0
+ 73 0
+ 74 0
+ 64 0
+ 63 0
+ 62 0
+ 61 2
+ 68 12
+ 69 0
+ 61 2
+ 68 12
+ 69 0
+ 68 8
+ 61 2
+ 69 0
+ 70 0
+ 61 59
+ 69 52
+ 70 47
+ 7 0
+ 77 4
+ 78 22
+ 8 39
+ 8 86
+ 8 128
+ 8 118
+ 8 154
+ 8 36
+ 8 86
+ 8 84
+ 11 0
+ 10 58
+ 11 0
+ 10 42
+ 11 15
+ 11 15
+ 11 35
+ 11 0
+ 22 0
+ 11 0
+ 12 0
+ 19 57
+ 21 0
+ 10 27
+ 19 15
+ 22 55
+ 32 0
+ 25 45
+ 31 9
+ 20 20
+ 33 44
+ 43 3
+ 34 33
+ 36 14
+ 34 34
+ 36 24
+ 37 15
+ 25 51
+ 25 0
+ 33 8
+ 19 15
+ 33 45
+ 38 14
+ 53 0
+ 54 0
+ 55 0
+ 51 1
+ 52 0
+ 42 31
+ 70 17
+ 36 0
+ 42 32
+ 46 30
+ 43 0
+ 35 16
+ 46 24
+ 48 0
+ 70 0
+ 50 0
+ 48 2
+ 49 0
> /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/elinks.rb
" 5 1
^ 5 2
. 5 2
+ 4 3
+ 5 2
> ~/.ssh/known_hosts
" 1 0
> ~/Downloads/bootstrap-3.3.7/CONTRIBUTING.md
" 265 0
^ 100 0
. 5 0
+ 100 7
+ 100 5
+ 102 70
+ 102 70
+ 102 0
+ 100 0
+ 5 0
> ~/Downloads/src/Symfony/Installer/SelfUpdateCommand.php
* 1482940374 0
" 1 0
> ~/Desktop/untitled folder/toratorapa.admin.inc
" 1 0
> ~/Desktop/untitled folder/toratorapa.api.inc
" 1 0
> ~/.netrc
" 5 1
^ 5 2
. 7 1
+ 1 19
+ 1 19
+ 1 19
+ 1 18
+ 3 11
+ 1 18
+ 1 17
+ 9 0
+ 7 4
+ 5 13
+ 7 4
+ 8 0
+ 5 9
+ 6 0
+ 7 0
+ 8 0
+ 5 9
+ 6 1
+ 7 1
a 1 0
> ~/Desktop/untitled folder/toratorapa.cron.inc
" 16 1
> ~/Desktop/untitled folder/test.txt
" 4920 3340
^ 4920 3340
. 4920 3339
+ 4990 0
+ 4920 3339
> ~/Desktop/untitled folder/toratorapa.refresh.inc
" 1 0
> ~/Development/drush/drush.php
" 46 0
^ 68 60
. 89 20
+ 68 60
+ 90 0
+ 89 20
> /usr/share/vim/vim74/doc/help.txt
" 131 0
> ~/Desktop/update-phototheque.php
" 206 80
> ~/Development/Drupal/sophieparis/phototheque/includes/phototheque.admin.inc
" 1 0
^ 1 1
. 1 1
+ 1 0
+ 1 1
> ~/Development/Drupal/sophieparis/phototheque/includes/phototheque.cron.inc
" 1 0
> ~/Desktop/test2
" 2 0
^ 2 4
. 2 0
+ 2 0
> ~/Desktop/test1
" 1 5
^ 1 6
. 1 5
+ 1 5
> ~/Downloads/Torrents/test1
" 1 0
^ 1 10
. 1 9
+ 1 9
> ~/Downloads/Torrents/test2
" 1 0
> /private/var/folders/qx/dystqv3d4lg7zb5bgft_hkrm0000gp/T/bash-fc-7074831272
" 1 0
> ~/.vimrc
" 61 79
^ 61 58
. 61 78
+ 4 18
+ 6 4
+ 62 124
+ 62 79
+ 62 0
+ 61 78
+ 61 78
+ 61 78
> ~/Desktop/Up and Running with vi.m3u
" 55 81
^ 55 82
. 56 0
+ 56 0
+ 56 0
> ~/Desktop/test.c
" 5 1
^ 5 2
. 5 2
+ 4 30
+ 1 22
+ 5 6
+ 5 5
+ 8 0
+ 6 11
+ 1 17
+ 5 5
+ 4 33
+ 5 4
+ 5 2
> ~/vimrc
" 18 0
^ 18 0
. 18 0
+ 1 0
+ 1 0
+ 1 8
+ 1 0
+ 1 10
+ 1 3
+ 1 74
+ 14 0
+ 13 0
+ 4 0
+ 9 0
+ 18 0
> /private/var/folders/qx/dystqv3d4lg7zb5bgft_hkrm0000gp/T/tutorAoR40E
" 131 0
> ~/Desktop/test.txt
" 2 0
^ 2 1
. 2 0
+ 1 7
+ 4 0
+ 1 15
+ 2 0
> /usr/share/vim/vim73/doc/help.txt
" 34 22
> /usr/share/vim/vim73/doc/quickref.txt
" 16 41
"-------------------------------------------------------------------------------
" Features
" use Vim mode instead of pure Vi, it must be the first instruction
set nocompatible
set mouse=a " Enable use of the mouse for all modes
"-------------------------------------------------------------------------------
" display settings
set encoding=utf-8 " encoding used for displaying file
set ruler " show the cursor position all the time
set showmatch " highlight matching braces
set showmode " show insert/replace/visual mode
set wildmenu " Better command-line completion
set showcmd " Show partial commands in the last line of the screen
set laststatus=2 " Always display the status line
set visualbell " Use visual bell instead of beeping when something wrong
set cmdheight=2 " Set the command window height to 2 lines
set number " Display line numbers on the left
"-------------------------------------------------------------------------------
" write settings
set confirm " confirm :q in case of unsaved changes
set fileencoding=utf-8 " encoding used when saving file
set nobackup " do not keep the backup~ file
"-------------------------------------------------------------------------------
" edit settings
set backspace=indent,eol,start " backspacing over everything in insert mode
set expandtab " fill tabs with spaces
set nojoinspaces " no extra space after '.' when joining lines
set shiftwidth=2 " set indentation depth to 2 columns
set softtabstop=2 " backspacing over 2 spaces like over tabs
set tabstop=2 " set tabulator length to 2 columns
set textwidth=80 " wrap lines automatically at 80th column
set autoindent " When opening a new line and no filetype
" -specific indenting is enabled, keep the
" same indent as the line you're currently on.
set nostartofline " Prevent the cursor from changing the current
" column when jumping to other lines within the
" window.
"-------------------------------------------------------------------------------
" search settings
set hlsearch " highlight search results
set ignorecase " do case insensitive search...
set incsearch " do incremental search
set smartcase " ...unless capital letters are used
"-------------------------------------------------------------------------------
" file type specific settings
filetype on " enable file type detection
filetype plugin on " load the plugins for specific file types
filetype indent on " automatically indent code
"-------------------------------------------------------------------------------
" syntax highlighting
" colorscheme solarized " set color scheme, must be installed first
" set background=dark " dark background for console
syntax enable " enable syntax highlighting
"-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# Customs Command Prompt
#-------------------------------------------------------------------------------
# setopt APPEND_HISTORY # Get history
# PROMPT="[%* $APPEND_HISTORY/#%h] %n@%M:%d "
# autoload -U colors && colors
autoload -U colors && colors
export PS1="%F{000}%K{255}[%* $APPEND_HISTORY/#%h] %n@%M:%d %{$reset_color%}% "
#-------------------------------------------------------------------------------
## Alias
#-------------------------------------------------------------------------------
alias mv='mv -v' # Move w/ verbose mode
alias cp='cp -v' # Copy w/ verbose mode
alias rm='rm -Rfv' # Remove Directory w/ recusrive, force and
# verbose mode
alias df='df -kTh' # Display Free Disk space
alias du='du -sh' # Disk Usage w/ option 'Human Readable' and
# display for folder too
alias pdw='pwd' # Print Working Directory misspelled
alias mkdir='mkdir -vp' # Make Directory with option 'Create
# intermediate directories' & verbose mode
alias top='top -F -R -o cpu' # top
alias nettop='nettop -m route' # nettop
alias ping='ping -c 5' # Ping 5 times
#alias mate='mate -wl1' # Binary Mate
alias screen='screen -Rd' # Screen w/ resume the first detached screen
# session and Reattach a session
alias nano='nano -c' # Nano w/ number lines
alias ssh='ssh -v' # SSH mode verbose
alias curl='curl -vOL' # curl with mode verbose (-v), file downloaded
# with its remote name (-O), and follow the
# redirection (-L)
alias brew='brew -v' # verbose mode
alias vpngate='sudo vpn-gate' # npm VPN Gate (https://www.npmjs.com/package/vpn-gate)
# Private Alias
alias ll='ls -aFlhGpF'
alias lf='ls -CF'
alias home='cd ~'
alias up='cd ..'
alias ..='cd ..'
alias h='history 0'
alias q='exit'
# alias speedtest='speedtest --server 3681'
alias sha1='openssl sha1' # Generate sha1 digest
alias lynx='lynx -accept_all_cookies'
alias bandwidth='wget http://cachefly.cachefly.net/100mb.test -O /dev/null'
#-------------------------------------------------------------------------------
# Connect to TOR network functions
# https://kremalicious.com/simple-tor-setup-on-mac-os-x/
function thor() {
function enable_proxy() {
INTERFACE=$1
# trap ctrl-c and call disable_proxy()
function disable_proxy() {
sudo networksetup -setsocksfirewallproxystate "$INTERFACE" off
echo "$(tput setaf 64)" #green
echo "SOCKS proxy disabled for interface $INTERFACE"
echo "$(tput sgr0)" # color reset
sudo killall tor
}
# # Ask for the administrator password upfront
sudo -v
# Keep-alive: update existing `sudo` time stamp until finished
# while true
# do
# sudo -n true
# sleep 60
# kill -0 "$$" || exit;
# done 2>/dev/null &
# trap ctrl-c and call disable_proxy()
trap disable_proxy INT
# Let's roll
sudo networksetup -setsocksfirewallproxy "$INTERFACE" 127.0.0.1 9050 off
sudo networksetup -setsocksfirewallproxystate "$INTERFACE" on
echo "$(tput setaf 64)" # green
echo "SOCKS proxy 127.0.0.1:9050 enabled for interface $INTERFACE"
echo "$(tput setaf 136)" # orange
echo "Starting Tor..."
echo "$(tput sgr0)" # color reset
tor & wait
}
# Main
# Check if there's any arguments pased: tor.sh <option>
if [ -z $1 ]
then
echo -e ""
echo -e "Network Interfaces available:"
echo -e " 1. Dock Ecuso"
echo -e " 2. Adapter USB-C"
echo -e " 3. Wi-Fi"
echo -e " 4. Bluetooth PAN"
echo -e " 5. Thunderbolt Bridge"
echo -e ""
echo -e "Other Options:"
echo -e " All. List current network interface"
echo -e " Chk. Check if you are using Tor"
echo -e " Q. Exit"
echo -e ""
local c
vared -p "Enter your choice [ 1 - 5 ] or options ?" c
else
c=$1
fi
echo ""
case $c in
1) enable_proxy "Dock Ecuso";;
2) enable_proxy "Adapter USB-C";;
3) enable_proxy "Wi-Fi";;
4) enable_proxy "Bluetooth PAN";;
5) enable_proxy "Thunderbolt Bridge";;
[qQ]) echo -e " Bye!"; kill -INT $$;;
[aA]ll) networksetup -listallnetworkservices;;
[Cc]hk) open https://check.torproject.org
esac
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment