This file contains hidden or 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
| glab api --hostname hostname "projects/project-name/repository/commits" 2>&1 | python3 -c " | |
| import json,sys | |
| d = json.load(sys.stdin) | |
| for c in d: | |
| print(c['short_id'], c['title']) | |
| " |
This file contains hidden or 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
| # obviously use your own actionid, org, repo and look for the text you used in your yaml | |
| last="" | |
| while true; do | |
| s=$(gh run view <actionid> --repo org/repo --json status,conclusion,jobs 2>/dev/null) || { sleep 20; continue; } | |
| st=$(echo "$s" | python3 -c "import sys,json;d=json.load(sys.stdin);print(d['status'],d.get('conclusion'))" 2>/dev/null) | |
| cur=$(echo "$s" | python3 -c " | |
| import sys,json | |
| d=json.load(sys.stdin) | |
| out=[] | |
| for j in d.get('jobs',[]): |
This file contains hidden or 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
| echo "=== dev vs main divergence ==="; git rev-list --left-right --count origin/main...origin/dev; echo "(left=main-only, right=dev-only)"; echo; echo "=== commits in dev not in main (last 20) ==="; git log --oneline origin/main..origin/dev | head -20; echo; echo "=== commits in main not in dev ==="; git log --oneline origin/dev..origin/main | head -20; echo "(none above = main fully contained in dev)" |
This file contains hidden or 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
| #!/usr/bin/env bash | |
| # ========================================================= | |
| # to-png | |
| # | |
| # Convert JPG, JPEG, WEBP, and AVIF images to PNG. | |
| # | |
| # Requirements: | |
| # brew install imagemagick | |
| # brew install webp |
This file contains hidden or 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
| python3 -m json.tool /path/to/file/my_json_file.json > /dev/null && echo OK |
This file contains hidden or 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
| pwd | |
| fnm current | |
| ls .nvmrc .node-version 2>/dev/null | |
| # walk upward looking for a version file: | |
| d=$PWD; while [ "$d" != "/" ]; do ls "$d"/.nvmrc "$d"/.node-version 2>/dev/null; d=$(dirname "$d"); done |
This file contains hidden or 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
| :g/^/m0 |
This file contains hidden or 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
| local function system(command) | |
| local file = assert(io.popen(command, "r")) | |
| local output = file:read("*all"):gsub("%s+", "") | |
| file:close() | |
| return output | |
| end |
This file contains hidden or 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
| /(^\d{5}(-\d{4})?$)|(^[ABCEGHJKLMNPRSTVXY]{1}\d{1}[A-Z]{1} *\d{1}[A-Z]{1}\d{1}$)/ |
This file contains hidden or 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
| // Checks if a date is before another date. | |
| // - Use the less than operator (`<`) to check if the first date comes before the second one. | |
| const isBeforeDate = (dateA, dateB) => dateA < dateB; | |
| isBeforeDate(new Date(2010, 10, 20), new Date(2010, 10, 21)); // true |
NewerOlder