notes

Trips and tics

Usefull commands

  1. Get the lines number of a directory

     find . -name "*.js" -type f -exec cat {} \; | wc -l
    
  2. Get the size number of a directory

     find . -name "*.js" -type f -exec cat {} \; | wc -c
    
  3. Get current connections info

     ss --options --extended --memory --processes --info
    
  4. Show TLS Certificate info

     openssl s_client -state -connect google.com:443
    
  5. Connect via HTTPS:

     openssl s_client -state -CAfile startssl.ca.crt -connect igvita.com:443
    

Compiled programs

  1. Show binary dependencies
     ldd binary-path
    

Usefull installations

  1. Install docker
     sudo curl -sSL https://get.docker.com/ | sh && sudo gpasswd -a ${USER} docker
    

Usefull scripts

  1. To change terminal title add the following function to .bashrc:

     st(){
         echo -en "\033]0;$1\a"
     }
    
  2. To set the colored promt with current branch name add the following to .bashrc:

     parse_git_branch() {
         local branch=$(git branch 2> /dev/null | \
             sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/')
    
    
         if [[ $branch ]]; then
             local -i MAX_LENGTH=30
             local -i branch_characters=${#branch}
    
             if ((branch_characters > MAX_LENGTH)) ; then
                 branch="${branch::30}...)"
             fi
    
             echo "$branch"
         fi
     }
     GREEN="\[\033[0;32m\]"
     NO_COLOR="\[\033[0m\]"
     PS1="$GREEN\$(parse_git_branch)$NO_COLOR${debian_chroot:+($debian_chroot)}\w$ "