Shermans's Notes
Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Back to homepage

Shell Tools

    Yeet - Quick commit and push to quit

    • This is built on fzf to fuzzy find and select files to stage and add to git
     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    
    alias yeet='yeeet() {
        selected_files=($(git status -s | fzf --multi --ansi | awk "{print $2}" | tr "\n" "\0" | xargs -0))
    
        if [ -z "$selected_files" ]; then
            echo "No files selected."
        else
            echo -n "Enter commit message: "
            read commit_message
            if [ -z "$commit_message" ]; then
                echo "Commit message cannot be empty."
            else
                for file in $selected_files; do
                    git add "$file"
                done
                git commit -m "$commit_message" && \
                git push -u origin HEAD
            fi
        fi
    }; yeeet'
    

    Netstat like output

    1
    2
    3
    4
    
     macnst (){
    	 netstat -Watnlv | grep LISTEN | awk '{"ps -o comm= -p " $9 | getline procname;colred="\033[01;31m";colclr="\033[0m"; print colred "proto: " colclr $1 colred " | addr.port: " colclr $4 colred " | pid: " colclr $9 colred " | name: " colclr procname     ;  }' | column -t -s "|";
     141 
     }