Skip to content

Instantly share code, notes, and snippets.

@hightemp
Last active October 22, 2023 12:10
Show Gist options
  • Save hightemp/b5590da5c1fc3bb7cba28ca5659cd009 to your computer and use it in GitHub Desktop.
Save hightemp/b5590da5c1fc3bb7cba28ca5659cd009 to your computer and use it in GitHub Desktop.

Revisions

  1. hightemp revised this gist Oct 13, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion snippets.md
    Original file line number Diff line number Diff line change
    @@ -7,7 +7,7 @@ du -c `find . -maxdepth 1 -name '*.php'` | tail -1

    ## Count lines in files with mask
    ```bash
    find . -maxdepth 1 -name '*.php' | xargs echo | xargs wc -l
    find . -maxdepth 1 -name '*.php' -print | xargs wc -l
    ```

    ## Exclude path from search by `find`
  2. hightemp revised this gist Oct 13, 2018. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions snippets.md
    Original file line number Diff line number Diff line change
    @@ -5,9 +5,9 @@
    du -c `find . -maxdepth 1 -name '*.php'` | tail -1
    ```

    ## Count all lines in files
    ## Count lines in files with mask
    ```bash
    (find ./ -name '*.*' -print0 | xargs -0 cat ) | wc -l
    find . -maxdepth 1 -name '*.php' | xargs echo | xargs wc -l
    ```

    ## Exclude path from search by `find`
  3. hightemp revised this gist Oct 13, 2018. 1 changed file with 5 additions and 0 deletions.
    5 changes: 5 additions & 0 deletions snippets.md
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,10 @@
    # Bash snippets

    ## Get size of files of current directory with mask
    ```php
    du -c `find . -maxdepth 1 -name '*.php'` | tail -1
    ```

    ## Count all lines in files
    ```bash
    (find ./ -name '*.*' -print0 | xargs -0 cat ) | wc -l
  4. hightemp revised this gist Sep 14, 2018. 1 changed file with 6 additions and 0 deletions.
    6 changes: 6 additions & 0 deletions snippets.md
    Original file line number Diff line number Diff line change
    @@ -28,4 +28,10 @@ find . -type f \( -name "*.shtml" -or -name "*.css" \)
    ### Method 2
    ```bash
    find -type f -regex ".*/.*\.\(shtml\|css\)"
    ```

    ## C++ calls graph
    ```bash
    clang++ -S -emit-llvm main.cpp -o - | opt -analyze -dot-callgraph
    dot -Tpng -ocallgraph.png callgraph.dot
    ```
  5. hightemp revised this gist Sep 14, 2018. 1 changed file with 5 additions and 0 deletions.
    5 changes: 5 additions & 0 deletions snippets.md
    Original file line number Diff line number Diff line change
    @@ -21,6 +21,11 @@ ls -1 -- **/+(*.jpg|*.gif|*.png)
    ```

    ## Use `find` with multiple extensions
    ### Method 1
    ```bash
    find . -type f \( -name "*.shtml" -or -name "*.css" \)
    ```
    ### Method 2
    ```bash
    find -type f -regex ".*/.*\.\(shtml\|css\)"
    ```
  6. hightemp revised this gist Sep 14, 2018. 1 changed file with 5 additions and 0 deletions.
    5 changes: 5 additions & 0 deletions snippets.md
    Original file line number Diff line number Diff line change
    @@ -18,4 +18,9 @@ rename 's/(.*)/$1.jpg/' *
    ## Recursively output list of files with extensions
    ```bash
    ls -1 -- **/+(*.jpg|*.gif|*.png)
    ```

    ## Use `find` with multiple extensions
    ```bash
    find . -type f \( -name "*.shtml" -or -name "*.css" \)
    ```
  7. hightemp revised this gist Sep 14, 2018. 1 changed file with 5 additions and 0 deletions.
    5 changes: 5 additions & 0 deletions snippets.md
    Original file line number Diff line number Diff line change
    @@ -13,4 +13,9 @@ find ./ -name '*.*' -not -path "./pathname/*"
    ## Rename files by mask, add extension to files
    ```bash
    rename 's/(.*)/$1.jpg/' *
    ```

    ## Recursively output list of files with extensions
    ```bash
    ls -1 -- **/+(*.jpg|*.gif|*.png)
    ```
  8. hightemp revised this gist Sep 14, 2018. 1 changed file with 5 additions and 0 deletions.
    5 changes: 5 additions & 0 deletions snippets.md
    Original file line number Diff line number Diff line change
    @@ -8,4 +8,9 @@
    ## Exclude path from search by `find`
    ```bash
    find ./ -name '*.*' -not -path "./pathname/*"
    ```

    ## Rename files by mask, add extension to files
    ```bash
    rename 's/(.*)/$1.jpg/' *
    ```
  9. hightemp created this gist Sep 14, 2018.
    11 changes: 11 additions & 0 deletions snippets.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,11 @@
    # Bash snippets

    ## Count all lines in files
    ```bash
    (find ./ -name '*.*' -print0 | xargs -0 cat ) | wc -l
    ```

    ## Exclude path from search by `find`
    ```bash
    find ./ -name '*.*' -not -path "./pathname/*"
    ```