Last active
August 7, 2024 15:00
-
-
Save lopes/d7b0eada6582b730abf1006b940cbff9 to your computer and use it in GitHub Desktop.
Shell snippets using common Unix tools. #shell #shellscript #unix #linux #bsd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Lists all files staged in a commit. Useful to investigate changes between versions | |
git diff-tree --no-commit-id -r --name-only 65f4a74f72c816db89fc5bd8d71bbdfbe526e2f7 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Counts the number of items inside the array alerts within reply. | |
jq '.reply.alerts | length' cortex-alerts.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Gets Tesouro Direto bonds and filters out only IPCA+ 2025 from them. | |
curl -s <https://www.tesourodireto.com.br/json/br/com/b3/tesourodireto/service/api/treasurybondsinfo.json> | jq '.response.TrsrBdTradgList[] | select(.TrsrBd.nm | test("IPCA+.*2035"; "i"))' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Filters only the Technique and Tactic from MITRE ATT&CK's mapping. | |
jq '.techniques[] | .techniqueID, .tactic' guardduty-navigator.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# From all Slack user groups, filters the ones that match the regex and amongst them, shows only name, description, and handle. | |
jq '.usergroups[] | select(.handle | test(".*on-?call")) | .name, .description, .handle' slack-user-groups-20230116.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Figures start with [!...](...) | |
find ./content -type f -name "*.md" -exec grep -l "^.\\[.*\\]\\(.*\\)" {} \\; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment