Skip to content

Instantly share code, notes, and snippets.

@MrChrisWeinert
Last active May 6, 2025 15:47
Show Gist options
  • Save MrChrisWeinert/ba55c3b9fe845ea30c164e11479f746f to your computer and use it in GitHub Desktop.
Save MrChrisWeinert/ba55c3b9fe845ea30c164e11479f746f to your computer and use it in GitHub Desktop.

Revisions

  1. MrChrisWeinert renamed this gist May 6, 2025. 1 changed file with 3 additions and 2 deletions.
    5 changes: 3 additions & 2 deletions gistfile1.txt → RandomBashBits.txt
    Original file line number Diff line number Diff line change
    @@ -5,10 +5,11 @@ for filename in `find ./ | grep 'md$'`; do grep -L tags $filename; done
    #WITH tags
    for filename in `find ./ | grep 'md$'`; do grep -l tags $filename; done

    Find in all files:
    #Find in all files:
    find ./ -exec grep 'Critical' /dev/null {} \; | tee ~/grepResults.txt


    #Update hostname
    hostnamectl set-hostname new-hostname



  2. MrChrisWeinert revised this gist Nov 5, 2024. 1 changed file with 60 additions and 1 deletion.
    61 changes: 60 additions & 1 deletion gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -3,4 +3,63 @@
    for filename in `find ./ | grep 'md$'`; do grep -L tags $filename; done

    #WITH tags
    for filename in `find ./ | grep 'md$'`; do grep -l tags $filename; done
    for filename in `find ./ | grep 'md$'`; do grep -l tags $filename; done

    Find in all files:
    find ./ -exec grep 'Critical' /dev/null {} \; | tee ~/grepResults.txt





    #Progress Bar (untested)
    #!/bin/bash

    ### Reports
    file1="example.csv"


    ####################
    ### Progress Bar ###
    ####################

    progress_bar_setup() {
    total_lines=$(wc -l < "$1")
    progress=0
    echo -n "[--------------------] 0% "
    }

    progress_bar() {
    let progress++
    let filled_slots=progress*20/total_lines
    bar=""
    for ((i=0; i<$filled_slots; i++)); do
    bar="${bar}#"
    done
    for ((i=filled_slots; i<20; i++)); do
    bar="${bar}-"
    done
    let percentage=progress*100/total_lines
    echo -ne "\r[${bar}] ${percentage}% "
    }

    progress_bar_complete() {
    bar="####################"
    echo -ne "\r[${bar}] 100% "
    echo;echo
    }


    ##################
    ### While Loop ###
    ##################

    echo "Progress Bar Title::"
    progress_bar_setup $file1

    cat $file1 | while read line; do
    # Task
    progress_bar
    done

    progress_bar_complete
  3. MrChrisWeinert created this gist Nov 5, 2024.
    6 changes: 6 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,6 @@
    #bin/bash
    #This will list out all the .md files that DON'T contain 'tags'
    for filename in `find ./ | grep 'md$'`; do grep -L tags $filename; done

    #WITH tags
    for filename in `find ./ | grep 'md$'`; do grep -l tags $filename; done