about: misc utilities
commands:
appletoast:
about: A script for automated tasks.
path: ../scripts/source/appletoast
commands:
help:
about: Describe this script.
exec:
argv:
- bash
- -lc
- 'cat <<''EOF''
appletoast
A script for automated tasks.
EOF
'
run:
about: Run the script (inlined); forwards args.
exec:
argv:
- bash
- -lc
- "set -euo pipefail\ntmpdir=\"$(mktemp -d)\"\ntrap 'rm -rf \"$tmpdir\"\
' EXIT\ncat >\"$tmpdir/_appletoast\" <<'JAN_EOF_appletoast__appletoast_919fc2f50e08'\n\
#compdef appletoast\n\n# Zsh completion for appletoast\n# This script\
\ displays a macOS notification with a title and body.\n# Usage: appletoast\
\ \"Title\" \"Body\"\n\n_appletoast() {\n _arguments -C \\\n \
\ '1:Title: ' \\\n '2:Body: '\n}\n\n_appletoast \"$@\"\nJAN_EOF_appletoast__appletoast_919fc2f50e08\n\
chmod +x \"$tmpdir/_appletoast\" 2>/dev/null || true\ncat >\"$tmpdir/appletoast.sh\"\
\ <<'JAN_EOF_appletoast_appletoast_sh_e95e1dd47bba'\n#!/bin/bash \n# (c)\
\ 2022 Pat Beagan: MIT License\n\nappletoast () \n{ \n title=\"$1\"\
;\n body=\"$2\";\n osascript -e 'on run {body, title}' -e 'display\
\ notification {body} with title {title}' -e 'end run' \"$body\" \"$title\"\
\n}\nappletoast \"$@\"\ntrackusage \"$0\"\nJAN_EOF_appletoast_appletoast_sh_e95e1dd47bba\n\
chmod +x \"$tmpdir/appletoast.sh\" 2>/dev/null || true\ncd \"$tmpdir\"\
\nexec \"$tmpdir/appletoast.sh\" \"$@\"\n"
passthrough: true
apply-copyright-bash:
about: A script for automated tasks.
path: ../scripts/source/apply-copyright-bash
commands:
help:
about: Describe this script.
exec:
argv:
- bash
- -lc
- 'cat <<''EOF''
apply-copyright-bash
A script for automated tasks.
EOF
'
run:
about: Run the script (inlined); forwards args.
exec:
argv:
- bash
- -lc
- "set -euo pipefail\ntmpdir=\"$(mktemp -d)\"\ntrap 'rm -rf \"$tmpdir\"\
' EXIT\ncat >\"$tmpdir/_apply-copyright-bash\" <<'JAN_EOF_apply_copyright_bash__apply_copyright_bash_512a4080eb97'\n\
#compdef apply-copyright-bash\n\n# Zsh completion for apply-copyright-bash\n\
# Generated automatically - customize as needed\n\n_apply-copyright-bash()\
\ {\n local context state line\n typeset -A opt_args\n \n \
\ _arguments -C \\\n '(-h --help)'{-h,--help}'[Show help information]'\
\ \\\n '(-v --version)'{-v,--version}'[Show version information]'\
\ \\\n '*::arg:_files'\n}\n\n_apply-copyright-bash \"$@\"\nJAN_EOF_apply_copyright_bash__apply_copyright_bash_512a4080eb97\n\
chmod +x \"$tmpdir/_apply-copyright-bash\" 2>/dev/null || true\ncat >\"\
$tmpdir/apply-copyright-bash.sh\" <<'JAN_EOF_apply_copyright_bash_apply_copyright_bash_sh_5c62542f1ff2'\n\
#!/usr/bin/env zsh\n# (c) 2022 Pat Beagan: MIT License\n\nset -euo pipefail\n\
\nscriptname=\"$(basename \"$0\")\"\nhelp() {\n error_code=$?\n \
\ echo \"\nUsage: $scriptname [-h|--help]\n\nAdds copyright header to\
\ all bash shell scripts in the ./scripts directory.\nThe copyright header\
\ will be inserted after the shebang line in each shell script.\n\nThe\
\ copyright header added is:\n# (c) 2022 Pat Beagan: MIT License\n\nThis\
\ script modifies files in place using sed.\n\"\n exit $error_code\n\
}\n\nmain() {\n\n emulate -L zsh\n zmodload zsh/zutil || return\
\ 1\n\n local help\n zparseopts -D -F -K -- \\\n {h,-help}=help\
\ ||\n return 1\n\n if (($#help)); then help; fi\n\napply-copyright-bash\
\ () {\n\tfind ./scripts -name \"*\" -type f -executable -exec sed -i\
\ '' 's/^#!\\(.*\\)/#!\\1\\n# \\(c\\) 2022 Pat Beagan: MIT License/' {}\
\ \\;\n}\n\n apply-copyright-bash \"$@\" || help\n}\n\nmain \"$@\"\
\ || help\ntrackusage \"$0\"\nJAN_EOF_apply_copyright_bash_apply_copyright_bash_sh_5c62542f1ff2\n\
chmod +x \"$tmpdir/apply-copyright-bash.sh\" 2>/dev/null || true\ncd \"\
$tmpdir\"\nexec \"$tmpdir/apply-copyright-bash.sh\" \"$@\"\n"
passthrough: true
apply-copyright-py:
about: A script for automated tasks.
path: ../scripts/source/apply-copyright-py
commands:
help:
about: Describe this script.
exec:
argv:
- bash
- -lc
- 'cat <<''EOF''
apply-copyright-py
A script for automated tasks.
EOF
'
run:
about: Run the script (inlined); forwards args.
exec:
argv:
- bash
- -lc
- "set -euo pipefail\ntmpdir=\"$(mktemp -d)\"\ntrap 'rm -rf \"$tmpdir\"\
' EXIT\ncat >\"$tmpdir/_apply-copyright-py\" <<'JAN_EOF_apply_copyright_py__apply_copyright_py_f878d8c73640'\n\
#compdef apply-copyright-py\n\n# Zsh completion for apply-copyright-py\n\
# Generated automatically - customize as needed\n\n_apply-copyright-py()\
\ {\n local context state line\n typeset -A opt_args\n \n \
\ _arguments -C \\\n '(-h --help)'{-h,--help}'[Show help information]'\
\ \\\n '(-v --version)'{-v,--version}'[Show version information]'\
\ \\\n '*::arg:_files'\n}\n\n_apply-copyright-py \"$@\"\nJAN_EOF_apply_copyright_py__apply_copyright_py_f878d8c73640\n\
chmod +x \"$tmpdir/_apply-copyright-py\" 2>/dev/null || true\ncat >\"\
$tmpdir/apply-copyright-py.sh\" <<'JAN_EOF_apply_copyright_py_apply_copyright_py_sh_b04e86e9826b'\n\
#!/usr/bin/env zsh\n# (c) 2022 Pat Beagan: MIT License\n\nset -euo pipefail\n\
\nscriptname=\"$(basename \"$0\")\"\nhelp() {\n error_code=$?\n \
\ echo \"\nUsage: $scriptname [-h|--help]\n\nAdds copyright header to\
\ all Python scripts in the ./scripts directory.\nThe copyright header\
\ will be inserted after the shebang line in each .py file.\n\nThe copyright\
\ header added is:\n# (c) 2022 Pat Beagan: MIT License\n\nThis script\
\ modifies files in place using sed.\n\"\n exit $error_code\n}\n\n\
main() {\n\n emulate -L zsh\n zmodload zsh/zutil || return 1\n\n\
\ local help\n zparseopts -D -F -K -- \\\n {h,-help}=help\
\ ||\n return 1\n\n if (($#help)); then help; fi\n\napply-copyright-bash\
\ () {\n\tfind ./scripts -name \"*.py\" -type f -exec sed -i '' 's/^#!\\\
(.*\\)/#!\\1\\n# \\(c\\) 2022 Pat Beagan: MIT License/' {} \\;\n}\n\n\
\ apply-copyright-bash \"$@\" || help\n}\n\nmain \"$@\" || help\ntrackusage\
\ \"$0\"\nJAN_EOF_apply_copyright_py_apply_copyright_py_sh_b04e86e9826b\n\
chmod +x \"$tmpdir/apply-copyright-py.sh\" 2>/dev/null || true\ncd \"\
$tmpdir\"\nexec \"$tmpdir/apply-copyright-py.sh\" \"$@\"\n"
passthrough: true
argnum:
about: A script for automated tasks.
path: ../scripts/source/argnum
commands:
help:
about: Describe this script.
exec:
argv:
- bash
- -lc
- 'cat <<''EOF''
argnum
A script for automated tasks.
EOF
'
run:
about: Run the script (inlined); forwards args.
exec:
argv:
- bash
- -lc
- "set -euo pipefail\ntmpdir=\"$(mktemp -d)\"\ntrap 'rm -rf \"$tmpdir\"\
' EXIT\ncat >\"$tmpdir/_argnum\" <<'JAN_EOF_argnum__argnum_5ea40b0ffadf'\n\
#compdef argnum\n\n# Zsh completion for argnum\n# Generated automatically\
\ - customize as needed\n\n_argnum() {\n local context state line\n\
\ typeset -A opt_args\n \n _arguments -C \\\n '(-h --help)'{-h,--help}'[Show\
\ help information]' \\\n '(-v --version)'{-v,--version}'[Show\
\ version information]' \\\n '*::arg:_files'\n}\n\n_argnum \"$@\"\
\nJAN_EOF_argnum__argnum_5ea40b0ffadf\nchmod +x \"$tmpdir/_argnum\" 2>/dev/null\
\ || true\ncat >\"$tmpdir/argnum.sh\" <<'JAN_EOF_argnum_argnum_sh_369232541c77'\n\
#!/bin/bash \n# (c) 2022 Pat Beagan: MIT License\n\nargnum () \n{ \n \
\ printf \"%d args:\" $#;\n printf \" <%s>\" \"$@\";\n echo\n\
}\nargnum \"$@\"\ntrackusage \"$0\"\nJAN_EOF_argnum_argnum_sh_369232541c77\n\
chmod +x \"$tmpdir/argnum.sh\" 2>/dev/null || true\ncd \"$tmpdir\"\nexec\
\ \"$tmpdir/argnum.sh\" \"$@\"\n"
passthrough: true
aws-bucket-sizes:
about: A script for automated tasks.
path: ../scripts/source/aws-bucket-sizes
commands:
help:
about: Describe this script.
exec:
argv:
- bash
- -lc
- 'cat <<''EOF''
aws-bucket-sizes
A script for automated tasks.
EOF
'
run:
about: Run the script (inlined); forwards args.
exec:
argv:
- bash
- -lc
- "set -euo pipefail\ntmpdir=\"$(mktemp -d)\"\ntrap 'rm -rf \"$tmpdir\"\
' EXIT\ncat >\"$tmpdir/_aws-bucket-sizes\" <<'JAN_EOF_aws_bucket_sizes__aws_bucket_sizes_17a12a40ba0f'\n\
#compdef aws-bucket-sizes\n\n# Zsh completion for aws-bucket-sizes\n#\
\ Generated automatically - customize as needed\n\n\n_aws-bucket-sizes()\
\ {\n local context state line\n typeset -A opt_args\n \n \
\ _arguments -C \\\n '(-h --help)'{-h,--help}'[Show help information]'\
\ \\\n '(-v --version)'{-v,--version}'[Show version information]'\
\ \\\n '---[Custom option]' \\\n '-r[Custom option]' \\\n\
\ '-s[Custom option]' \\ '*::arg:_files'\n}\n\n_aws-bucket-sizes\
\ \"$@\"\nJAN_EOF_aws_bucket_sizes__aws_bucket_sizes_17a12a40ba0f\nchmod\
\ +x \"$tmpdir/_aws-bucket-sizes\" 2>/dev/null || true\ncat >\"$tmpdir/aws-bucket-sizes.zsh\"\
\ <<'JAN_EOF_aws_bucket_sizes_aws_bucket_sizes_zsh_a0ce4845d408'\n#!/bin/bash\n\
\n# Get a list of all bucket names\nbuckets=$(aws s3 ls | awk '{print\
\ $3}')\n\n# Loop through each bucket\nfor bucket in $buckets\ndo\n echo\
\ \"Getting size for bucket: $bucket\"\n \n # Use --summarize and --human-readable\
\ to get the total size\n aws s3 ls s3://$bucket --recursive --human-readable\
\ --summarize\n echo \"------------------------------\"\ndone\nJAN_EOF_aws_bucket_sizes_aws_bucket_sizes_zsh_a0ce4845d408\n\
chmod +x \"$tmpdir/aws-bucket-sizes.zsh\" 2>/dev/null || true\ncd \"$tmpdir\"\
\nexec \"$tmpdir/aws-bucket-sizes.zsh\" \"$@\"\n"
passthrough: true
backup_tmsu:
about: A script for automated tasks.
path: ../scripts/source/backup_tmsu
commands:
help:
about: Describe this script.
exec:
argv:
- bash
- -lc
- 'cat <<''EOF''
backup_tmsu
A script for automated tasks.
EOF
'
run:
about: Run the script (inlined); forwards args.
exec:
argv:
- bash
- -lc
- "set -euo pipefail\ntmpdir=\"$(mktemp -d)\"\ntrap 'rm -rf \"$tmpdir\"\
' EXIT\ncat >\"$tmpdir/_backup_tmsu\" <<'JAN_EOF_backup_tmsu__backup_tmsu_5a0205f8bead'\n\
#compdef backup_tmsu\n\n# Zsh completion for backup_tmsu\n# Generated\
\ automatically - customize as needed\n\n_backup_tmsu() {\n local context\
\ state line\n typeset -A opt_args\n \n _arguments -C \\\n \
\ '(-h --help)'{-h,--help}'[Show help information]' \\\n '(-v\
\ --version)'{-v,--version}'[Show version information]' \\\n '*::arg:_files'\n\
}\n\n_backup_tmsu \"$@\"\nJAN_EOF_backup_tmsu__backup_tmsu_5a0205f8bead\n\
chmod +x \"$tmpdir/_backup_tmsu\" 2>/dev/null || true\ncat >\"$tmpdir/backup_tmsu.sh\"\
\ <<'JAN_EOF_backup_tmsu_backup_tmsu_sh_31fd4fe8a087'\nsqlite3 db .dump\
\ | gzip -c > \"db.`date +%s`.dmp.gz\"\nsqlite3 db \".backup db.`date\
\ +%s`.bak\"\n\ntrackusage \"$0\"\nJAN_EOF_backup_tmsu_backup_tmsu_sh_31fd4fe8a087\n\
chmod +x \"$tmpdir/backup_tmsu.sh\" 2>/dev/null || true\ncd \"$tmpdir\"\
\nexec \"$tmpdir/backup_tmsu.sh\" \"$@\"\n"
passthrough: true
binlink:
about: A script for automated tasks.
path: ../scripts/source/binlink
commands:
help:
about: Describe this script.
exec:
argv:
- bash
- -lc
- 'cat <<''EOF''
binlink
A script for automated tasks.
EOF
'
run:
about: Run the script (inlined); forwards args.
exec:
argv:
- bash
- -lc
- "set -euo pipefail\ntmpdir=\"$(mktemp -d)\"\ntrap 'rm -rf \"$tmpdir\"\
' EXIT\ncat >\"$tmpdir/_binlink\" <<'JAN_EOF_binlink__binlink_87ecc1913b02'\n\
#compdef binlink\n\n# Zsh completion for binlink\n# Generated automatically\
\ - customize as needed\n\n_binlink() {\n local context state line\n\
\ typeset -A opt_args\n \n _arguments -C \\\n '(-h --help)'{-h,--help}'[Show\
\ help information]' \\\n '(-v --version)'{-v,--version}'[Show\
\ version information]' \\\n '*::arg:_files'\n}\n\n_binlink \"\
$@\"\nJAN_EOF_binlink__binlink_87ecc1913b02\nchmod +x \"$tmpdir/_binlink\"\
\ 2>/dev/null || true\ncat >\"$tmpdir/binlink.sh\" <<'JAN_EOF_binlink_binlink_sh_a2911c61272d'\n\
#!/bin/bash \n# (c) 2022 Pat Beagan: MIT License\n\nbinlink () \n{ \n\
\ ln -s $(pwd)/$1 /usr/local/bin/$1\n}\n\nbinlink \"$@\"\ntrackusage\
\ \"$0\"\nJAN_EOF_binlink_binlink_sh_a2911c61272d\nchmod +x \"$tmpdir/binlink.sh\"\
\ 2>/dev/null || true\ncd \"$tmpdir\"\nexec \"$tmpdir/binlink.sh\" \"\
$@\"\n"
passthrough: true
cache:
about: A script for automated tasks.
path: ../scripts/source/cache
commands:
help:
about: Describe this script.
exec:
argv:
- bash
- -lc
- 'cat <<''EOF''
cache
A script for automated tasks.
EOF
'
run:
about: Run the script (inlined); forwards args.
exec:
argv:
- bash
- -lc
- "set -euo pipefail\ntmpdir=\"$(mktemp -d)\"\ntrap 'rm -rf \"$tmpdir\"\
' EXIT\ncat >\"$tmpdir/_cache\" <<'JAN_EOF_cache__cache_a9b16b99bc21'\n\
#compdef cache\n\n# Zsh completion for cache\n# Generated automatically\
\ - customize as needed\n\n_cache() {\n local context state line\n\
\ typeset -A opt_args\n \n _arguments -C \\\n '(-h --help)'{-h,--help}'[Show\
\ help information]' \\\n '(-v --version)'{-v,--version}'[Show\
\ version information]' \\\n '*::arg:_files'\n}\n\n_cache \"$@\"\
\nJAN_EOF_cache__cache_a9b16b99bc21\nchmod +x \"$tmpdir/_cache\" 2>/dev/null\
\ || true\ncat >\"$tmpdir/cache.sh\" <<'JAN_EOF_cache_cache_sh_106777727c19'\n\
#!/usr/bin/env zsh\n# (c) 2022 Pat Beagan: MIT License\n\nset -euo pipefail\n\
IFS=$'\\n\\t'\n\nhelp() {\n error_code=$?\n echo \"\nCaches information\
\ from a given URL, at a given cache location. \nThe default cache location\
\ is ~/p-cache\n\nThe script will return the location where the information\
\ is cached.\nSubsequent calls with the same address will skip downloading\
\ and just return the cache file name.\n\"\n if [[ ! $error_code -eq\
\ 0 ]]; then echo \"Err: $error_code\"; fi\n}\n\nfunction cache() {\n\
\ if [ ! $# -eq 1 ]; then\n return 1\n fi\n local cache_location=\"\
$HOME/p-cache\"\n local basename_original=\"$1\"\n local basename=\"\
$(sed 's/\\//-/g' <(echo \"$1\"))\"\n local filename=\"$cache_location/$basename\"\
\n mkdir -p \"$cache_location\"\n\n if [ -f \"$filename\" ]; then\n\
\ echo \"$filename\"\n else\n wget \\\n --quiet\
\ \\\n -P \"$cache_location\" \\\n --continue \\\
\n -O \"$filename\" \\\n \"$basename_original\"\n\
\ if [ $? -eq 0 ]; then\n echo \"$filename\"\n \
\ else\n return 1\n fi\n fi\n}\n\ncache \"$@\"\
\ || help\ntrackusage \"$0\"\nJAN_EOF_cache_cache_sh_106777727c19\nchmod\
\ +x \"$tmpdir/cache.sh\" 2>/dev/null || true\ncd \"$tmpdir\"\nexec \"\
$tmpdir/cache.sh\" \"$@\"\n"
passthrough: true
cbr-show:
about: A script for automated tasks.
path: ../scripts/source/cbr-show
commands:
help:
about: Describe this script.
exec:
argv:
- bash
- -lc
- 'cat <<''EOF''
cbr-show
A script for automated tasks.
EOF
'
run:
about: Run the script (inlined); forwards args.
exec:
argv:
- bash
- -lc
- "set -euo pipefail\ntmpdir=\"$(mktemp -d)\"\ntrap 'rm -rf \"$tmpdir\"\
' EXIT\ncat >\"$tmpdir/_cbr-show\" <<'JAN_EOF_cbr_show__cbr_show_87132d78100b'\n\
#compdef cbr-show\n\n# Zsh completion for cbr-show\n# Generated automatically\
\ - customize as needed\n\n_cbr-show() {\n local context state line\n\
\ typeset -A opt_args\n \n _arguments -C \\\n '(-h --help)'{-h,--help}'[Show\
\ help information]' \\\n '(-v --version)'{-v,--version}'[Show\
\ version information]' \\\n '*::arg:_files'\n}\n\n_cbr-show \"\
$@\"\nJAN_EOF_cbr_show__cbr_show_87132d78100b\nchmod +x \"$tmpdir/_cbr-show\"\
\ 2>/dev/null || true\ncat >\"$tmpdir/cbr-show.js\" <<'JAN_EOF_cbr_show_cbr_show_js_4f2c8045686b'\n\
const express = require('express');\nconst fs = require('fs');\nconst\
\ path = require('path');\nconst JSZip = require('jszip');\nconst app\
\ = express();\n\nconst cbrDirectory = './'; // Use the current directory\
\ as the CBR directory\n\nconst coverCache = new Map()\nasync function\
\ checkCoverCache(key, defaultFn) {\n const value = coverCache.get[key]\n\
\ if (value) {\n return value\n }\n const generatedValue = await\
\ defaultFn()\n coverCache.set(key, generatedValue)\n return generatedValue\n\
}\n\napp.get('/', async (req, res) => {\n const cbrFiles = getCbrFiles(cbrDirectory);\n\
\ const links = await Promise.all(cbrFiles.map(async (file) => await\
\ getLinkHTML(file)))\n\n const html = `\n <html>\n <head>\n\
\ <title>CBR Viewer - Home</title>\n <style>\n \
\ .cbr-link {\n display: flex;\n flex-direction:\
\ column;\n align-items: center;\n text-align: center;\n\
\ width: 200px;\n margin: 10px;\n padding:\
\ 10px;\n border-radius: 10px;\n background-color:\
\ #f5f5f5;\n box-shadow: 0 2px 5px rgba(0,0,0,0.3);\n \
\ text-decoration: none;\n color: black;\n }\n\
\ .cbr-link img {\n width: 100%;\n max-height:\
\ 300px;\n border-radius: 10px;\n margin-bottom:\
\ 10px;\n }\n .display-filename {\n overflow-wrap:\
\ anywhere;\n }\n </style>\n </head>\n <body>\n\
\ <h1>CBR Viewer</h1>\n <div style=\"display: flex; flex-wrap:\
\ wrap;\">\n ${links.join('')}\n </div>\n </body>\n\
\ </html>\n `;\n res.send(html);\n});\n\napp.get('/cbrviewer/:fileName',\
\ async (req, res) => {\n try {\n const cbrFileName = req.params.fileName;\n\
\ const zip = await readZip(cbrFileName)\n\n const images = await\
\ Promise.all(\n findImageFileObjects(zip)\n .map(async (entry)\
\ => {\n return {\n name: entry.name,\n \
\ url: await getImageUrlFor(entry)\n }\n }));\n\n \
\ images.sort((a, b) => {\n const nameA = a.name.toUpperCase();\n\
\ const nameB = b.name.toUpperCase();\n if (nameA < nameB) {\n\
\ return -1;\n } else if (nameA > nameB) {\n return\
\ 1;\n } else {\n return 0;\n }\n })\n\n const\
\ html = `\n <html>\n <head>\n <title>CBR Viewer\
\ - ${cbrFileName}</title>\n <style>\n #container {\n\
\ display: flex;\n justify-content: center;\n \
\ }\n #container > div {\n width: 90%;\n \
\ }\n .cbr-image-container {\n display: flex;\n\
\ justify-content: center;\n }\n .cbr-image\
\ {\n width: 100%;\n }\n </style>\n \
\ </head>\n <body>\n <h1>${cbrFileName}</h1>\n \
\ <div id=\"container\">\n <div>\n ${images.map(each\
\ => `\n <div class=\"cbr-image-container\">\n \
\ <img class=\"cbr-image\" src=\"${each.url}\">\n \
\ </div>\n `).join('')}\n </div>\n \
\ </div>\n </body>\n </html>\n `;\n res.send(html);\n\
\ } catch (error) {\n console.error(error);\n res.status(500).send('Error\
\ displaying CBR file');\n }\n});\n\napp.listen(3000, \"0.0.0.0\", ()\
\ => console.log('Server started at http://0.0.0.0:3000'));\n\nasync function\
\ getImageUrlFor(entry) {\n const type = entry.name.search(/.(\\w)$/);\n\
\ const blob = await entry.async('base64');\n const url = `data:${type};base64,${blob}`;\n\
\ return url;\n}\n\nfunction getCbrFiles(directoryPath) {\n const files\
\ = fs.readdirSync(directoryPath);\n const cbrFiles = files.filter((file)\
\ => {\n const extName = path.extname(file).toLowerCase();\n const\
\ isCBR = extName === '.cbr';\n const isCBZ = extName === '.cbz';\n\
\ return isCBR || isCBZ;\n });\n return cbrFiles;\n}\n\nasync function\
\ readZip(fileName) {\n const filePath = path.join(cbrDirectory, fileName);\n\
\ const zip = JSZip.loadAsync(fs.readFileSync(filePath));\n return zip\n\
}\n\nfunction findImageFileObjects(zipFile) {\n return zipFile.file(/.jpg|.JPG|.jpeg|.png/)\n\
}\n\nasync function getLinkHTML(fileName) {\n const zip = readZip(fileName)\n\
\ return zip.then(async zipFile => {\n try {\n const entry =\
\ findImageFileObjects(zipFile)[0]\n const url = await checkCoverCache(entry.name,\
\ () => getImageUrlFor(entry))\n return `\n <a href=\"/cbrviewer/${fileName}\"\
\ class=\"cbr-link\">\n <img src=\"${url}\">\n <span\
\ class=\"display-filename\">${fileName}</span>\n </a>\n `;\n\
\ } catch (error) {\n console.error(error)\n return \"\"\n\
\ }\n });\n}\nJAN_EOF_cbr_show_cbr_show_js_4f2c8045686b\nchmod +x\
\ \"$tmpdir/cbr-show.js\" 2>/dev/null || true\ncat >\"$tmpdir/cbr-show.sh\"\
\ <<'JAN_EOF_cbr_show_cbr_show_sh_cdc86ea71e2b'\n#!/usr/bin/env zsh\n\n\
node $(dirname \"$0\")/_cbr-show/cbr-show.js\nJAN_EOF_cbr_show_cbr_show_sh_cdc86ea71e2b\n\
chmod +x \"$tmpdir/cbr-show.sh\" 2>/dev/null || true\ncd \"$tmpdir\"\n\
exec \"$tmpdir/cbr-show.sh\" \"$@\"\n"
passthrough: true
check_program:
about: A script for automated tasks.
path: ../scripts/source/check_program
commands:
help:
about: Describe this script.
exec:
argv:
- bash
- -lc
- 'cat <<''EOF''
check_program
A script for automated tasks.
EOF
'
run:
about: Run the script (inlined); forwards args.
exec:
argv:
- bash
- -lc
- "set -euo pipefail\ntmpdir=\"$(mktemp -d)\"\ntrap 'rm -rf \"$tmpdir\"\
' EXIT\ncat >\"$tmpdir/_check_program\" <<'JAN_EOF_check_program__check_program_1bce64da3532'\n\
#compdef check_program\n\n# Zsh completion for check_program\n# Generated\
\ automatically - customize as needed\n\n_check_program() {\n local\
\ context state line\n typeset -A opt_args\n \n _arguments -C\
\ \\\n '(-h --help)'{-h,--help}'[Show help information]' \\\n \
\ '(-v --version)'{-v,--version}'[Show version information]' \\\n\
\ '*::arg:_files'\n}\n\n_check_program \"$@\"\nJAN_EOF_check_program__check_program_1bce64da3532\n\
chmod +x \"$tmpdir/_check_program\" 2>/dev/null || true\ncat >\"$tmpdir/check_program.py\"\
\ <<'JAN_EOF_check_program_check_program_py_5748db6365bf'\n#!/usr/bin/env\
\ python3\n\nimport subprocess\nfrom concurrent.futures import ThreadPoolExecutor\n\
import argparse\n\n# Define a dictionary for package managers and their\
\ respective check commands\npkg_managers = {\n 'brew': 'brew list',\n\
\ 'apt': 'apt list --installed',\n 'yum': 'yum list installed',\n\
\ 'dnf': 'dnf list --installed',\n 'zypper': 'zypper se --installed-only',\n\
\ 'pacman': 'pacman -Q',\n 'port': 'port installed',\n 'rpm':\
\ 'rpm -q',\n 'snap': 'snap list',\n 'flatpak': 'flatpak list',\n\
\ 'npm': 'npm list -g',\n 'cargo': 'cargo install --list',\n \
\ 'pip': 'pip show',\n 'pip3': 'pip3 show',\n 'gem': 'gem list --installed',\n\
\ 'pear': 'pear list',\n 'composer': 'composer show',\n 'nuget':\
\ 'dotnet nuget locals all --list',\n 'go': 'go list -m',\n 'conda':\
\ 'conda list'\n}\n\ndef check_installed(manager, program):\n \"\"\"\
\n Check if a program is installed using a specified package manager.\n\
\ \n Args:\n - manager: The package manager name.\n - program:\
\ The program name to check.\n \n Returns:\n - The package manager\
\ name if the program is installed; otherwise, an empty string.\n \"\
\"\"\n # try:\n # Check if the package manager is available on the\
\ system\n subprocess.run(manager, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL,\
\ check=True)\n\n # Retrieve the command for the package manager\n\
\ check_cmd = pkg_managers[manager]\n\n # Execute the command to\
\ check if the program is installed\n child = subprocess.Popen(f\"\
{check_cmd} {program}\", stdout=subprocess.PIPE, stderr=subprocess.STDOUT)\n\
\ print(child.stdout.read())\n\n result = subprocess.run(f\"{check_cmd}\
\ {program}\", shell=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)\n\
\n if result.returncode == 0:\n return manager\n else:\n\
\ return ''\n # except (subprocess.CalledProcessError, KeyError,\
\ FileNotFoundError):\n # return ''\n\ndef main(program):\n \
\ \"\"\"\n Main function to check if a program is installed via various\
\ package managers.\n \n Args:\n - program: The program name\
\ to check.\n \"\"\"\n print(\"Starting program check...\")\n\n\
\ # Run the checks in parallel\n print(\"Running checks across various\
\ package managers...\")\n with ThreadPoolExecutor() as executor:\n\
\ results = list(executor.map(check_installed, pkg_managers.keys(),\
\ [program] * len(pkg_managers)))\n \n # Filter out empty strings\
\ and display the package managers that have the program installed\n \
\ installed_pkg_managers = [pkg_managers[manager] for manager in results\
\ if manager]\n print(f\"Program {program} is installed via the following\
\ package managers:\")\n print(\" \"+ '\\n '.join(installed_pkg_managers)\
\ if installed_pkg_managers else f\"Program {program} is not installed\
\ via known package managers or is not available.\")\n \n print(\"\
Check complete.\")\n\nif __name__ == \"__main__\":\n parser = argparse.ArgumentParser(description=\"\
Check if a program is installed via various package managers.\")\n \
\ parser.add_argument('program', type=str, help=\"The name of the program\
\ to check.\")\n args = parser.parse_args()\n\n main(args.program)\n\
JAN_EOF_check_program_check_program_py_5748db6365bf\nchmod +x \"$tmpdir/check_program.py\"\
\ 2>/dev/null || true\ncat >\"$tmpdir/check_program.sh\" <<'JAN_EOF_check_program_check_program_sh_ad1c7fa7fd41'\n\
#!/usr/bin/zsh\n\neval \"$(fzf < <(_check_program.ts))\"\nJAN_EOF_check_program_check_program_sh_ad1c7fa7fd41\n\
chmod +x \"$tmpdir/check_program.sh\" 2>/dev/null || true\ncd \"$tmpdir\"\
\nexec \"$tmpdir/check_program.sh\" \"$@\"\n"
passthrough: true
check_program_snippets:
about: A script for automated tasks.
path: ../scripts/source/check_program_snippets
commands:
help:
about: Describe this script.
exec:
argv:
- bash
- -lc
- 'cat <<''EOF''
check_program_snippets
A script for automated tasks.
EOF
'
run:
about: Run the script (inlined); forwards args.
exec:
argv:
- bash
- -lc
- "set -euo pipefail\ntmpdir=\"$(mktemp -d)\"\ntrap 'rm -rf \"$tmpdir\"\
' EXIT\ncat >\"$tmpdir/_check_program_snippets\" <<'JAN_EOF_check_program_snippets__check_program_snippets_4ce97aad61cf'\n\
#compdef check_program_snippets\n\n# Zsh completion for check_program_snippets\n\
# Generated automatically - customize as needed\n\n_check_program_snippets()\
\ {\n local context state line\n typeset -A opt_args\n \n \
\ _arguments -C \\\n '(-h --help)'{-h,--help}'[Show help information]'\
\ \\\n '(-v --version)'{-v,--version}'[Show version information]'\
\ \\\n '*::arg:_files'\n}\n\n_check_program_snippets \"$@\"\nJAN_EOF_check_program_snippets__check_program_snippets_4ce97aad61cf\n\
chmod +x \"$tmpdir/_check_program_snippets\" 2>/dev/null || true\ncat\
\ >\"$tmpdir/check_program_snippets.sh\" <<'JAN_EOF_check_program_snippets_check_program_snippets_sh_c33a83800edf'\n\
#!/usr/bin/zsh\n\n# Local snippets\neval \"$(fzf << EOF\nbrew list\napt\
\ list --installed\nyum list installed\ndnf list --installed\nzypper se\
\ --installed-only\npacman -Q\nport installed\nrpm -q\nsnap list\nflatpak\
\ list\nnpm list -g\ncargo install --list\npip show\npip3 show\ngem list\
\ --installed\npear list\ncomposer show\ndotnet nuget locals all --list\n\
go list -m\nconda list\nEOF\n)\"\nJAN_EOF_check_program_snippets_check_program_snippets_sh_c33a83800edf\n\
chmod +x \"$tmpdir/check_program_snippets.sh\" 2>/dev/null || true\ncd\
\ \"$tmpdir\"\nexec \"$tmpdir/check_program_snippets.sh\" \"$@\"\n"
passthrough: true
checkcrlf:
about: A script for automated tasks.
path: ../scripts/source/checkcrlf
commands:
help:
about: Describe this script.
exec:
argv:
- bash
- -lc
- 'cat <<''EOF''
checkcrlf
A script for automated tasks.
EOF
'
run:
about: Run the script (inlined); forwards args.
exec:
argv:
- bash
- -lc
- "set -euo pipefail\ntmpdir=\"$(mktemp -d)\"\ntrap 'rm -rf \"$tmpdir\"\
' EXIT\ncat >\"$tmpdir/_checkcrlf\" <<'JAN_EOF_checkcrlf__checkcrlf_4485ae8ff68a'\n\
#compdef checkcrlf\n\n# Zsh completion for checkcrlf\n# Generated automatically\
\ - customize as needed\n\n_checkcrlf() {\n local context state line\n\
\ typeset -A opt_args\n \n _arguments -C \\\n '(-h --help)'{-h,--help}'[Show\
\ help information]' \\\n '(-v --version)'{-v,--version}'[Show\
\ version information]' \\\n '*::arg:_files'\n}\n\n_checkcrlf \"\
$@\"\nJAN_EOF_checkcrlf__checkcrlf_4485ae8ff68a\nchmod +x \"$tmpdir/_checkcrlf\"\
\ 2>/dev/null || true\ncat >\"$tmpdir/checkcrlf.sh\" <<'JAN_EOF_checkcrlf_checkcrlf_sh_b3cdfa8ab14c'\n\
#!/bin/bash \n# (c) 2022 Pat Beagan: MIT License\n\ncheckcrlf () \n{ \n\
\ dos2unix < \"$1\" | cmp -s - \"$1\"\n}\ncheckcrlf \"$@\"\ntrackusage\
\ \"$0\"\nJAN_EOF_checkcrlf_checkcrlf_sh_b3cdfa8ab14c\nchmod +x \"$tmpdir/checkcrlf.sh\"\
\ 2>/dev/null || true\ncd \"$tmpdir\"\nexec \"$tmpdir/checkcrlf.sh\" \"\
$@\"\n"
passthrough: true
convert-date:
about: A script for automated tasks.
path: ../scripts/source/convert-date
commands:
help:
about: Describe this script.
exec:
argv:
- bash
- -lc
- 'cat <<''EOF''
convert-date
A script for automated tasks.
EOF
'
run:
about: Run the script (inlined); forwards args.
exec:
argv:
- bash
- -lc
- "set -euo pipefail\ntmpdir=\"$(mktemp -d)\"\ntrap 'rm -rf \"$tmpdir\"\
' EXIT\ncat >\"$tmpdir/_convert-date\" <<'JAN_EOF_convert_date__convert_date_54cda4144f2e'\n\
#compdef convert-date\n\n# Zsh completion for convert-date\n# Generated\
\ automatically - customize as needed\n\n_convert-date() {\n local\
\ context state line\n typeset -A opt_args\n \n _arguments -C\
\ \\\n '(-h --help)'{-h,--help}'[Show help information]' \\\n \
\ '(-v --version)'{-v,--version}'[Show version information]' \\\n\
\ '*::arg:_files'\n}\n\n_convert-date \"$@\"\nJAN_EOF_convert_date__convert_date_54cda4144f2e\n\
chmod +x \"$tmpdir/_convert-date\" 2>/dev/null || true\ncat >\"$tmpdir/convert-date.lua\"\
\ <<'JAN_EOF_convert_date_convert_date_lua_da2232c0e00c'\nlocal DateConverter\
\ = {}\n\n-- Month map for converting month names to numeric format\n\
DateConverter.month_map = {\n January = \"01\",\n February = \"\
02\",\n March = \"03\",\n April = \"04\",\n May = \"05\",\n \
\ June = \"06\",\n July = \"07\",\n August = \"08\",\n September\
\ = \"09\",\n October = \"10\",\n November = \"11\",\n December\
\ = \"12\"\n}\n\n-- Function to convert the date\nfunction DateConverter.convert_date(date_string)\n\
\ -- Split the input into components\n local month, day, year =\
\ date_string:match(\"(%a+)%s(%d+),%s(%d+)\")\n if month and day and\
\ year then\n local month_number = DateConverter.month_map[month]\n\
\ if month_number then\n -- Format the date as YYYY-MM-DD\n\
\ return string.format(\"%s-%s-%02d\", year, month_number,\
\ tonumber(day))\n else\n return nil, \"Invalid month\
\ name: \" .. month\n end\n else\n return nil, \"Invalid\
\ date format. Expected format: 'Month Day, Year' (e.g., 'October 20,\
\ 1999').\"\n end\nend\n\n-- CLI handling\nlocal function main()\n\
\ -- Get the input date from the command-line arguments\n local\
\ args = {...}\n if #args == 1 then\n local input_date = args[1]\n\
\ local converted_date, err = DateConverter.convert_date(input_date)\n\
\ if converted_date then\n print(\"Converted date: \"\
\ .. converted_date)\n else\n io.stderr:write(\"Error:\
\ \" .. err .. \"\\n\")\n end\n else\n io.stderr:write(\"\
Usage: lua convert_date.lua \\\"Month Day, Year\\\"\\n\")\n end\nend\n\
\n-- Run the script\nmain\nJAN_EOF_convert_date_convert_date_lua_da2232c0e00c\n\
chmod +x \"$tmpdir/convert-date.lua\" 2>/dev/null || true\ncd \"$tmpdir\"\
\nexec \"$tmpdir/convert-date.lua\" \"$@\"\n"
passthrough: true
convert_date:
about: A script for automated tasks.
path: ../scripts/source/convert_date
commands:
help:
about: Describe this script.
exec:
argv:
- bash
- -lc
- 'cat <<''EOF''
convert_date
A script for automated tasks.
EOF
'
run:
about: Run the script (inlined); forwards args.
exec:
argv:
- bash
- -lc
- "set -euo pipefail\ntmpdir=\"$(mktemp -d)\"\ntrap 'rm -rf \"$tmpdir\"\
' EXIT\ncat >\"$tmpdir/_convert_date\" <<'JAN_EOF_convert_date__convert_date_9ab96812f694'\n\
#compdef convert_date\n\n# Zsh completion for convert_date\n# Generated\
\ automatically - customize as needed\n\n_convert_date() {\n local\
\ context state line\n typeset -A opt_args\n \n _arguments -C\
\ \\\n '(-h --help)'{-h,--help}'[Show help information]' \\\n \
\ '(-v --version)'{-v,--version}'[Show version information]' \\\n\
\ '*::arg:_files'\n}\n\n_convert_date \"$@\"\nJAN_EOF_convert_date__convert_date_9ab96812f694\n\
chmod +x \"$tmpdir/_convert_date\" 2>/dev/null || true\ncat >\"$tmpdir/convert_date.exs\"\
\ <<'JAN_EOF_convert_date_convert_date_exs_b40c3752294d'\n#!/usr/bin/env\
\ elixir\n\ndefmodule DateConverter do\n @month_map %{\n \"January\"\
\ => \"01\",\n \"February\" => \"02\",\n \"March\" => \"03\",\n\
\ \"April\" => \"04\",\n \"May\" => \"05\",\n \"June\" => \"\
06\",\n \"July\" => \"07\",\n \"August\" => \"08\",\n \"September\"\
\ => \"09\",\n \"October\" => \"10\",\n \"November\" => \"11\",\n\
\ \"December\" => \"12\"\n }\n\n def convert_date(date_string) do\n\
\ case String.split(date_string, \" \") do\n [month, day_and_comma,\
\ year] ->\n day = String.trim_trailing(day_and_comma, \",\")\n\
\ month_number = Map.get(@month_map, month)\n\n if month_number\
\ do\n {:ok, \"#{year}-#{month_number}-#{String.pad_leading(day,\
\ 2, \"0\")}\"}\n else\n {:error, \"Invalid month name:\
\ #{month}\"}\n end\n\n _ ->\n {:error, \"Invalid date\
\ format. Expected format: 'Month Day, Year' (e.g., 'October 20, 1999').\"\
}\n end\n end\nend\n\ndefmodule CLI do\n def main(args) do\n case\
\ args do\n [date_string] ->\n case DateConverter.convert_date(date_string)\
\ do\n {:ok, converted_date} ->\n IO.puts(converted_date)\n\
\n {:error, message} ->\n IO.puts(:stderr, \"Error:\
\ #{message}\")\n end\n\n _ ->\n IO.puts(:stderr, \"\
Usage: elixir convert_date.exs \\\"Month Day, Year\\\"\")\n end\n \
\ end\nend\n\n# Entrypoint\nCLI.main(System.argv())\nJAN_EOF_convert_date_convert_date_exs_b40c3752294d\n\
chmod +x \"$tmpdir/convert_date.exs\" 2>/dev/null || true\ncd \"$tmpdir\"\
\nexec \"$tmpdir/convert_date.exs\" \"$@\"\n"
passthrough: true
crossview_to_parallel:
about: A script for automated tasks.
path: ../scripts/source/crossview_to_parallel
commands:
help:
about: Describe this script.
exec:
argv:
- bash
- -lc
- 'cat <<''EOF''
crossview_to_parallel
A script for automated tasks.
EOF
'
run:
about: Run the script (inlined); forwards args.
exec:
argv:
- bash
- -lc
- "set -euo pipefail\ntmpdir=\"$(mktemp -d)\"\ntrap 'rm -rf \"$tmpdir\"\
' EXIT\ncat >\"$tmpdir/_crossview_to_parallel\" <<'JAN_EOF_crossview_to_parallel__crossview_to_parallel_bf0d4559b71e'\n\
#compdef crossview_to_parallel\n\n# Zsh completion for crossview_to_parallel\n\
# Generated automatically - customize as needed\n\n_crossview_to_parallel()\
\ {\n local context state line\n typeset -A opt_args\n \n \
\ _arguments -C \\\n '(-h --help)'{-h,--help}'[Show help information]'\
\ \\\n '(-v --version)'{-v,--version}'[Show version information]'\
\ \\\n '*::arg:_files'\n}\n\n_crossview_to_parallel \"$@\"\nJAN_EOF_crossview_to_parallel__crossview_to_parallel_bf0d4559b71e\n\
chmod +x \"$tmpdir/_crossview_to_parallel\" 2>/dev/null || true\ncat >\"\
$tmpdir/crossview_to_parallel.sh\" <<'JAN_EOF_crossview_to_parallel_crossview_to_parallel_sh_0d0d2dbd2663'\n\
#!/bin/bash\n\nconvert \"$1\" -crop 2x1@ +repage +adjoin out.png\nmontage\
\ -mode concatenate -tile 2x1@ $(ls -1 out* | sort -r) mon-out.png\nJAN_EOF_crossview_to_parallel_crossview_to_parallel_sh_0d0d2dbd2663\n\
chmod +x \"$tmpdir/crossview_to_parallel.sh\" 2>/dev/null || true\ncd\
\ \"$tmpdir\"\nexec \"$tmpdir/crossview_to_parallel.sh\" \"$@\"\n"
passthrough: true
curr:
about: A script for automated tasks.
path: ../scripts/source/curr
commands:
help:
about: Describe this script.
exec:
argv:
- bash
- -lc
- 'cat <<''EOF''
curr
A script for automated tasks.
EOF
'
run:
about: Run the script (inlined); forwards args.
exec:
argv:
- bash
- -lc
- "set -euo pipefail\ntmpdir=\"$(mktemp -d)\"\ntrap 'rm -rf \"$tmpdir\"\
' EXIT\ncat >\"$tmpdir/_curr\" <<'JAN_EOF_curr__curr_e0a2182e2a87'\n#compdef\
\ curr\n\n# Zsh completion for curr\n# Generated automatically - customize\
\ as needed\n\n_curr() {\n local context state line\n typeset -A\
\ opt_args\n \n _arguments -C \\\n '(-h --help)'{-h,--help}'[Show\
\ help information]' \\\n '(-v --version)'{-v,--version}'[Show\
\ version information]' \\\n '*::arg:_files'\n}\n\n_curr \"$@\"\
\nJAN_EOF_curr__curr_e0a2182e2a87\nchmod +x \"$tmpdir/_curr\" 2>/dev/null\
\ || true\ncat >\"$tmpdir/curr.sh\" <<'JAN_EOF_curr_curr_sh_66da8ab3d6ab'\n\
#!/bin/bash \n# (c) 2022 Pat Beagan: MIT License\n\ncurr () \n{ \n \
\ git fetch && git branch -a | grep --color=auto release-v | sed 's/remotes\\\
/origin\\///g' | sort | tail -1 | sed 's/\\*//g'\n}\ncurr \"$@\"\nJAN_EOF_curr_curr_sh_66da8ab3d6ab\n\
chmod +x \"$tmpdir/curr.sh\" 2>/dev/null || true\ncd \"$tmpdir\"\nexec\
\ \"$tmpdir/curr.sh\" \"$@\"\n"
passthrough: true
deeplink:
about: A script for automated tasks.
path: ../scripts/source/deeplink
commands:
help:
about: Describe this script.
exec:
argv:
- bash
- -lc
- 'cat <<''EOF''
deeplink
A script for automated tasks.
EOF
'
run:
about: Run the script (inlined); forwards args.
exec:
argv:
- bash
- -lc
- "set -euo pipefail\ntmpdir=\"$(mktemp -d)\"\ntrap 'rm -rf \"$tmpdir\"\
' EXIT\ncat >\"$tmpdir/_deeplink\" <<'JAN_EOF_deeplink__deeplink_165bf83a765e'\n\
#compdef deeplink\n\n# Zsh completion for deeplink\n# Generated automatically\
\ - customize as needed\n\n_deeplink() {\n local context state line\n\
\ typeset -A opt_args\n \n _arguments -C \\\n '(-h --help)'{-h,--help}'[Show\
\ help information]' \\\n '(-v --version)'{-v,--version}'[Show\
\ version information]' \\\n '*::arg:_files'\n}\n\n_deeplink \"\
$@\"\nJAN_EOF_deeplink__deeplink_165bf83a765e\nchmod +x \"$tmpdir/_deeplink\"\
\ 2>/dev/null || true\ncat >\"$tmpdir/deeplink.sh\" <<'JAN_EOF_deeplink_deeplink_sh_c5d54a1deb76'\n\
#!/bin/bash \n# (c) 2022 Pat Beagan: MIT License\n\ndeeplink () \n{ \n\
\ adb shell am start -a android.intent.action.VIEW -d \"$1\"\n}\ndeeplink\
\ \"$@\"\nJAN_EOF_deeplink_deeplink_sh_c5d54a1deb76\nchmod +x \"$tmpdir/deeplink.sh\"\
\ 2>/dev/null || true\ncd \"$tmpdir\"\nexec \"$tmpdir/deeplink.sh\" \"\
$@\"\n"
passthrough: true
dependencies:
about: A script for automated tasks.
path: ../scripts/source/dependencies
commands:
help:
about: Describe this script.
exec:
argv:
- bash
- -lc
- 'cat <<''EOF''
dependencies
A script for automated tasks.
EOF
'
run:
about: Run the script (inlined); forwards args.
exec:
argv:
- bash
- -lc
- "set -euo pipefail\ntmpdir=\"$(mktemp -d)\"\ntrap 'rm -rf \"$tmpdir\"\
' EXIT\ncat >\"$tmpdir/_dependencies\" <<'JAN_EOF_dependencies__dependencies_2e195529a04d'\n\
#compdef dependencies\n\n# Zsh completion for dependencies\n# Generated\
\ automatically - customize as needed\n\n_dependencies() {\n local\
\ context state line\n typeset -A opt_args\n \n _arguments -C\
\ \\\n '(-h --help)'{-h,--help}'[Show help information]' \\\n \
\ '(-v --version)'{-v,--version}'[Show version information]' \\\n\
\ '*::arg:_files'\n}\n\n_dependencies \"$@\"\nJAN_EOF_dependencies__dependencies_2e195529a04d\n\
chmod +x \"$tmpdir/_dependencies\" 2>/dev/null || true\ncat >\"$tmpdir/dependencies.py\"\
\ <<'JAN_EOF_dependencies_dependencies_py_d1517850e3f0'\n#!/usr/bin/env\
\ python3\n# (c) 2022 Pat Beagan: MIT License\n\nimport os\nimport sys\n\
\n\"\"\"\nShows how classes in a source code package relate to each other\
\ \nby building a graphviz file that shows their dependencies.\n\n1 arg\
\ -> the \"owner\" package name that we should match on. \nEg, for the\
\ \"com.example.util\", you would do \"dependencies.py com.example\"\n\
\"\"\"\n\nprint(\"Running...\")\n\ninput = sys.argv[1]\n\nwith open(\"\
out.dot\", \"w\") as f:\n f.write(\"digraph {\\n\")\n for root,\
\ dirs, files in os.walk(\".\", topdown=False):\n for name in files:\n\
\ if \".kt\" not in name and \".java\" not in name and \".py\"\
\ not in name:\n continue\n fullname = os.path.join(root,\
\ name)\n if \"build/\" in fullname:\n continue\n\
\ print(fullname)\n with open(fullname, \"r\") as\
\ g:\n lines = g.readlines()\n lines = filter(lambda\
\ x: \"import \" in x, lines)\n for line in lines:\n \
\ if \"*\" in line or \"`\" in line or input not in line:\n\
\ continue\n line = line.replace(\"\
import \", \"\")\n line = line.replace(\";\", \"\"\
)\n line = line.replace(\".\", \"_\")\n \
\ line = line.replace(\"-\", \"_\")\n\n fullname\
\ = fullname.replace(\"/\", \".\")\n fullname = fullname.replace(\"\
-\", \"_\")\n fullname = fullname.replace(\".\", \"\
_\")\n f.write(fullname + \" -> \" + line.strip() +\
\ \"[shape=plaintext] ;\\n\")\n f.write(\"}\")\n\nprint(\"Complete.\"\
)\nJAN_EOF_dependencies_dependencies_py_d1517850e3f0\nchmod +x \"$tmpdir/dependencies.py\"\
\ 2>/dev/null || true\ncd \"$tmpdir\"\nexec \"$tmpdir/dependencies.py\"\
\ \"$@\"\n"
passthrough: true
discover-brute-force:
about: A script for automated tasks.
path: ../scripts/source/discover-brute-force
commands:
help:
about: Describe this script.
exec:
argv:
- bash
- -lc
- 'cat <<''EOF''
discover-brute-force
A script for automated tasks.
EOF
'
run:
about: Run the script (inlined); forwards args.
exec:
argv:
- bash
- -lc
- "set -euo pipefail\ntmpdir=\"$(mktemp -d)\"\ntrap 'rm -rf \"$tmpdir\"\
' EXIT\ncat >\"$tmpdir/_discover-brute-force\" <<'JAN_EOF_discover_brute_force__discover_brute_force_c1c178af7709'\n\
#compdef discover-brute-force\n\n# Zsh completion for discover-brute-force\n\
# Generated automatically - customize as needed\n\n_discover-brute-force()\
\ {\n local context state line\n typeset -A opt_args\n \n \
\ _arguments -C \\\n '(-h --help)'{-h,--help}'[Show help information]'\
\ \\\n '(-v --version)'{-v,--version}'[Show version information]'\
\ \\\n '*::arg:_files'\n}\n\n_discover-brute-force \"$@\"\nJAN_EOF_discover_brute_force__discover_brute_force_c1c178af7709\n\
chmod +x \"$tmpdir/_discover-brute-force\" 2>/dev/null || true\ncat >\"\
$tmpdir/discover-brute-force.sh\" <<'JAN_EOF_discover_brute_force_discover_brute_force_sh_8e227a02c216'\n\
#!/bin/bash\n# (c) 2022 Pat Beagan: MIT License\n\ndiscover-brute-force\
\ () \n{ \n sudo zcat /var/log/auth.log.*.gz |\\\n awk '/Failed\
\ password/&&!/for invalid user/{a[$9]++}/Failed password for invalid\
\ user/{a[\"*\" $11]++}END{for (i in a) printf \"%6s\\t%s\\n\", a[i],\
\ i|\"sort -n\"}'\n}\n\ndiscover-brute-force \"$@\"\ntrackusage \"$0\"\
\nJAN_EOF_discover_brute_force_discover_brute_force_sh_8e227a02c216\n\
chmod +x \"$tmpdir/discover-brute-force.sh\" 2>/dev/null || true\ncd \"\
$tmpdir\"\nexec \"$tmpdir/discover-brute-force.sh\" \"$@\"\n"
passthrough: true
divide:
about: A script for automated tasks.
path: ../scripts/source/divide
commands:
help:
about: Describe this script.
exec:
argv:
- bash
- -lc
- 'cat <<''EOF''
divide
A script for automated tasks.
EOF
'
run:
about: Run the script (inlined); forwards args.
exec:
argv:
- bash
- -lc
- "set -euo pipefail\ntmpdir=\"$(mktemp -d)\"\ntrap 'rm -rf \"$tmpdir\"\
' EXIT\ncat >\"$tmpdir/_divide\" <<'JAN_EOF_divide__divide_dd27437235a5'\n\
#compdef divide\n\n# Zsh completion for divide\n# Generated automatically\
\ - customize as needed\n\n_divide() {\n local context state line\n\
\ typeset -A opt_args\n \n _arguments -C \\\n '(-h --help)'{-h,--help}'[Show\
\ help information]' \\\n '(-v --version)'{-v,--version}'[Show\
\ version information]' \\\n '*::arg:_files'\n}\n\n_divide \"$@\"\
\nJAN_EOF_divide__divide_dd27437235a5\nchmod +x \"$tmpdir/_divide\" 2>/dev/null\
\ || true\ncat >\"$tmpdir/divide.sh\" <<'JAN_EOF_divide_divide_sh_791b3733edbd'\n\
#!/usr/bin/env zsh\n# (c) 2022 Pat Beagan: MIT License\n\nset -euo pipefail\n\
IFS=$'\\n\\t'\n\nscriptname=\"$(basename \"$0\")\"\n\nhelp () {\n error_code=$?\n\
\ echo \"\nUsage: $scriptname [-h|--help] <file> <pattern>\n\nDivides\
\ a file into two parts based on a pattern match.\nCreates two new files:\
\ <file>.first (matching lines) and <file>.second (non-matching lines).\n\
\nArguments:\n file Input file to divide\n pattern Pattern to\
\ match (case-insensitive)\n\nExamples:\n $scriptname data.txt error\
\ # Creates data.txt.first and data.txt.second\n $scriptname\
\ log.txt WARNING # Separates warning and non-warning lines\n\"\
\n exit $error_code\n}\n\ndivide () {\n\tcat \"$1\" | grep -i \"$2\"\
\ > \"$1\".first\n\tcat \"$1\" | grep -iv \"$2\" > \"$1\".second\n}\n\n\
divide \"$@\" || help\ntrackusage \"$0\"\nJAN_EOF_divide_divide_sh_791b3733edbd\n\
chmod +x \"$tmpdir/divide.sh\" 2>/dev/null || true\ncd \"$tmpdir\"\nexec\
\ \"$tmpdir/divide.sh\" \"$@\"\n"
passthrough: true
dota-timer:
about: A script for automated tasks.
path: ../scripts/source/dota-timer
commands:
help:
about: Describe this script.
exec:
argv:
- bash
- -lc
- 'cat <<''EOF''
dota-timer
A script for automated tasks.
EOF
'
run:
about: Run the script (inlined); forwards args.
exec:
argv:
- bash
- -lc
- "set -euo pipefail\ntmpdir=\"$(mktemp -d)\"\ntrap 'rm -rf \"$tmpdir\"\
' EXIT\ncat >\"$tmpdir/_dota-timer\" <<'JAN_EOF_dota_timer__dota_timer_3c9d11f0295d'\n\
#compdef dota-timer\n\n# Zsh completion for dota-timer\n# Generated automatically\
\ - customize as needed\n\n_dota-timer() {\n local context state line\n\
\ typeset -A opt_args\n \n _arguments -C \\\n '(-h --help)'{-h,--help}'[Show\
\ help information]' \\\n '(-v --version)'{-v,--version}'[Show\
\ version information]' \\\n '*::arg:_files'\n}\n\n_dota-timer\
\ \"$@\"\nJAN_EOF_dota_timer__dota_timer_3c9d11f0295d\nchmod +x \"$tmpdir/_dota-timer\"\
\ 2>/dev/null || true\ncat >\"$tmpdir/dota-timer.sh\" <<'JAN_EOF_dota_timer_dota_timer_sh_b4a51c257931'\n\
#!/bin/bash\n\n# Function to handle text-to-speech based on the operating\
\ system\ntext_to_speech() {\n local message=$1\n echo \"$message\"\
\n if [[ \"$OSTYPE\" == \"darwin\"* ]]; then\n say \"$message\"\
\n elif [[ \"$OSTYPE\" == \"linux-gnu\"* ]]; then\n spd-say\
\ \"$message\"\n elif [[ \"$OSTYPE\" == \"msys\" || \"$OSTYPE\" ==\
\ \"cygwin\" || \"$OSTYPE\" == \"win32\" ]]; then\n powershell\
\ -Command \"Add-Type -AssemblyName System.speech; \\$speak = New-Object\
\ System.Speech.Synthesis.SpeechSynthesizer; \\$speak.Speak('$message')\"\
\n else\n echo \"Text-to-speech not supported on this OS.\"\n\
\ fi\n}\n\n# Function to announce an event after a delay\nannounce_event()\
\ {\n local delay=$1\n local message=$2\n sleep $delay\n text_to_speech\
\ \"$message\"\n}\n\n# Main function to start the timer\nstart_dota_timer()\
\ {\n echo \"Starting Dota timer...\"\n\n # Day/Night cycle events\
\ (every 5 minutes)\n for i in {1..12}; do\n local time=$((i\
\ * 300 + 5))\n if ((i % 2 == 1)); then\n announce_event\
\ $time \"Daytime. $((i / 2 + 1)) minutes remaining until night.\" &\n\
\ else\n announce_event $time \"Nighttime. $((i / 2))\
\ minutes remaining until day.\" &\n fi\n done\n\n # Neutral\
\ creep spawn times (every minute starting at 1:00)\n for i in {1..60};\
\ do\n announce_event $((i * 60 + 2)) \"Neutral creeps have spawned.\"\
\ &\n done\n\n # Other important events\n announce_event 0 \"\
Welcome to Dota 2!\" &\n announce_event 10 \"10 seconds have passed.\"\
\ &\n announce_event 60 \"1 minute mark. Check runes!\" &\n announce_event\
\ 240 \"4 minute mark. Power runes will spawn soon.\" &\n announce_event\
\ 300 \"5 minute mark. Siege creeps will spawn soon. Bounty runes are\
\ available!\" &\n announce_event 480 \"8 minute mark. Check Roshan\
\ soon for potential respawn.\" &\n announce_event 600 \"10 minute\
\ mark. Outposts are available!\" &\n announce_event 720 \"12 minute\
\ mark. Power runes will spawn soon.\" &\n announce_event 900 \"15\
\ minute mark. Siege creeps will spawn soon. Check runes!\" &\n \n\
\ # Wait for all events to complete\n wait\n echo \"Dota timer\
\ finished.\"\n}\n\n# Start the timer\nstart_dota_timer\nJAN_EOF_dota_timer_dota_timer_sh_b4a51c257931\n\
chmod +x \"$tmpdir/dota-timer.sh\" 2>/dev/null || true\ncd \"$tmpdir\"\
\nexec \"$tmpdir/dota-timer.sh\" \"$@\"\n"
passthrough: true
double_revert:
about: A script for automated tasks.
path: ../scripts/source/double_revert
commands:
help:
about: Describe this script.
exec:
argv:
- bash
- -lc
- 'cat <<''EOF''
double_revert
A script for automated tasks.
EOF
'
run:
about: Run the script (inlined); forwards args.
exec:
argv:
- bash
- -lc
- "set -euo pipefail\ntmpdir=\"$(mktemp -d)\"\ntrap 'rm -rf \"$tmpdir\"\
' EXIT\ncat >\"$tmpdir/_double_revert\" <<'JAN_EOF_double_revert__double_revert_f3f2f53f16eb'\n\
#compdef double_revert\n\n# Zsh completion for double_revert\n# Generated\
\ automatically - customize as needed\n# Usage: ./double_revert.sh <commit_hash>\n\
\n_double_revert() {\n local context state line\n typeset -A opt_args\n\
\ \n _arguments -C \\\n '(-h --help)'{-h,--help}'[Show help\
\ information]' \\\n '(-v --version)'{-v,--version}'[Show version\
\ information]' \\\n '-e[Custom option]' \\ '*::arg:_files'\n\
}\n\n_double_revert \"$@\"\nJAN_EOF_double_revert__double_revert_f3f2f53f16eb\n\
chmod +x \"$tmpdir/_double_revert\" 2>/dev/null || true\ncat >\"$tmpdir/double_revert.zsh\"\
\ <<'JAN_EOF_double_revert_double_revert_zsh_22bc86f34af5'\n#!/bin/zsh\n\
\n# Usage: ./double_revert <commit_hash>\n\n# Check for commit hash\n\
if [ -z \"$1\" ]; then\n echo \"Usage: $0 <commit_hash>\"\n exit 1\n\
fi\n\nCOMMIT_HASH=$1\n\n# Revert the original commit\necho \"Reverting\
\ commit: $COMMIT_HASH\"\ngit revert --no-edit $COMMIT_HASH\nif [ $? -ne\
\ 0 ]; then\n echo \"Failed to revert $COMMIT_HASH\"\n exit 1\nfi\n\n\
# Get the hash of the revert commit (the latest commit now)\nREVERT_COMMIT=$(git\
\ rev-parse HEAD)\n\n# Revert the revert commit\necho \"Reverting the\
\ revert commit: $REVERT_COMMIT\"\ngit revert --no-edit $REVERT_COMMIT\n\
if [ $? -ne 0 ]; then\n echo \"Failed to revert the revert commit $REVERT_COMMIT\"\
\n exit 1\nfi\n\necho \"Done. Two commits created, no net changes.\"\n\
JAN_EOF_double_revert_double_revert_zsh_22bc86f34af5\nchmod +x \"$tmpdir/double_revert.zsh\"\
\ 2>/dev/null || true\ncd \"$tmpdir\"\nexec \"$tmpdir/double_revert.zsh\"\
\ \"$@\"\n"
passthrough: true
dsl_xml_converter:
about: A script for automated tasks.
path: ../scripts/source/dsl_xml_converter
commands:
help:
about: Describe this script.
exec:
argv:
- bash
- -lc
- 'cat <<''EOF''
dsl_xml_converter
A script for automated tasks.
EOF
'
run:
about: Run the script (inlined); forwards args.
exec:
argv:
- bash
- -lc
- "set -euo pipefail\ntmpdir=\"$(mktemp -d)\"\ntrap 'rm -rf \"$tmpdir\"\
' EXIT\ncat >\"$tmpdir/_dsl_xml_converter\" <<'JAN_EOF_dsl_xml_converter__dsl_xml_converter_e63c7f75ae89'\n\
#compdef dsl_xml_converter\n\n# Zsh completion for dsl_xml_converter\n\
# Generated automatically - customize as needed\n\n_dsl_xml_converter()\
\ {\n local context state line\n typeset -A opt_args\n \n \
\ _arguments -C \\\n '(-h --help)'{-h,--help}'[Show help information]'\
\ \\\n '(-v --version)'{-v,--version}'[Show version information]'\
\ \\\n '*::arg:_files'\n}\n\n_dsl_xml_converter \"$@\"\nJAN_EOF_dsl_xml_converter__dsl_xml_converter_e63c7f75ae89\n\
chmod +x \"$tmpdir/_dsl_xml_converter\" 2>/dev/null || true\ncat >\"$tmpdir/dsl_xml_converter.py\"\
\ <<'JAN_EOF_dsl_xml_converter_dsl_xml_converter_py_184bdd8249c4'\n#!/usr/bin/env\
\ python3\n\nimport argparse\nimport re\nimport xml.etree.ElementTree\
\ as ET\nfrom xml.dom import minidom\n\n# -------- DSL to XML --------\n\
\n\ndef parse_attributes(attr_string):\n attrs = {}\n if attr_string:\n\
\ attr_pairs = re.findall(r'(\\w+)\\s*=\\s*(\"[^\"]*\"|\\d+|\\\
w+)', attr_string)\n for key, value in attr_pairs:\n \
\ if not (value.startswith('\"') and value.endswith('\"')):\n \
\ value = f'\"{value}\"'\n attrs[key] = value\n \
\ return attrs\n\n\ndef dsl_to_xml(lines, indent_level=0):\n xml =\
\ \"\"\n indent = \" \" * indent_level\n\n while lines:\n \
\ line = lines.pop(0).strip()\n if not line:\n continue\n\
\n if line.startswith(\"#\"):\n xml += f\"{indent}<!--\
\ {line[1:].strip()} -->\\n\"\n continue\n\n if re.match(r\"\
^CDATA\\s*\\{\", line):\n cdata_content = \"\"\n \
\ while lines:\n l = lines.pop(0).strip()\n \
\ if l == \"}\":\n break\n match\
\ = re.match(r'\"(.*)\"', l)\n if match:\n \
\ cdata_content += match.group(1)\n xml += f\"{indent}<![CDATA[{cdata_content}]]>\\\
n\"\n continue\n\n match = re.match(r\"(\\w+)\\s*(\\\
([^)]*\\))?\\s*(\\{)?$\", line)\n if match:\n tag =\
\ match.group(1)\n attr_str = match.group(2)\n has_block\
\ = match.group(3) == \"{\"\n attrs = parse_attributes(attr_str[1:-1]\
\ if attr_str else \"\")\n attr_xml = (\n \"\
\ \" + \" \".join(f\"{k}={v}\" for k, v in attrs.items()) if attrs else\
\ \"\"\n )\n\n if has_block:\n xml\
\ += f\"{indent}<{tag}{attr_xml}>\\n\"\n xml += dsl_to_xml(lines,\
\ indent_level + 1)\n xml += f\"{indent}</{tag}>\\n\"\n\
\ else:\n xml += f\"{indent}<{tag}{attr_xml}\
\ />\\n\"\n continue\n\n if line == \"}\":\n \
\ return xml\n\n match = re.match(r'\"(.*)\"', line)\n \
\ if match:\n xml += f\"{indent}{match.group(1)}\\n\"\n\
\ else:\n xml += f\"{indent}{line}\\n\"\n\n return\
\ xml\n\n\ndef validate_dsl_syntax(dsl_string):\n stack = []\n in_quote\
\ = False\n for i, char in enumerate(dsl_string):\n if char\
\ == '\"':\n in_quote = not in_quote\n elif not in_quote:\n\
\ if char == \"{\":\n stack.append(\"{\")\n\
\ elif char == \"}\":\n if not stack or stack.pop()\
\ != \"{\":\n return False, f\"Unmatched closing brace\
\ at position {i}\"\n if in_quote:\n return False, \"Unclosed\
\ quotation mark\"\n if stack:\n return False, \"Unclosed brace(s)\"\
\n return True, \"DSL syntax is valid\"\n\n\ndef validate_xml(xml_string):\n\
\ try:\n ET.fromstring(f\"<root>{xml_string}</root>\")\n \
\ return True, \"XML is valid\"\n except ET.ParseError as e:\n\
\ return False, f\"XML Parse Error: {e}\"\n\n\n# -------- XML to\
\ DSL --------\n\n\ndef xml_to_dsl(elem, indent_level=0):\n indent\
\ = \" \" * indent_level\n dsl = \"\"\n\n # Skip root wrapper if\
\ present\n if elem.tag == \"root\":\n for child in elem:\n\
\ dsl += xml_to_dsl(child, indent_level)\n return dsl\n\
\n attrs = elem.attrib\n attr_str = (\n \"(\" + \", \".join(f\"\
{k}={repr(v)}\" for k, v in attrs.items()) + \")\"\n if attrs\n\
\ else \"\"\n )\n\n children = list(elem)\n has_text =\
\ elem.text and elem.text.strip()\n\n if not children and has_text:\n\
\ dsl += f\"{indent}{elem.tag}{attr_str} {{\"\n dsl += f'\
\ \"{elem.text.strip()}\"'\n dsl += f\"}}\\n\"\n\n elif children\
\ or has_text:\n dsl += f\"{indent}{elem.tag}{attr_str} {{\\n\"\
\n if has_text:\n dsl += f'{indent} \"{elem.text.strip()}\"\
\\n'\n\n for child in children:\n if isinstance(child.tag,\
\ str):\n dsl += xml_to_dsl(child, indent_level + 1)\n\
\ elif child.tag is ET.Comment:\n dsl += f\"\
{indent} # {child.text.strip()}\\n\"\n\n dsl += f\"{indent}}}\\\
n\"\n else:\n dsl += f\"{indent}{elem.tag}{attr_str}()\\n\"\n\
\n return dsl\n\n\ndef replacer(match):\n print(\"replace\")\n \
\ prefix = match.group(1)\n inner = match.group(2)\n return f\"\
{prefix} {{\\n {inner.strip()}\\n}}\"\n\n\ndef expand_single_line_blocks(dsl_code:\
\ str) -> str:\n \"\"\"\n Replaces single-line DSL blocks like `something\
\ { foo() }` with:\n something {\n foo()\n }\n\
\ Only applies to blocks fully contained on a single line.\n \"\"\
\"\n pattern = re.compile(r\"\\s*(\\w+\\s*\\(?[^\\)]*\\)?\\s*)\\{\\\
s*(.*?)\\s*\\}\")\n print(\"expand\")\n\n new_var = pattern.sub(replacer,\
\ dsl_code)\n print(\"expandAfter: \" + new_var)\n return new_var\n\
\n\n# -------- Main Entrypoint --------\n\n\ndef main():\n parser =\
\ argparse.ArgumentParser(description=\"Convert between DSL and XML.\"\
)\n parser.add_argument(\n \"--dsl2xml\",\n nargs=2,\n\
\ metavar=(\"input.dsl\", \"output.xml\"),\n help=\"Convert\
\ DSL to XML\",\n )\n parser.add_argument(\n \"--xml2dsl\"\
,\n nargs=2,\n metavar=(\"input.xml\", \"output.dsl\"),\n\
\ help=\"Convert XML to DSL\",\n )\n args = parser.parse_args()\n\
\n if args.dsl2xml:\n in_file, out_file = args.dsl2xml\n \
\ with open(in_file, \"r\") as f:\n dsl_input = f.read()\n\
\n valid_dsl, msg = validate_dsl_syntax(dsl_input)\n if\
\ not valid_dsl:\n print(\"Error:\", msg)\n return\n\
\n # replace single line dsl functions with multiline ones\n \
\ lines = [expand_single_line_blocks(it) for it in dsl_input.strip().splitlines()]\n\
\n xml_output = dsl_to_xml(lines)\n pretty_xml = minidom.parseString(f\"\
<root>{xml_output}</root>\").toprettyxml(\n indent=\" \"\n\
\ )\n with open(out_file, \"w\") as f:\n f.write(pretty_xml.replace(\"\
<root>\", \"\").replace(\"</root>\", \"\").strip())\n print(f\"\
Converted DSL → XML: {out_file}\")\n\n elif args.xml2dsl:\n \
\ in_file, out_file = args.xml2dsl\n tree = ET.parse(in_file)\n\
\ root = tree.getroot()\n dsl_output = xml_to_dsl(root)\n\
\ with open(out_file, \"w\") as f:\n f.write(dsl_output)\n\
\ print(f\"Converted XML → DSL: {out_file}\")\n\n else:\n \
\ parser.print_help()\n\n\nif __name__ == \"__main__\":\n main()\n\
JAN_EOF_dsl_xml_converter_dsl_xml_converter_py_184bdd8249c4\nchmod +x\
\ \"$tmpdir/dsl_xml_converter.py\" 2>/dev/null || true\ncd \"$tmpdir\"\
\nexec \"$tmpdir/dsl_xml_converter.py\" \"$@\"\n"
passthrough: true
ebook-from:
about: A script for automated tasks.
path: ../scripts/source/ebook-from
commands:
help:
about: Describe this script.
exec:
argv:
- bash
- -lc
- 'cat <<''EOF''
ebook-from
A script for automated tasks.
EOF
'
run:
about: Run the script (inlined); forwards args.
exec:
argv:
- bash
- -lc
- "set -euo pipefail\ntmpdir=\"$(mktemp -d)\"\ntrap 'rm -rf \"$tmpdir\"\
' EXIT\ncat >\"$tmpdir/_ebook-from\" <<'JAN_EOF_ebook_from__ebook_from_08ff32246c98'\n\
#compdef ebook-from\n\n# Zsh completion for ebook-from\n# Generated automatically\
\ - customize as needed\n\n_ebook-from() {\n local context state line\n\
\ typeset -A opt_args\n \n _arguments -C \\\n '(-h --help)'{-h,--help}'[Show\
\ help information]' \\\n '(-v --version)'{-v,--version}'[Show\
\ version information]' \\\n '*::arg:_files'\n}\n\n_ebook-from\
\ \"$@\"\nJAN_EOF_ebook_from__ebook_from_08ff32246c98\nchmod +x \"$tmpdir/_ebook-from\"\
\ 2>/dev/null || true\ncat >\"$tmpdir/ebook-from.sh\" <<'JAN_EOF_ebook_from_ebook_from_sh_8b893ae27f40'\n\
#!/usr/bin/env zsh\n# (c) 2022 Pat Beagan: MIT License\n\nset -euo pipefail\n\
IFS=$'\\n\\t'\n\nscriptname=\"$(basename \"$0\")\"\n\nhelp () {\n error_code=$?\n\
\ echo \"\nUsage: $scriptname [-h|--help] <file>\n\nConverts a text\
\ file into a web-based ebook with simplified prose and webring navigation.\n\
Creates a local web server to view the ebook in a browser.\n\nProcess:\n\
1. Simplifies the prose using simplify-prose\n2. Splits the content into\
\ sections using filesplit.py\n3. Creates HTML pages with webring navigation\n\
4. Starts a local HTTP server to view the ebook\n\nArguments:\n file\
\ Text file to convert to ebook format\n\nExamples:\n $scriptname\
\ book.txt\n $scriptname /path/to/story.txt\n\"\n exit $error_code\n\
}\n\nebook () {\n\tsimplify-prose -p \"$1\" > $1\"\".simplified.txt\n\t\
filesplit.py \"$1\".simplified.txt -------\n cd $(ls -1rt | tail -1)\n\
\ webringify\n cd webring\n pwd\n python3 -m http.server\n\
}\n\nebook \"$@\" || help\ntrackusage \"$0\"\nJAN_EOF_ebook_from_ebook_from_sh_8b893ae27f40\n\
chmod +x \"$tmpdir/ebook-from.sh\" 2>/dev/null || true\ncd \"$tmpdir\"\
\nexec \"$tmpdir/ebook-from.sh\" \"$@\"\n"
passthrough: true
editlast:
about: A script for automated tasks.
path: ../scripts/source/editlast
commands:
help:
about: Describe this script.
exec:
argv:
- bash
- -lc
- 'cat <<''EOF''
editlast
A script for automated tasks.
EOF
'
run:
about: Run the script (inlined); forwards args.
exec:
argv:
- bash
- -lc
- "set -euo pipefail\ntmpdir=\"$(mktemp -d)\"\ntrap 'rm -rf \"$tmpdir\"\
' EXIT\ncat >\"$tmpdir/_editlast\" <<'JAN_EOF_editlast__editlast_0565c6488f08'\n\
#compdef editlast\n\n# Zsh completion for editlast\n# Generated automatically\
\ - customize as needed\n\n_editlast() {\n local context state line\n\
\ typeset -A opt_args\n \n _arguments -C \\\n '(-h --help)'{-h,--help}'[Show\
\ help information]' \\\n '(-v --version)'{-v,--version}'[Show\
\ version information]' \\\n '*::arg:_files'\n}\n\n_editlast \"\
$@\"\nJAN_EOF_editlast__editlast_0565c6488f08\nchmod +x \"$tmpdir/_editlast\"\
\ 2>/dev/null || true\ncat >\"$tmpdir/editlast.sh\" <<'JAN_EOF_editlast_editlast_sh_f2809799c70d'\n\
#!/bin/bash \n# (c) 2022 Pat Beagan: MIT License\n\neditlast () \n{ \n\
\ vi $(find . -type f -printf '%T@ %p\\n' | sort -n | tail -1 | cut\
\ -f2- -d\" \")\n}\n\neditlast \"$@\"\ntrackusage \"$0\"\nJAN_EOF_editlast_editlast_sh_f2809799c70d\n\
chmod +x \"$tmpdir/editlast.sh\" 2>/dev/null || true\ncd \"$tmpdir\"\n\
exec \"$tmpdir/editlast.sh\" \"$@\"\n"
passthrough: true
example-stdin-script:
about: A script for automated tasks.
path: ../scripts/source/example-stdin-script
commands:
help:
about: Describe this script.
exec:
argv:
- bash
- -lc
- 'cat <<''EOF''
example-stdin-script
A script for automated tasks.
EOF
'
run:
about: Run the script (inlined); forwards args.
exec:
argv:
- bash
- -lc
- "set -euo pipefail\ntmpdir=\"$(mktemp -d)\"\ntrap 'rm -rf \"$tmpdir\"\
' EXIT\ncat >\"$tmpdir/_example-stdin-script\" <<'JAN_EOF_example_stdin_script__example_stdin_script_256ee2ffff37'\n\
#compdef example-stdin-script\n\n# Zsh completion for example-stdin-script\n\
# Generated automatically - customize as needed\n\n_example-stdin-script()\
\ {\n local context state line\n typeset -A opt_args\n \n \
\ _arguments -C \\\n '(-h --help)'{-h,--help}'[Show help information]'\
\ \\\n '(-v --version)'{-v,--version}'[Show version information]'\
\ \\\n '*::arg:_files'\n}\n\n_example-stdin-script \"$@\"\nJAN_EOF_example_stdin_script__example_stdin_script_256ee2ffff37\n\
chmod +x \"$tmpdir/_example-stdin-script\" 2>/dev/null || true\ncat >\"\
$tmpdir/example-stdin-script.sh\" <<'JAN_EOF_example_stdin_script_example_stdin_script_sh_93bb9a8b9300'\n\
pr () { echo \"'$(cat /dev/stdin)'\"; }\necho \"$0\" | sed 's/^.*\\///g'\
\ | pr\n\ntrackusage \"$0\"\nJAN_EOF_example_stdin_script_example_stdin_script_sh_93bb9a8b9300\n\
chmod +x \"$tmpdir/example-stdin-script.sh\" 2>/dev/null || true\ncd \"\
$tmpdir\"\nexec \"$tmpdir/example-stdin-script.sh\" \"$@\"\n"
passthrough: true
fe:
about: A script for automated tasks.
path: ../scripts/source/fe
commands:
help:
about: Describe this script.
exec:
argv:
- bash
- -lc
- 'cat <<''EOF''
fe
A script for automated tasks.
Requires on host: fzf, chafa, bat
EOF
'
run:
about: Run the script (inlined); forwards args.
exec:
argv:
- bash
- -lc
- "set -euo pipefail\ntmpdir=\"$(mktemp -d)\"\ntrap 'rm -rf \"$tmpdir\"\
' EXIT\ncat >\"$tmpdir/_fe\" <<'JAN_EOF_fe__fe_5969209d9012'\n#compdef\
\ fe\n\n# Zsh completion for fe\n# Generated automatically - customize\
\ as needed\n\n\n_fe() {\n local context state line\n typeset -A\
\ opt_args\n \n _arguments -C \\\n '(-h --help)'{-h,--help}'[Show\
\ help information]' \\\n '(-v --version)'{-v,--version}'[Show\
\ version information]' \\\n '---[Custom option]' \\\n '-b[Custom\
\ option]' \\\n '-c[Custom option]' \\ '*::arg:_files'\n\
}\n\n_fe \"$@\"\nJAN_EOF_fe__fe_5969209d9012\nchmod +x \"$tmpdir/_fe\"\
\ 2>/dev/null || true\ncat >\"$tmpdir/fe.zsh\" <<'JAN_EOF_fe_fe_zsh_2ac4a6b3027a'\n\
#!/usr/bin/env zsh\n\n# fe.zsh - A Zsh file explorer using fzf, chafa,\
\ and bat.\n# All code is in a single file for easy portability and use.\n\
\n#--- Preview Function ---\n# This function generates the content for\
\ fzf's preview window.\n# It checks the file type and uses the appropriate\
\ tool for a rich preview.\npreview_file() {\n local file_path=\"$1\"\
\n\n # Check if the file exists.\n if [[ ! -e \"$file_path\" ]];\
\ then\n echo \"File not found: $file_path\"\n return 1\n\
\ fi\n\n # Use 'file' to determine the MIME type.\n local mime_type=$(file\
\ --mime-type -b \"$file_path\")\n\n # Handle different file types\
\ based on MIME type.\n case \"$mime_type\" in\n # Image types\n\
\ image/*)\n # Use 'chafa' for image previews.\n \
\ if command -v chafa &> /dev/null; then\n chafa\
\ -s 1 -c 256 \"$file_path\"\n else\n echo \"\
chafa not found. Please install it for image previews.\"\n \
\ echo \"File: $file_path\"\n fi\n ;;\n\n \
\ # Text files (including code, scripts, etc.)\n text/* |\
\ application/json | application/javascript | application/x-shellscript\
\ | application/xml)\n # Use 'bat' for syntax highlighting\
\ if available, otherwise fall back to 'cat'.\n if command\
\ -v bat &> /dev/null; then\n bat --style=full --color=always\
\ \"$file_path\"\n else\n cat \"$file_path\"\
\n fi\n ;;\n\n # PDF documents\n application/pdf)\n\
\ echo \"PDF file: $file_path\"\n echo \"\"\n \
\ echo \"--- Text Preview (first page) ---\"\n if\
\ command -v pdftotext &> /dev/null; then\n pdftotext -q\
\ -l 1 \"$file_path\" - | head -n 50\n else\n \
\ echo \"pdftotext not found. Please install it for PDF previews.\"\n\
\ fi\n ;;\n\n # Archive files (zip, tar,\
\ etc.)\n application/zip | application/x-tar | application/gzip)\n\
\ echo \"Archive file: $file_path\"\n echo \"\"\n\
\ echo \"--- Contents ---\"\n if [[ \"$mime_type\"\
\ == \"application/zip\" ]]; then\n if command -v unzip\
\ &> /dev/null; then\n unzip -l \"$file_path\" | head\
\ -n 20\n else\n echo \"unzip not found.\"\
\n fi\n else # Assume tar/gzip\n \
\ if command -v tar &> /dev/null; then\n tar -tvf\
\ \"$file_path\" | head -n 20\n else\n \
\ echo \"tar not found.\"\n fi\n fi\n \
\ ;;\n\n # Directories\n inode/directory)\n \
\ # List directory contents with 'ls'.\n ls -lAh --color=always\
\ \"$file_path\"\n ;;\n\n # All other file types\n \
\ *)\n echo \"Unknown or binary file.\"\n \
\ echo \"MIME type: $mime_type\"\n ;;\n esac\n}\n\n#---\
\ Main Explorer Function ---\nfe() {\n # Check for necessary commands.\n\
\ if ! command -v fzf &> /dev/null; then\n echo \"Error: fzf\
\ is not installed. Please install fzf to use this script.\"\n \
\ return 1\n fi\n\n # Use a subshell to avoid changing the user's\
\ current directory directly.\n # The 'cd' command within the fzf 'enter'\
\ binding will manage directory changes.\n (\n local start_dir=\"\
${1:-.}\"\n cd \"$start_dir\" || return\n\n while true;\
\ do\n # The fzf command with all its options.\n \
\ local selected_path=$(\n find -L . -maxdepth 4 -print0\
\ | fzf \\\n --ansi \\\n --preview-window=right:50%\
\ \\\n --preview=\"preview_file {}\" \\\n \
\ --layout=reverse \\\n --height=100% \\\n \
\ --bind='ctrl-o:execute(xdg-open {} &> /dev/null &)' \\\n \
\ --bind='enter:execute(\n if [[ -d {} ]];\
\ then\n cd {}\n # Break\
\ the while loop to re-run fzf with the new directory.\n \
\ return\n else\n \
\ xdg-open {}\n fi\n )' \\\n \
\ --color=bg+:#373b41,bg:#202020,fg:#e5e5e5,hl:#5e81ac,fg+:#ffffff,hl+:#5e81ac\
\ \\\n --border=sharp \\\n --header=\"Navigate\
\ with arrows, ENTER to open/change dir, CTRL-O to open in app\"\n \
\ )\n # Exit if the user cancels fzf.\n \
\ if [[ -z \"$selected_path\" ]]; then\n break\n \
\ fi\n done\n )\n}\n\n# Run the function with arguments\
\ passed to the script.\nfe \"$@\"\nJAN_EOF_fe_fe_zsh_2ac4a6b3027a\nchmod\
\ +x \"$tmpdir/fe.zsh\" 2>/dev/null || true\ncd \"$tmpdir\"\nexec \"$tmpdir/fe.zsh\"\
\ \"$@\"\n"
passthrough: true
requires:
- fzf
- chafa
- bat
fix_script:
about: A script for automated tasks.
path: ../scripts/source/fix_script
commands:
help:
about: Describe this script.
exec:
argv:
- bash
- -lc
- 'cat <<''EOF''
fix_script
A script for automated tasks.
EOF
'
run:
about: Run the script (inlined); forwards args.
exec:
argv:
- bash
- -lc
- "set -euo pipefail\ntmpdir=\"$(mktemp -d)\"\ntrap 'rm -rf \"$tmpdir\"\
' EXIT\ncat >\"$tmpdir/_fix_script\" <<'JAN_EOF_fix_script__fix_script_126684bba677'\n\
#compdef fix_script\n\n# Zsh completion for fix_script\n# Generated automatically\
\ - customize as needed\n\n_fix_script() {\n local context state line\n\
\ typeset -A opt_args\n \n _arguments -C \\\n '(-h --help)'{-h,--help}'[Show\
\ help information]' \\\n '(-v --version)'{-v,--version}'[Show\
\ version information]' \\\n '*::arg:_files'\n}\n\n_fix_script\
\ \"$@\"\nJAN_EOF_fix_script__fix_script_126684bba677\nchmod +x \"$tmpdir/_fix_script\"\
\ 2>/dev/null || true\ncat >\"$tmpdir/fix_script.sh\" <<'JAN_EOF_fix_script_fix_script_sh_8c8d7e6ac192'\n\
#!/bin/bash \n# (c) 2022 Pat Beagan: MIT License\n\nfix_script () \n{\
\ \n for i in *;\n do\n echo >> $i;\n echo $(echo\
\ $i | cut -d'.' -f1) '\"$@\"' >> $i;\n done\n}\n\nfix_script \"$@\"\
\ntrackusage \"$0\"\nJAN_EOF_fix_script_fix_script_sh_8c8d7e6ac192\nchmod\
\ +x \"$tmpdir/fix_script.sh\" 2>/dev/null || true\ncd \"$tmpdir\"\nexec\
\ \"$tmpdir/fix_script.sh\" \"$@\"\n"
passthrough: true
format-longbash:
about: A script for automated tasks.
path: ../scripts/source/format-longbash
commands:
help:
about: Describe this script.
exec:
argv:
- bash
- -lc
- 'cat <<''EOF''
format-longbash
A script for automated tasks.
EOF
'
run:
about: Run the script (inlined); forwards args.
exec:
argv:
- bash
- -lc
- "set -euo pipefail\ntmpdir=\"$(mktemp -d)\"\ntrap 'rm -rf \"$tmpdir\"\
' EXIT\ncat >\"$tmpdir/_format-longbash\" <<'JAN_EOF_format_longbash__format_longbash_c6366278b5e2'\n\
#compdef format-longbash\n\n# Zsh completion for format-longbash\n# Generated\
\ automatically - customize as needed\n\n_format-longbash() {\n local\
\ context state line\n typeset -A opt_args\n \n _arguments -C\
\ \\\n '(-h --help)'{-h,--help}'[Show help information]' \\\n \
\ '(-v --version)'{-v,--version}'[Show version information]' \\\n\
\ '*::arg:_files'\n}\n\n_format-longbash \"$@\"\nJAN_EOF_format_longbash__format_longbash_c6366278b5e2\n\
chmod +x \"$tmpdir/_format-longbash\" 2>/dev/null || true\ncat >\"$tmpdir/format-longbash.js\"\
\ <<'JAN_EOF_format_longbash_format_longbash_js_25280323c9c2'\n#!/usr/bin/env\
\ node\n\nfunction splitBashCommand(bashCommand) {\n const regex =\
\ /(?:[^\\s\"']+|\"[^\"]*\"|'[^']*')+/g;\n const args = bashCommand.match(regex)\
\ || [];\n return args;\n }\n \n function joinArgsWithBackslashNewline(args)\
\ {\n const result = args.reduce((acc, arg, index) => {\n if (arg\
\ === '|') {\n return acc.trim() + ' \\\\\\n ' + arg;\n }\n\
\ if (index > 0 && args[index - 1] === '|') {\n return acc\
\ + ' ' + arg;\n }\n if (index > 0 && arg.startsWith('-')) {\n\
\ return acc + ' \\\\\\n ' + arg;\n }\n if (index >\
\ 0) {\n return acc + ' ' + arg;\n }\n return acc + arg;\n\
\ }, '');\n \n return result;\n }\n \n function formatBashCommand(bashCommand)\
\ {\n const argsArray = splitBashCommand(bashCommand);\n return\
\ joinArgsWithBackslashNewline(argsArray);\n }\n \n // Check if there\
\ is an argument provided\n if (process.argv.length < 3) {\n console.error('Error:\
\ Please provide a bash command as an argument.');\n process.exit(1);\n\
\ }\n \n const bashCommand = process.argv[2];\n const result = formatBashCommand(bashCommand);\n\
\ console.log(result);\n \nJAN_EOF_format_longbash_format_longbash_js_25280323c9c2\n\
chmod +x \"$tmpdir/format-longbash.js\" 2>/dev/null || true\ncd \"$tmpdir\"\
\nexec \"$tmpdir/format-longbash.js\" \"$@\"\n"
passthrough: true
fullbackup:
about: A script for automated tasks.
path: ../scripts/source/fullbackup
commands:
help:
about: Describe this script.
exec:
argv:
- bash
- -lc
- 'cat <<''EOF''
fullbackup
A script for automated tasks.
EOF
'
run:
about: Run the script (inlined); forwards args.
exec:
argv:
- bash
- -lc
- "set -euo pipefail\ntmpdir=\"$(mktemp -d)\"\ntrap 'rm -rf \"$tmpdir\"\
' EXIT\ncat >\"$tmpdir/_fullbackup\" <<'JAN_EOF_fullbackup__fullbackup_05be125ce7b7'\n\
#compdef fullbackup\n\n# Zsh completion for fullbackup\n# Generated automatically\
\ - customize as needed\n\n_fullbackup() {\n local context state line\n\
\ typeset -A opt_args\n \n _arguments -C \\\n '(-h --help)'{-h,--help}'[Show\
\ help information]' \\\n '(-v --version)'{-v,--version}'[Show\
\ version information]' \\\n '*::arg:_files'\n}\n\n_fullbackup\
\ \"$@\"\nJAN_EOF_fullbackup__fullbackup_05be125ce7b7\nchmod +x \"$tmpdir/_fullbackup\"\
\ 2>/dev/null || true\ncat >\"$tmpdir/fullbackup.sh\" <<'JAN_EOF_fullbackup_fullbackup_sh_35ff83121a4d'\n\
#!/bin/bash \n# (c) 2022 Pat Beagan: MIT License\n\ntrackusage \"$0\"\n\
\nif [ $# -eq 0 ] || [ $1 == \"help\" ]; then \ncat <<END\n\nThis script\
\ is an rsync wrapper. \nfullbackup {options} {destination}\n\nIt pulls:\
\ | It excludes:\n------------------------------------\n/home\
\ | ~/.steam\n/etc | ~/.cache\ninstalled_commands\
\ | ~/.config\n\nIf no flags are passed, -aPz will be used.\n\nEND\n\
exit\nfi\n\necho $(ls /usr/*bin) $(ls /usr/local/*bin) > /tmp/installed_commands\n\
if [ $# -eq 2 ]; then\n\toptions=$1\n\tshift\nfi\nif [ ! -e $1 ]; then\
\ mkdir $1; fi\nif [ -z $options ]; then options=\"-aPz\"; fi\n\necho\
\ 0$0 1$1 2$2\necho $options\necho\n\nrsync $options --info=progress2\
\ --info=name0 --exclude ~/.steam --exclude ~/.cache --exclude ~/.config\
\ /home /etc /tmp/installed_commands $1 2>fullbackup_errors.log\n\ncat\
\ fullbackup_errors.log\nJAN_EOF_fullbackup_fullbackup_sh_35ff83121a4d\n\
chmod +x \"$tmpdir/fullbackup.sh\" 2>/dev/null || true\ncd \"$tmpdir\"\
\nexec \"$tmpdir/fullbackup.sh\" \"$@\"\n"
passthrough: true
gallery:
about: A script for automated tasks.
path: ../scripts/source/gallery
commands:
help:
about: Describe this script.
exec:
argv:
- bash
- -lc
- 'cat <<''EOF''
gallery
A script for automated tasks.
EOF
'
run:
about: Run the script (inlined); forwards args.
exec:
argv:
- bash
- -lc
- "set -euo pipefail\ntmpdir=\"$(mktemp -d)\"\ntrap 'rm -rf \"$tmpdir\"\
' EXIT\ncat >\"$tmpdir/_gallery\" <<'JAN_EOF_gallery__gallery_499020260fcc'\n\
#compdef gallery\n\n# Zsh completion for gallery\n# Generated automatically\
\ - customize as needed\n\n_gallery() {\n local context state line\n\
\ typeset -A opt_args\n \n _arguments -C \\\n '(-h --help)'{-h,--help}'[Show\
\ help information]' \\\n '(-v --version)'{-v,--version}'[Show\
\ version information]' \\\n '*::arg:_files'\n}\n\n_gallery \"\
$@\"\nJAN_EOF_gallery__gallery_499020260fcc\nchmod +x \"$tmpdir/_gallery\"\
\ 2>/dev/null || true\ncat >\"$tmpdir/gallery.sh\" <<'JAN_EOF_gallery_gallery_sh_229c04a9526b'\n\
#!/bin/bash\n# (c) 2022 Pat Beagan: MIT License\n\nfilename=\"index.html\"\
\n\necho > \"$filename\"\n\necho '<div>' >> \"$filename\"\nfor i in $(find\
\ -L . \\( ! -regex '.*/\\..*' \\) -type f -prune); do\necho \"<a href=\\\
\"$i\\\"><img src=\\\"$i\\\" loading=\\\"lazy\\\"></a>\" >> \"$filename\"\
\ndone\necho '</div>' >> \"$filename\"\n\ncat <<EOF >> \"$filename\"\n\
<style>\nimg {\n background-color: #eee;\n display: inline-block;\n\
\ margin: 0 0 1em;\n max-width: 24%;\n max-height:50%;\n}\n\n\
img:hover {\n -webkit-transform:scale(1.25); /* Safari and Chrome */\n\
\ -moz-transform:scale(1.25); /* Firefox */\n -ms-transform:scale(1.25);\
\ /* IE 9 */\n -o-transform:scale(1.25); /* Opera */\n transform:scale(1.25);\n\
}\n</style>\nEOF\n\ntrackusage \"$0\"\nJAN_EOF_gallery_gallery_sh_229c04a9526b\n\
chmod +x \"$tmpdir/gallery.sh\" 2>/dev/null || true\ncd \"$tmpdir\"\n\
exec \"$tmpdir/gallery.sh\" \"$@\"\n"
passthrough: true
getbranch:
about: A script for automated tasks.
path: ../scripts/source/getbranch
commands:
help:
about: Describe this script.
exec:
argv:
- bash
- -lc
- 'cat <<''EOF''
getbranch
A script for automated tasks.
EOF
'
run:
about: Run the script (inlined); forwards args.
exec:
argv:
- bash
- -lc
- "set -euo pipefail\ntmpdir=\"$(mktemp -d)\"\ntrap 'rm -rf \"$tmpdir\"\
' EXIT\ncat >\"$tmpdir/_getbranch\" <<'JAN_EOF_getbranch__getbranch_dffc4ad98d34'\n\
#compdef getbranch\n\n# Zsh completion for getbranch\n# Generated automatically\
\ - customize as needed\n\n_getbranch() {\n local context state line\n\
\ typeset -A opt_args\n \n _arguments -C \\\n '(-h --help)'{-h,--help}'[Show\
\ help information]' \\\n '(-v --version)'{-v,--version}'[Show\
\ version information]' \\\n '*::arg:_files'\n}\n\n_getbranch \"\
$@\"\nJAN_EOF_getbranch__getbranch_dffc4ad98d34\nchmod +x \"$tmpdir/_getbranch\"\
\ 2>/dev/null || true\ncat >\"$tmpdir/getbranch.sh\" <<'JAN_EOF_getbranch_getbranch_sh_aba6894401bf'\n\
#!/bin/bash \n# (c) 2022 Pat Beagan: MIT License\n\ngetbranch () \n{ \n\
\ printf $(git rev-parse --abbrev-ref HEAD)\n}\ngetbranch \"$@\"\n\
JAN_EOF_getbranch_getbranch_sh_aba6894401bf\nchmod +x \"$tmpdir/getbranch.sh\"\
\ 2>/dev/null || true\ncd \"$tmpdir\"\nexec \"$tmpdir/getbranch.sh\" \"\
$@\"\n"
passthrough: true
getimageflavors:
about: A script for automated tasks.
path: ../scripts/source/getimageflavors
commands:
help:
about: Describe this script.
exec:
argv:
- bash
- -lc
- 'cat <<''EOF''
getimageflavors
A script for automated tasks.
EOF
'
run:
about: Run the script (inlined); forwards args.
exec:
argv:
- bash
- -lc
- "set -euo pipefail\ntmpdir=\"$(mktemp -d)\"\ntrap 'rm -rf \"$tmpdir\"\
' EXIT\ncat >\"$tmpdir/_getimageflavors\" <<'JAN_EOF_getimageflavors__getimageflavors_b817f46975f8'\n\
#compdef getimageflavors\n\n# Zsh completion for getimageflavors\n# Generated\
\ automatically - customize as needed\n\n_getimageflavors() {\n local\
\ context state line\n typeset -A opt_args\n \n _arguments -C\
\ \\\n '(-h --help)'{-h,--help}'[Show help information]' \\\n \
\ '(-v --version)'{-v,--version}'[Show version information]' \\\n\
\ '*::arg:_files'\n}\n\n_getimageflavors \"$@\"\nJAN_EOF_getimageflavors__getimageflavors_b817f46975f8\n\
chmod +x \"$tmpdir/_getimageflavors\" 2>/dev/null || true\ncat >\"$tmpdir/getimageflavors.sh\"\
\ <<'JAN_EOF_getimageflavors_getimageflavors_sh_d1617976f621'\n#!/bin/bash\n\
# (c) 2022 Pat Beagan: MIT License\n\ngetgateway () { ag -g $1 }\nrm /tmp/imgoutput.html\n\
for i in $(getgateway $1); do \n echo \"<p>$i</p><img src='file://$(pwd)/$i'\
\ style='width: 100px' />\" >> /tmp/imgoutput.html; \ndone\nopen /tmp/imgoutput.html\n\
JAN_EOF_getimageflavors_getimageflavors_sh_d1617976f621\nchmod +x \"$tmpdir/getimageflavors.sh\"\
\ 2>/dev/null || true\ncd \"$tmpdir\"\nexec \"$tmpdir/getimageflavors.sh\"\
\ \"$@\"\n"
passthrough: true
groceries:
about: A script for automated tasks.
path: ../scripts/source/groceries
commands:
help:
about: Describe this script.
exec:
argv:
- bash
- -lc
- 'cat <<''EOF''
groceries
A script for automated tasks.
EOF
'
run:
about: Run the script (inlined); forwards args.
exec:
argv:
- bash
- -lc
- "set -euo pipefail\ntmpdir=\"$(mktemp -d)\"\ntrap 'rm -rf \"$tmpdir\"\
' EXIT\ncat >\"$tmpdir/_groceries\" <<'JAN_EOF_groceries__groceries_e37ab3eb28a0'\n\
#compdef groceries\n\n# Zsh completion for groceries\n# Generated automatically\
\ - customize as needed\n\n_groceries() {\n local context state line\n\
\ typeset -A opt_args\n \n _arguments -C \\\n '(-h --help)'{-h,--help}'[Show\
\ help information]' \\\n '(-v --version)'{-v,--version}'[Show\
\ version information]' \\\n '*::arg:_files'\n}\n\n_groceries \"\
$@\"\nJAN_EOF_groceries__groceries_e37ab3eb28a0\nchmod +x \"$tmpdir/_groceries\"\
\ 2>/dev/null || true\ncat >\"$tmpdir/groceries.sh\" <<'JAN_EOF_groceries_groceries_sh_3b2ce4a3cd5d'\n\
#!/usr/bin/zsh\n\nfunction q-heb {\nweb-open 'https://www.heb.com/search?Ns=product.salePrice%7C0&q='\"\
$1\"\n\n}\nwhile IFS= read -r line; do q-heb $line; sleep 20; done < \"\
$1\"\nJAN_EOF_groceries_groceries_sh_3b2ce4a3cd5d\nchmod +x \"$tmpdir/groceries.sh\"\
\ 2>/dev/null || true\ncd \"$tmpdir\"\nexec \"$tmpdir/groceries.sh\" \"\
$@\"\n"
passthrough: true
hl:
about: A script for automated tasks.
path: ../scripts/source/hl
commands:
help:
about: Describe this script.
exec:
argv:
- bash
- -lc
- 'cat <<''EOF''
hl
A script for automated tasks.
EOF
'
run:
about: Run the script (inlined); forwards args.
exec:
argv:
- bash
- -lc
- "set -euo pipefail\ntmpdir=\"$(mktemp -d)\"\ntrap 'rm -rf \"$tmpdir\"\
' EXIT\ncat >\"$tmpdir/_hl\" <<'JAN_EOF_hl__hl_2d0e398a1a7a'\n#compdef\
\ hl\n\n# Zsh completion for hl\n# Generated automatically - customize\
\ as needed\n\n_hl() {\n local context state line\n typeset -A opt_args\n\
\ \n _arguments -C \\\n '(-h --help)'{-h,--help}'[Show help\
\ information]' \\\n '(-v --version)'{-v,--version}'[Show version\
\ information]' \\\n '*::arg:_files'\n}\n\n_hl \"$@\"\nJAN_EOF_hl__hl_2d0e398a1a7a\n\
chmod +x \"$tmpdir/_hl\" 2>/dev/null || true\ncat >\"$tmpdir/hl.sh\" <<'JAN_EOF_hl_hl_sh_f3b43ea3361d'\n\
#!/bin/bash \n# (c) 2022 Pat Beagan: MIT License\n\nhl () \n{ \n grep\
\ --color=auto --color -i -E \"$1|$\" \"$2\"\n}\n\nhl \"$@\"\ntrackusage\
\ \"$0\"\nJAN_EOF_hl_hl_sh_f3b43ea3361d\nchmod +x \"$tmpdir/hl.sh\" 2>/dev/null\
\ || true\ncd \"$tmpdir\"\nexec \"$tmpdir/hl.sh\" \"$@\"\n"
passthrough: true
improve-prompt:
about: A script for automated tasks.
path: ../scripts/source/improve-prompt
commands:
help:
about: Describe this script.
exec:
argv:
- bash
- -lc
- 'cat <<''EOF''
improve-prompt
A script for automated tasks.
EOF
'
run:
about: Run the script (inlined); forwards args.
exec:
argv:
- bash
- -lc
- "set -euo pipefail\ntmpdir=\"$(mktemp -d)\"\ntrap 'rm -rf \"$tmpdir\"\
' EXIT\ncat >\"$tmpdir/_improve-prompt\" <<'JAN_EOF_improve_prompt__improve_prompt_94616694974b'\n\
#compdef improve-prompt\n\n# Zsh completion for improve-prompt\n# Generated\
\ automatically - customize as needed\n\n_improve-prompt() {\n local\
\ context state line\n typeset -A opt_args\n \n _arguments -C\
\ \\\n '(-h --help)'{-h,--help}'[Show help information]' \\\n \
\ '(-v --version)'{-v,--version}'[Show version information]' \\\n\
\ '*::arg:_files'\n}\n\n_improve-prompt \"$@\"\nJAN_EOF_improve_prompt__improve_prompt_94616694974b\n\
chmod +x \"$tmpdir/_improve-prompt\" 2>/dev/null || true\ncat >\"$tmpdir/improve-prompt.sh\"\
\ <<'JAN_EOF_improve_prompt_improve_prompt_sh_b7a22acfe102'\n#!/bin/zsh\n\
\n# ANSI color codes\nRED='\\033[0;31m'\nGREEN='\\033[0;32m'\nYELLOW='\\\
033[1;33m'\nBLUE='\\033[0;34m'\nMAGENTA='\\033[0;35m'\nCYAN='\\033[0;36m'\n\
WHITE='\\033[1;37m'\nGRAY='\\033[0;37m'\nBOLD='\\033[1m'\nUNDERLINE='\\\
033[4m'\nRESET='\\033[0m'\n\n# Check if the number of iterations and the\
\ prompt are provided\nif [[ -z \"$1\" ]] || [[ -z \"$2\" ]]; then\n \
\ echo -e \"${RED}${BOLD}Error:${RESET} Missing required arguments\"\n\
\ echo -e \"${YELLOW}Usage:${RESET} $0 <number_of_iterations> \\\"<prompt_to_improve>\\\
\"\"\n echo -e \"${GRAY}Example:${RESET} $0 3 \\\"Write a story about\
\ a cat\\\"\"\n exit 1\nfi\n\niterations=$1\nprompt_to_improve=$2\n\n\
# Validate iterations is a positive integer\nif ! [[ \"$iterations\" =~\
\ ^[1-9][0-9]*$ ]]; then\n echo -e \"${RED}${BOLD}Error:${RESET} Number\
\ of iterations must be a positive integer\"\n exit 1\nfi\n\n# The system\
\ prompt tells Ollama how to behave.\nsystem_prompt=\"You are an expert\
\ prompt engineer.\nYour task is to take the given latest prompt and improve\
\ it for better results with large language models.\nTake your time, and\
\ consider the weak points in the latest prompt, creating a plan to mitigate\
\ those weaknesses, while enhancing its strengths.\nYou will be given\
\ the original prompt, and the latest prompt.\nThe latest prompt should\
\ be improved while adhering to the intent of the original prompt.\nThe\
\ improved prompt should be more detailed, specific, and provide clearer\
\ instructions.\nYour response should only contain the improved prompt,\
\ with no additional conversational text.\n\"\n\necho -e \"${GRAY}System\
\ Prompt:${RESET}\"\necho -e \"${WHITE}$system_prompt${RESET}\"\necho\
\ -e \"${GRAY}================================${RESET}\"\necho \"\"\n\n\
echo -e \"${CYAN}${BOLD}\U0001F916 Prompt Improvement Tool${RESET}\"\n\
echo -e \"${GRAY}================================${RESET}\"\necho -e \"\
${YELLOW}${BOLD}Original Prompt:${RESET}\"\necho -e \"${WHITE}$prompt_to_improve${RESET}\"\
\necho -e \"${GRAY}================================${RESET}\"\necho \"\
\"\n\n# Loop to iteratively improve the prompt\ncurrent_prompt=$prompt_to_improve\n\
for i in $(seq 1 $iterations); do\n echo -e \"${BLUE}${BOLD}\U0001F504\
\ Iteration $i/$iterations${RESET}\"\n echo -e \"${GRAY}Processing...${RESET}\"\
\n \n # Use Ollama to improve the current prompt\n request=\"$system_prompt\n\
\nOriginal Prompt: \\\"\\\"\\\"$prompt_to_improve\\\"\\\"\\\"\n\nLatest\
\ Prompt: \\\"\\\"\\\"$current_prompt\\\"\\\"\\\"\"\n \n # Show what's\
\ being sent to the model (in plaintext)\n echo -e \"${MAGENTA}${BOLD}\U0001F4E4\
\ Request to Model:${RESET}\"\n echo -e \"${GRAY}$request${RESET}\"\n\
\ echo \"\"\n\n improved_prompt=$(ollama run \"gemma\" \"$request\"\
)\n \n # Print the improved prompt with clear formatting\n echo -e\
\ \"${GREEN}${BOLD}\U0001F4E5 Improved Prompt:${RESET}\"\n echo -e \"\
${WHITE}$improved_prompt${RESET}\"\n echo -e \"${GRAY}================================${RESET}\"\
\n echo \"\"\n \n current_prompt=$improved_prompt\ndone\n\necho -e\
\ \"${GREEN}${BOLD}✅ Final Result${RESET}\"\necho -e \"${GRAY}================================${RESET}\"\
\necho -e \"${WHITE}${BOLD}Final improved prompt after $iterations iterations:${RESET}\"\
\necho -e \"${WHITE}$current_prompt${RESET}\"\necho -e \"${GRAY}================================${RESET}\"\
\nJAN_EOF_improve_prompt_improve_prompt_sh_b7a22acfe102\nchmod +x \"$tmpdir/improve-prompt.sh\"\
\ 2>/dev/null || true\ncd \"$tmpdir\"\nexec \"$tmpdir/improve-prompt.sh\"\
\ \"$@\"\n"
passthrough: true
intensify:
about: creates slack emojis that apply the intensify effect
path: ../scripts/source/intensify
commands:
help:
about: Describe this script.
exec:
argv:
- bash
- -lc
- 'cat <<''EOF''
intensify
creates slack emojis that apply the intensify effect
EOF
'
run:
about: Run the script (inlined); forwards args.
exec:
argv:
- bash
- -lc
- "set -euo pipefail\ntmpdir=\"$(mktemp -d)\"\ntrap 'rm -rf \"$tmpdir\"\
' EXIT\ncat >\"$tmpdir/intensify.sh\" <<'JAN_EOF_intensify_intensify_sh_8ba6156fb211'\n\
#!/bin/bash\n# intensify.sh\n# Author: patrick\n# Created: 2025-10-27\n\
\nset -euo pipefail\n\n# Description: Add your script description here\n\
\nmain() {\n if [[ $# -lt 1 ]]; then\n echo \"Usage: $0 <input_image>\
\ [output_gif]\"\n exit 1\n fi\n\n input_img=\"$1\"\n \
\ output_gif=\"${2:-intensified.gif}\"\n\n if [[ ! -f \"$input_img\"\
\ ]]; then\n echo \"Input file does not exist: $input_img\"\n \
\ exit 1\n fi\n\n # Number of frames and shake amount\n \
\ frames=8\n shake=6\n\n # Create temp directory for frames\n \
\ tmpdir=$(mktemp -d)\n trap 'rm -rf \"$tmpdir\"' EXIT\n\n # Get\
\ input image dimensions\n read width height < <(identify -format \"\
%w %h\" \"$input_img\")\n\n # Generate frames with random offset\n\
\ for i in $(seq 0 $((frames-1))); do\n x_offset=$((RANDOM %\
\ (2 * shake + 1) - shake))\n y_offset=$((RANDOM % (2 * shake +\
\ 1) - shake))\n convert \"$input_img\" -background none -gravity\
\ center -extent \"${width}x${height}\" \\\n -roll \"${x_offset:+$x_offset}${x_offset:+,}${y_offset:+$y_offset}\"\
\ \\\n \"$tmpdir/frame_$i.png\"\n done\n\n # Combine\
\ frames into an animated GIF\n convert -delay 7 -loop 0 \"$tmpdir/frame_\"\
*.png \"$output_gif\"\n\n echo \"Intensified GIF created at: $output_gif\"\
\n}\n\n# Show help\nshow_help() {\n cat << EOF\nUsage: $0 [OPTIONS]\n\
\nintensify.sh - Add description here\n\nOPTIONS:\n -h, --help \
\ Show this help message\n \nEXAMPLES:\n $0\n \nEOF\n}\n\n# Parse\
\ command line arguments\nwhile [[ $# -gt 0 ]]; do\n case $1 in\n \
\ -h|--help)\n show_help\n exit 0\n \
\ ;;\n *)\n echo \"Unknown option: $1\"\n \
\ show_help\n exit 1\n ;;\n esac\ndone\n\
\nmain \"$@\"\nJAN_EOF_intensify_intensify_sh_8ba6156fb211\nchmod +x \"\
$tmpdir/intensify.sh\" 2>/dev/null || true\ncd \"$tmpdir\"\nexec \"$tmpdir/intensify.sh\"\
\ \"$@\"\n"
passthrough: true
isLinux:
about: A script for automated tasks.
path: ../scripts/source/isLinux
commands:
help:
about: Describe this script.
exec:
argv:
- bash
- -lc
- 'cat <<''EOF''
isLinux
A script for automated tasks.
EOF
'
run:
about: Run the script (inlined); forwards args.
exec:
argv:
- bash
- -lc
- "set -euo pipefail\ntmpdir=\"$(mktemp -d)\"\ntrap 'rm -rf \"$tmpdir\"\
' EXIT\ncat >\"$tmpdir/_isLinux\" <<'JAN_EOF_isLinux__isLinux_b1ca5dff3871'\n\
#compdef isLinux\n\n# Zsh completion for isLinux\n# Generated automatically\
\ - customize as needed\n\n_isLinux() {\n local context state line\n\
\ typeset -A opt_args\n \n _arguments -C \\\n '(-h --help)'{-h,--help}'[Show\
\ help information]' \\\n '(-v --version)'{-v,--version}'[Show\
\ version information]' \\\n '*::arg:_files'\n}\n\n_isLinux \"\
$@\"\nJAN_EOF_isLinux__isLinux_b1ca5dff3871\nchmod +x \"$tmpdir/_isLinux\"\
\ 2>/dev/null || true\ncat >\"$tmpdir/isLinux.sh\" <<'JAN_EOF_isLinux_isLinux_sh_a9c1bac0e174'\n\
#!/bin/bash \n# (c) 2022 Pat Beagan: MIT License\n\ntrackusage \"$0\"\n\
exit $(test $(machinetype) == \"Linux\")\nJAN_EOF_isLinux_isLinux_sh_a9c1bac0e174\n\
chmod +x \"$tmpdir/isLinux.sh\" 2>/dev/null || true\ncd \"$tmpdir\"\n\
exec \"$tmpdir/isLinux.sh\" \"$@\"\n"
passthrough: true
isMac:
about: A script for automated tasks.
path: ../scripts/source/isMac
commands:
help:
about: Describe this script.
exec:
argv:
- bash
- -lc
- 'cat <<''EOF''
isMac
A script for automated tasks.
EOF
'
run:
about: Run the script (inlined); forwards args.
exec:
argv:
- bash
- -lc
- "set -euo pipefail\ntmpdir=\"$(mktemp -d)\"\ntrap 'rm -rf \"$tmpdir\"\
' EXIT\ncat >\"$tmpdir/_isMac\" <<'JAN_EOF_isMac__isMac_43a211522d18'\n\
#compdef isMac\n\n# Zsh completion for isMac\n# Generated automatically\
\ - customize as needed\n\n_isMac() {\n local context state line\n\
\ typeset -A opt_args\n \n _arguments -C \\\n '(-h --help)'{-h,--help}'[Show\
\ help information]' \\\n '(-v --version)'{-v,--version}'[Show\
\ version information]' \\\n '*::arg:_files'\n}\n\n_isMac \"$@\"\
\nJAN_EOF_isMac__isMac_43a211522d18\nchmod +x \"$tmpdir/_isMac\" 2>/dev/null\
\ || true\ncat >\"$tmpdir/isMac.sh\" <<'JAN_EOF_isMac_isMac_sh_4429d8e61cc7'\n\
#!/bin/bash \n# (c) 2022 Pat Beagan: MIT License\n\ntrackusage \"$0\"\n\
exit $(test $(machinetype) == \"Mac\")\nJAN_EOF_isMac_isMac_sh_4429d8e61cc7\n\
chmod +x \"$tmpdir/isMac.sh\" 2>/dev/null || true\ncd \"$tmpdir\"\nexec\
\ \"$tmpdir/isMac.sh\" \"$@\"\n"
passthrough: true
issue:
about: A script for automated tasks.
path: ../scripts/source/issue
commands:
help:
about: Describe this script.
exec:
argv:
- bash
- -lc
- 'cat <<''EOF''
issue
A script for automated tasks.
Requires on host: gh, jq, fzf
EOF
'
run:
about: Run the script (inlined); forwards args.
exec:
argv:
- bash
- -lc
- "set -euo pipefail\ntmpdir=\"$(mktemp -d)\"\ntrap 'rm -rf \"$tmpdir\"\
' EXIT\ncat >\"$tmpdir/README copy.md\" <<'JAN_EOF_issue_README_copy_md_a9871b15d05c'\n\
# Zsh Completions\n\nThis directory contains Zsh completion files for\
\ custom scripts.\n\n## Installation\n\n### Option 1: Add to your fpath\
\ (Recommended)\n\nAdd the completions directory to your `$fpath` in your\
\ `.zshrc`:\n\n```zsh\n# Add custom completions to fpath\nfpath=(~/path/to/dotfiles/completions\
\ $fpath)\n\n# Initialize completions\nautoload -Uz compinit && compinit\n\
```\n\n### Option 2: Copy to system completions directory\n\nCopy the\
\ completion files to a system completions directory:\n\n```bash\n# For\
\ user-specific completions\nmkdir -p ~/.local/share/zsh/completions\n\
cp dotfiles/completions/* ~/.local/share/zsh/completions/\n\n# Add to\
\ .zshrc\nfpath=(~/.local/share/zsh/completions $fpath)\nautoload -Uz\
\ compinit && compinit\n```\n\n### Option 3: Source directly\n\nYou can\
\ also source the completion files directly in your `.zshrc`:\n\n```zsh\n\
# Source completions directly\nsource ~/path/to/dotfiles/completions/_issue\n\
```\n\n## Available Completions\n\n### `_issue`\n\nProvides tab completion\
\ for the `issue.zsh` script:\n\n- **Commands**: Complete all available\
\ subcommands (create, list, view, open, edit, comment, close, closeWithCommit)\n\
- **Issue numbers**: When using commands that take issue numbers, provides\
\ completion with issue titles\n- **Labels**: For the `list` command,\
\ provides completion of available repository labels\n\n#### Features\n\
\n- Dynamically fetches open issues from the current repository using\
\ `gh issue list`\n- Displays issue numbers with their titles for easy\
\ identification\n- Provides label completion for filtering issues\n-\
\ Gracefully handles cases where `gh` CLI is not available or not in a\
\ git repository\n\n#### Usage Examples\n\n```bash\nissue <TAB> \
\ # Shows all available commands\nissue view <TAB> \
\ # Shows list of open issues with titles\nissue list <TAB> \
\ # Shows available labels for filtering\nissue edit 1<TAB>\
\ # Completes issue numbers starting with 1\n```\n\n## Adding\
\ New Completions\n\nTo add a new completion file:\n\n1. Create a file\
\ starting with `_` followed by the command name (e.g., `_mycommand`)\n\
2. Use the `#compdef mycommand` directive at the top\n3. Follow the Zsh\
\ completion function patterns shown in existing files\n4. Test the completion\
\ by sourcing the file or restarting your shell\n\n## Requirements\n\n\
- Zsh shell\n- For `_issue`: `gh` CLI tool and `jq` for JSON parsing\n\
- Git repository (for issue-related completions)\nJAN_EOF_issue_README_copy_md_a9871b15d05c\n\
chmod +x \"$tmpdir/README copy.md\" 2>/dev/null || true\ncat >\"$tmpdir/_issue\"\
\ <<'JAN_EOF_issue__issue_588b28642dcf'\n#compdef issue\n\n# Zsh completion\
\ for issue script\n# Place this file in your $fpath (e.g., ~/.local/share/zsh/completions/\
\ or /usr/local/share/zsh/site-functions/)\n\n_issue() {\n local context\
\ state line\n typeset -A opt_args\n\n _arguments \\\n '1: :->command'\
\ \\\n '*: :->args' \\\n && return 0\n\n case $state in\n command)\n\
\ local commands=(\n 'create:Create a new note (opens editor)'\n\
\ 'list:List all open issues, optionally filtering by label'\n\
\ 'view:View a specific note'\n 'open:Open a note in your\
\ web browser'\n 'edit:Edit a specific note'\n 'comment:Add\
\ a comment to a specific note'\n 'label:Add label(s) to a note'\n\
\ 'close:Close a specific note'\n 'closeWithCommit:Commit\
\ all changes and close a selected issue'\n )\n _describe 'commands'\
\ commands\n ;;\n args)\n case $line[1] in\n list)\n\
\ # For list command, provide label completion\n _issue_labels\n\
\ ;;\n view|open|edit|comment|close)\n # For\
\ commands that take issue numbers, provide issue number completion\n\
\ _issue_numbers\n ;;\n label)\n # For\
\ label command, provide issue number completion first, then label completion\n\
\ # This is a bit tricky - we need to handle both issue number\
\ and labels\n # For now, provide issue number completion\n \
\ _issue_numbers\n ;;\n create|closeWithCommit)\n\
\ # These commands don't take arguments\n ;;\n \
\ esac\n ;;\n esac\n}\n\n# Function to complete issue numbers\n\
_issue_numbers() {\n local issues\n local issue_list\n \n # Check\
\ if we're in a git repository and have gh CLI available\n if ! git rev-parse\
\ --is-inside-work-tree >/dev/null 2>&1; then\n return 1\n fi\n \n\
\ if ! command -v gh >/dev/null 2>&1; then\n return 1\n fi\n \n\
\ # Get issue numbers and titles for completion\n # Using the same approach\
\ as the script with --limit 1000\n issue_list=$(gh issue list --state\
\ open --json number,title --limit 1000 2>/dev/null | \\\n jq -r '.[]\
\ | \"\\(.number):\\(.title)\"' 2>/dev/null)\n \n if [[ -n \"$issue_list\"\
\ ]]; then\n local -a issues_array\n while IFS= read -r line; do\n\
\ if [[ -n \"$line\" ]]; then\n issues_array+=(\"$line\")\n\
\ fi\n done <<< \"$issue_list\"\n \n _describe 'issues'\
\ issues_array\n fi\n}\n\n# Function to complete labels\n_issue_labels()\
\ {\n local labels\n local label_list\n \n # Check if we're in a git\
\ repository and have gh CLI available\n if ! git rev-parse --is-inside-work-tree\
\ >/dev/null 2>&1; then\n return 1\n fi\n \n if ! command -v gh\
\ >/dev/null 2>&1; then\n return 1\n fi\n \n # Get available labels\
\ from the repository\n label_list=$(gh label list --json name 2>/dev/null\
\ | \\\n jq -r '.[].name' 2>/dev/null)\n \n if [[ -n \"$label_list\"\
\ ]]; then\n local -a labels_array\n while IFS= read -r line; do\n\
\ if [[ -n \"$line\" ]]; then\n labels_array+=(\"$line\")\n\
\ fi\n done <<< \"$label_list\"\n \n _describe 'labels'\
\ labels_array\n fi\n}\n\n# Main completion function\n_issue \"$@\"\n\
JAN_EOF_issue__issue_588b28642dcf\nchmod +x \"$tmpdir/_issue\" 2>/dev/null\
\ || true\ncat >\"$tmpdir/issue.zsh\" <<'JAN_EOF_issue_issue_zsh_8bbc8048066d'\n\
#!/usr/bin/env zsh\n\n# ==============================================================================\n\
# A Zsh CLI note-taking application using gh issues as the backend.\n\
# Assumes the current directory is the repository for notes.\n#\n# For\
\ a **git-branch filesystem** issue store (UUID ids, works from monorepo\n\
# subfolders, optional fzf/$EDITOR flows), use the Rust tool in this repo:\n\
# filesystem-git-issues --help\n# It mirrors many of the verbs here\
\ (create, list, view, close, comment, label,\n# close-with-commit) while\
\ storing data on an `issues` branch instead of GitHub.\n# ==============================================================================\n\
\n# ------------------------------------------------------------------------------\n\
# Configuration: Edit these variables to match your setup.\n# ------------------------------------------------------------------------------\n\
\n# The label used to identify notes. This helps separate your notes\n\
# from other issues in the repository. Make sure this label exists.\n\
NOTE_LABEL=\"note-app\"\n\n# ------------------------------------------------------------------------------\n\
# Helper functions\n# ------------------------------------------------------------------------------\n\
\n# Get the user's preferred editor, or default to vim\nEDITOR=\"${EDITOR:-nvim}\"\
\n\n# Function for error handling\n_error() {\n echo \"Error: $1\" >&2\n\
\ exit 1\n}\n\n# Function to get note body via the user's editor\n_get_body_from_editor()\
\ {\n local temp_file=$(mktemp)\n local initial_body=\"$1\"\n\n echo\
\ \"$initial_body\" > \"$temp_file\"\n \n \"$EDITOR\" \"$temp_file\"\
\ < `tty` > `tty`\n \n # Wait for the editor to close\n if ! [ $? -eq\
\ 0 ] ; then\n _error \"Editor failed. Aborting.\"\n fi\n \n cat\
\ \"$temp_file\"\n rm \"$temp_file\"\n}\n\n# Function to select a note\
\ using fzf\n_select_note_with_fzf() {\n local list_output\n list_output=$(gh\
\ issue list --state \"open\" \\\n --json number,title | jq -r '.[]\
\ | \"\\(.number) \\(.title)\"' | fzf)\n \n if [[ -z \"$list_output\"\
\ ]]; then\n _error \"No note selected.\"\n fi\n \n # Extract the\
\ issue number from the beginning of the line\n echo \"$list_output\"\
\ | awk '{print $1}'\n}\n\n# ------------------------------------------------------------------------------\n\
# Core functions for the note-taking app\n# ------------------------------------------------------------------------------\n\
\n# Function to create a new note\ncreate_note() {\n echo \"Enter note\
\ title:\"\n read -r title\n \n if [[ -z \"$title\" ]]; then\n _error\
\ \"Note title cannot be empty. Creation aborted.\"\n fi\n\n echo \"\
Opening editor for note body. Save and exit to finish.\"\n body=$(_get_body_from_editor)\n\
\ \n echo \"Creating note...\"\n gh issue create --title \"$title\"\
\ --body \"$body\" --label \"$NOTE_LABEL\" > /dev/null\n if [[ \"$?\"\
\ -ne 0 ]]; then\n _error \"Failed to create note. Please check your\
\ repository and gh authentication.\"\n else\n echo \"Note created\
\ successfully.\"\n fi\n}\n\n# Function to list all notes\nlist_notes()\
\ {\n local filter_label=\"$1\"\n echo \"Fetching issues from the current\
\ repository...\"\n\n # Note: --limit 1000 is used to fetch up to 1000\
\ issues, which is the current maximum supported by gh issue list.\n \
\ # See: https://www.mankier.com/1/gh-issue-list\n local args=(\"--state\"\
\ \"open\" \"--json\" \"number,title,labels\" \"--limit\" \"1000\")\n\
\ if [[ -n \"$filter_label\" ]]; then\n args+=(\"--label\" \"$filter_label\"\
)\n fi\n\n gh issue list \"${args[@]}\" | jq -r '.[] | \"(\\(.number))\
\ \\(.title) [\\((.labels | map(.name) | join(\", \")))]\"'\n}\n\n# Function\
\ to view a specific note\nview_note() {\n local issue_number=\"$1\"\n\
\ echo \"Fetching note #$issue_number...\"\n\n gh issue view \"$issue_number\"\
\ --json title,body | jq -r '\n \"Title: \\(.title)\\n---\\n\\n\\(.body)\\\
n\"'\n}\n\n# Function to open a specific note in the browser\nopen_note()\
\ {\n local issue_number=\"$1\"\n echo \"Opening note #$issue_number\
\ in the browser...\"\n \n local url=$(gh issue view \"$issue_number\"\
\ --json url | jq -r '.url')\n \n # Use the correct command to open\
\ the URL based on the OS\n if [[ \"$OSTYPE\" == \"darwin\"* ]]; then\n\
\ open \"$url\"\n elif [[ \"$OSTYPE\" == \"linux-gnu\"* ]]; then\n\
\ xdg-open \"$url\"\n else\n _error \"Unsupported OS. Please open\
\ the following URL manually: $url\"\n fi\n}\n\n# Function to edit a\
\ specific note\nedit_note() {\n local issue_number=\"$1\"\n echo \"\
Fetching note #$issue_number for editing...\"\n \n local current_data=$(gh\
\ issue view \"$issue_number\" --json title,body)\n local current_title=$(echo\
\ \"$current_data\" | jq -r '.title')\n local current_body=$(echo \"\
$current_data\" | jq -r '.body')\n\n echo \"Current title: $current_title\"\
\n read -r \"new_title?Enter new title (or press Enter to keep the current\
\ one): \"\n \n if [[ -z \"$new_title\" ]]; then\n new_title=\"$current_title\"\
\n fi\n \n echo \"Opening editor for the note body. Edit, save, and\
\ exit.\"\n local updated_body=$(_get_body_from_editor \"$current_body\"\
)\n \n gh issue edit \"$issue_number\" --title \"$new_title\" --body\
\ \"$updated_body\" > /dev/null\n if [[ \"$?\" -ne 0 ]]; then\n _error\
\ \"Failed to update note #$issue_number.\"\n else\n echo \"Note #$issue_number\
\ updated successfully.\"\n fi\n}\n\n# Function to add a comment to a\
\ note\ncomment_note() {\n local issue_number=\"$1\"\n echo \"Adding\
\ a comment to note #$issue_number.\"\n\n echo \"Opening editor for your\
\ comment. Save and exit to submit.\"\n local comment_body=$(_get_body_from_editor)\n\
\n if [[ -z \"$comment_body\" ]]; then\n _error \"Comment body cannot\
\ be empty. Commenting aborted.\"\n fi\n\n gh issue comment \"$issue_number\"\
\ --body \"$comment_body\" > /dev/null\n if [[ \"$?\" -ne 0 ]]; then\n\
\ _error \"Failed to add comment to note #$issue_number.\"\n else\n\
\ echo \"Comment added to note #$issue_number successfully.\"\n fi\n\
}\n\n\n# Function to add labels to a note\nadd_label() {\n local issue_number=\"\
$1\"\n shift\n local labels=(\"$@\")\n \n if [[ ${#labels[@]} -eq\
\ 0 ]]; then\n _error \"No labels provided. Usage: issue label <issue_number>\
\ <label1> [label2] ...\"\n fi\n \n echo \"Adding label(s) to note\
\ #$issue_number...\"\n \n # Build the --add-label arguments\n local\
\ label_args=()\n for label in \"${labels[@]}\"; do\n label_args+=(\"\
--add-label\" \"$label\")\n done\n \n gh issue edit \"$issue_number\"\
\ \"${label_args[@]}\" > /dev/null\n if [[ \"$?\" -ne 0 ]]; then\n \
\ _error \"Failed to add label(s) to note #$issue_number.\"\n else\n\
\ echo \"Label(s) added to note #$issue_number successfully: ${labels[*]}\"\
\n fi\n}\n\n# Function to \"close\" a note\nclose_note() {\n local issue_number=\"\
$1\"\n echo \"Are you sure you want to close note #$issue_number? (y/N)\"\
\n read -r confirmation\n \n if [[ \"$confirmation\" =~ ^[Yy]$ ]];\
\ then\n echo \"Closing note #$issue_number...\"\n gh issue close\
\ \"$issue_number\"\n if [[ \"$?\" -ne 0 ]]; then\n _error \"\
Failed to close note #$issue_number.\"\n else\n echo \"Note #$issue_number\
\ closed successfully.\"\n fi\n else\n echo \"Close canceled.\"\
\n fi\n}\n\n# Function to commit all changes and close an issue\nclose_with_commit()\
\ {\n # Check if there are any changes to commit\n if git diff --quiet\
\ && git diff --cached --quiet; then\n _error \"No changes to commit.\
\ Please make some changes first.\"\n fi\n\n echo \"Selecting issue\
\ to close with commit...\"\n local issue_number=$(_select_note_with_fzf)\n\
\ [[ -z \"$issue_number\" ]] && exit 0\n\n echo \"Fetching issue details\
\ for commit message...\"\n local issue_data=$(gh issue view \"$issue_number\"\
\ --json title,url)\n local issue_title=$(echo \"$issue_data\" | jq -r\
\ '.title')\n local issue_url=$(echo \"$issue_data\" | jq -r '.url')\n\
\n if [[ -z \"$issue_title\" || -z \"$issue_url\" ]]; then\n _error\
\ \"Failed to fetch issue details for #$issue_number.\"\n fi\n\n echo\
\ \"Enter commit message (or press Enter to use default):\"\n echo \"\
Default: Fix: $issue_title\"\n read -r custom_message\n\n local commit_message\n\
\ if [[ -z \"$custom_message\" ]]; then\n commit_message=\"Fix: $issue_title\"\
\n else\n commit_message=\"$custom_message\"\n fi\n\n # Add the\
\ issue URL to the commit message\n commit_message=\"$commit_message\n\
\nFixes: $issue_url\"\n\n echo \"Committing changes...\"\n git add -A\n\
\ git commit -m \"$commit_message\"\n \n if [[ \"$?\" -ne 0 ]]; then\n\
\ _error \"Failed to commit changes. Issue will not be closed.\"\n\
\ fi\n\n local commit_hash=$(git rev-parse HEAD)\n local short_commit_hash=$(git\
\ rev-parse --short HEAD)\n \n echo \"Commit successful! Adding commit\
\ reference to issue #$issue_number...\"\n \n # Add commit hash as a\
\ comment to the issue\n local comment_body=\"\U0001F527 Fixed in commit:\
\ $commit_hash\"\n gh issue comment \"$issue_number\" --body \"$comment_body\"\
\ > /dev/null\n \n if [[ \"$?\" -ne 0 ]]; then\n echo \"Warning:\
\ Failed to add commit reference as comment to issue #$issue_number.\"\
\n else\n echo \"Added commit reference as comment to issue #$issue_number.\"\
\n fi\n \n echo \"Closing issue #$issue_number...\"\n gh issue close\
\ \"$issue_number\"\n \n if [[ \"$?\" -ne 0 ]]; then\n echo \"Warning:\
\ Commit was successful, but failed to close issue #$issue_number. You\
\ may need to close it manually.\"\n exit 1\n else\n echo \"Issue\
\ #$issue_number closed successfully.\"\n echo \"Commit hash: $short_commit_hash\"\
\n fi\n}\n\n# ------------------------------------------------------------------------------\n\
# Main script logic\n# ------------------------------------------------------------------------------\n\
\n# Check for required dependencies\ncommand -v gh >/dev/null 2>&1 ||\
\ { _error \"GitHub CLI (gh) is not installed.\"; }\ncommand -v jq >/dev/null\
\ 2>&1 || { _error \"jq is not installed. Please install it.\"; }\ncommand\
\ -v fzf >/dev/null 2>&1 || { _error \"fzf is not installed. Please install\
\ it.\"; }\n\n# Check for git repository\nif ! git rev-parse --is-inside-work-tree\
\ >/dev/null 2>&1; then\n _error \"Not in a git repository. Please\
\ run this script from inside the repository you want to use for notes.\"\
\nfi\n\n# Main command-line parser\ncase \"$1\" in\n create)\n create_note\n\
\ ;;\n list)\n shift\n list_notes \"$1\"\n ;;\n view)\n\
\ shift\n if [[ -z \"$1\" ]]; then\n issue_number=$(_select_note_with_fzf)\n\
\ [[ -z \"$issue_number\" ]] && exit 0 # Exit if fzf was cancelled\n\
\ view_note \"$issue_number\"\n else\n view_note \"$@\"\n\
\ fi\n ;;\n open)\n shift\n if [[ -z \"$1\" ]]; then\n \
\ issue_number=$(_select_note_with_fzf)\n [[ -z \"$issue_number\"\
\ ]] && exit 0\n open_note \"$issue_number\"\n else\n open_note\
\ \"$@\"\n fi\n ;;\n edit)\n shift\n if [[ -z \"$1\" ]];\
\ then\n issue_number=$(_select_note_with_fzf)\n [[ -z \"$issue_number\"\
\ ]] && exit 0\n edit_note \"$issue_number\"\n else\n edit_note\
\ \"$@\"\n fi\n ;;\n comment)\n shift\n if [[ -z \"$1\" ]];\
\ then\n issue_number=$(_select_note_with_fzf)\n [[ -z \"$issue_number\"\
\ ]] && exit 0\n comment_note \"$issue_number\"\n else\n \
\ comment_note \"$@\"\n fi\n ;;\n label)\n shift\n if [[\
\ $# -eq 0 ]]; then\n _error \"No labels provided. Usage: issue label\
\ [<issue_number>] <label1> [label2] ...\"\n fi\n \n # Check\
\ if first argument is a number (issue number) or a label\n if [[ \"\
$1\" =~ ^[0-9]+$ ]]; then\n issue_number=\"$1\"\n shift\n \
\ if [[ $# -eq 0 ]]; then\n _error \"No labels provided. Usage:\
\ issue label [<issue_number>] <label1> [label2] ...\"\n fi\n \
\ add_label \"$issue_number\" \"$@\"\n else\n # First argument\
\ is a label, need to select issue\n issue_number=$(_select_note_with_fzf)\n\
\ [[ -z \"$issue_number\" ]] && exit 0\n add_label \"$issue_number\"\
\ \"$@\"\n fi\n ;;\n close)\n shift\n if [[ -z \"$1\" ]];\
\ then\n issue_number=$(_select_note_with_fzf)\n [[ -z \"$issue_number\"\
\ ]] && exit 0\n close_note \"$issue_number\"\n else\n close_note\
\ \"$@\"\n fi\n ;;\n closeWithCommit)\n close_with_commit\n\
\ ;;\n *)\n echo \"Usage: note <command> [arguments]\"\n echo\
\ \"\"\n echo \"Commands:\"\n echo \" create Create\
\ a new note (opens editor).\"\n echo \" list [<label>] List\
\ all open issues, optionally filtering by label.\"\n echo \" view\
\ [<issue_number>] View a specific note. If no number is given, a selector\
\ will appear.\"\n echo \" open [<issue_number>] Open a note in your\
\ web browser. If no number is given, a selector will appear.\"\n echo\
\ \" edit [<issue_number>] Edit a specific note. If no number is given,\
\ a selector will appear.\"\n echo \" comment [<issue_number>] Add\
\ a comment to a specific note. If no number is given, a selector will\
\ appear.\"\n echo \" label [<issue_number>] <label1> [label2] ...\
\ Add label(s) to a note. If no number is given, a selector will appear.\"\
\n echo \" close [<issue_number>] Close a specific note. If no number\
\ is given, a selector will appear.\"\n echo \" closeWithCommit \
\ Commit all changes (like git commit -am) and close a selected issue.\"\
\n ;;\nesac\nJAN_EOF_issue_issue_zsh_8bbc8048066d\nchmod +x \"$tmpdir/issue.zsh\"\
\ 2>/dev/null || true\ncd \"$tmpdir\"\nexec \"$tmpdir/issue.zsh\" \"$@\"\
\n"
passthrough: true
requires:
- gh
- jq
- fzf
itty:
about: A script for automated tasks.
path: ../scripts/source/itty
commands:
help:
about: Describe this script.
exec:
argv:
- bash
- -lc
- 'cat <<''EOF''
itty
A script for automated tasks.
EOF
'
run:
about: Run the script (inlined); forwards args.
exec:
argv:
- bash
- -lc
- "set -euo pipefail\ntmpdir=\"$(mktemp -d)\"\ntrap 'rm -rf \"$tmpdir\"\
' EXIT\ncat >\"$tmpdir/_itty\" <<'JAN_EOF_itty__itty_03c6ac880cc8'\n#compdef\
\ itty\n\n# Zsh completion for itty\n# Generated automatically - customize\
\ as needed\n\n_itty() {\n local context state line\n typeset -A\
\ opt_args\n \n _arguments -C \\\n '(-h --help)'{-h,--help}'[Show\
\ help information]' \\\n '(-v --version)'{-v,--version}'[Show\
\ version information]' \\\n '*::arg:_files'\n}\n\n_itty \"$@\"\
\nJAN_EOF_itty__itty_03c6ac880cc8\nchmod +x \"$tmpdir/_itty\" 2>/dev/null\
\ || true\ncat >\"$tmpdir/itty.sh\" <<'JAN_EOF_itty_itty_sh_7c1342716762'\n\
#!/usr/bin/env zsh\n# (c) 2022 Pat Beagan: MIT License\n\nset -euo pipefail\n\
IFS=$'\\n\\t'\n\nscriptname=\"$(basename \"$0\")\"\n\nhelp () {\n error_code=$?\n\
\ echo \"\nUsage: $scriptname [-h|--help] <text>\n\nCreates a tiny\
\ URL using itty.bitty.site service.\nCompresses text content using LZMA\
\ compression and base64 encoding.\n\nArguments:\n text Text content\
\ to compress and create tiny URL for\n\nFeatures:\n - Uses LZMA compression\
\ for maximum compression\n - Base64 encoding for URL-safe transmission\n\
\ - Creates shareable tiny URLs for text content\n\nExamples:\n $scriptname\
\ 'Hello World' # Creates tiny URL for text\n $scriptname\
\ \\\"$(cat document.txt)\\\" # Creates tiny URL for file content\n\
\"\n if [[ ! $error_code -eq 0 ]]; then echo \"Err: $error_code\";\
\ fi\n}\n\nitty () {\n\techo -n \"<pre>$1</pre>\" | lzma -9 | base64 |\
\ xargs -0 printf \"https://itty.bitty.site/#/%s\\n\"\n}\n\nitty \"$@\"\
\ || help\ntrackusage \"$0\"\nJAN_EOF_itty_itty_sh_7c1342716762\nchmod\
\ +x \"$tmpdir/itty.sh\" 2>/dev/null || true\ncd \"$tmpdir\"\nexec \"\
$tmpdir/itty.sh\" \"$@\"\n"
passthrough: true
jirabacklog:
about: A script for automated tasks.
path: ../scripts/source/jirabacklog
commands:
help:
about: Describe this script.
exec:
argv:
- bash
- -lc
- 'cat <<''EOF''
jirabacklog
A script for automated tasks.
EOF
'
run:
about: Run the script (inlined); forwards args.
exec:
argv:
- bash
- -lc
- "set -euo pipefail\ntmpdir=\"$(mktemp -d)\"\ntrap 'rm -rf \"$tmpdir\"\
' EXIT\ncat >\"$tmpdir/_jirabacklog\" <<'JAN_EOF_jirabacklog__jirabacklog_4b5b524fc8b2'\n\
#compdef jirabacklog\n\n# Zsh completion for jirabacklog\n# Generated\
\ automatically - customize as needed\n\n_jirabacklog() {\n local context\
\ state line\n typeset -A opt_args\n \n _arguments -C \\\n \
\ '(-h --help)'{-h,--help}'[Show help information]' \\\n '(-v\
\ --version)'{-v,--version}'[Show version information]' \\\n '*::arg:_files'\n\
}\n\n_jirabacklog \"$@\"\nJAN_EOF_jirabacklog__jirabacklog_4b5b524fc8b2\n\
chmod +x \"$tmpdir/_jirabacklog\" 2>/dev/null || true\ncat >\"$tmpdir/jirabacklog.sh\"\
\ <<'JAN_EOF_jirabacklog_jirabacklog_sh_34da7d676794'\nfunction jirabacklog()\
\ {\n # 1. Validate input\n if [[ -z \"$1\" ]]; then\n echo \"Error:\
\ Please provide a Jira project key.\" >&2\n echo \"Usage: jirabacklog\
\ <PROJECT_KEY>\" >&2\n return 1\n fi\n\n # 2. Check for dependencies\n\
\ if ! command -v jq &> /dev/null; then\n echo \"Error: jq is not\
\ installed. Please install it to use this function.\" >&2\n echo \"\
On macOS, run: brew install jq\" >&2\n return 1\n fi\n\n # 3. Read\
\ or prompt for Jira instance subdomain (copied from jirasprintmine)\n\
\ local jira_subdomain_file=\"$HOME/.jira_instance_subdomain\"\n local\
\ JIRA_INSTANCE_SUBDOMAIN=\"\"\n\n if [[ -f \"$jira_subdomain_file\"\
\ ]]; then\n JIRA_INSTANCE_SUBDOMAIN=$(<\"$jira_subdomain_file\")\n\
\ fi\n if [[ -z \"$JIRA_INSTANCE_SUBDOMAIN\" ]]; then\n read \"JIRA_INSTANCE_SUBDOMAIN?Enter\
\ your Jira instance subdomain (the part before .atlassian.net): \"\n\
\ if [[ -z \"$JIRA_INSTANCE_SUBDOMAIN\" ]]; then\n echo \"Jira\
\ instance subdomain is required.\"\n return 1\n fi\n echo\
\ \"$JIRA_INSTANCE_SUBDOMAIN\" > \"$jira_subdomain_file\"\n fi\n\n local\
\ project_key=$1\n local jql_query\n\n # 4. Safely build the JQL query\
\ string using printf\n printf -v jql_query \"project = '%s' AND sprint\
\ is EMPTY ORDER BY Rank ASC\" \"${project_key}\"\n\n # 5. Run the command\
\ and process the output, using the dynamic Jira subdomain\n acli jira\
\ workitem search --jql=\"$jql_query\" --json 2>/dev/null | \\\n JIRA_INSTANCE_SUBDOMAIN=\"\
$JIRA_INSTANCE_SUBDOMAIN\" jq -r '\n .[] |\n \"\U0001F39F️ \\(.fields.summary)\
\ - \\(.fields.assignee.displayName // \"Unassigned\")\\nhttps://\" +\
\ (env.JIRA_INSTANCE_SUBDOMAIN) + \".atlassian.net/browse/\" + .key +\
\ \"\\n\"\n '\n}\njirabacklog \"$@\"\nJAN_EOF_jirabacklog_jirabacklog_sh_34da7d676794\n\
chmod +x \"$tmpdir/jirabacklog.sh\" 2>/dev/null || true\ncd \"$tmpdir\"\
\nexec \"$tmpdir/jirabacklog.sh\" \"$@\"\n"
passthrough: true
kc:
about: A script for automated tasks.
path: ../scripts/source/kc
commands:
help:
about: Describe this script.
exec:
argv:
- bash
- -lc
- 'cat <<''EOF''
kc
A script for automated tasks.
EOF
'
run:
about: Run the script (inlined); forwards args.
exec:
argv:
- bash
- -lc
- "set -euo pipefail\ntmpdir=\"$(mktemp -d)\"\ntrap 'rm -rf \"$tmpdir\"\
' EXIT\ncat >\"$tmpdir/_kc\" <<'JAN_EOF_kc__kc_8e13b167f13d'\n#compdef\
\ kc\n\n# Zsh completion for kc\n# Generated automatically - customize\
\ as needed\n\n_kc() {\n local context state line\n typeset -A opt_args\n\
\ \n _arguments -C \\\n '(-h --help)'{-h,--help}'[Show help\
\ information]' \\\n '(-v --version)'{-v,--version}'[Show version\
\ information]' \\\n '*::arg:_files'\n}\n\n_kc \"$@\"\nJAN_EOF_kc__kc_8e13b167f13d\n\
chmod +x \"$tmpdir/_kc\" 2>/dev/null || true\ncat >\"$tmpdir/kc.sh\" <<'JAN_EOF_kc_kc_sh_b1dc7240f6d8'\n\
#!/bin/bash \n# (c) 2022 Pat Beagan: MIT License\n\nkc () \n{ \n kotlinc\
\ \"$1\" -include-runtime -d out.jar\n}\nkc \"$@\"\ntrackusage \"$0\"\n\
JAN_EOF_kc_kc_sh_b1dc7240f6d8\nchmod +x \"$tmpdir/kc.sh\" 2>/dev/null\
\ || true\ncd \"$tmpdir\"\nexec \"$tmpdir/kc.sh\" \"$@\"\n"
passthrough: true
kr:
about: A script for automated tasks.
path: ../scripts/source/kr
commands:
help:
about: Describe this script.
exec:
argv:
- bash
- -lc
- 'cat <<''EOF''
kr
A script for automated tasks.
EOF
'
run:
about: Run the script (inlined); forwards args.
exec:
argv:
- bash
- -lc
- "set -euo pipefail\ntmpdir=\"$(mktemp -d)\"\ntrap 'rm -rf \"$tmpdir\"\
' EXIT\ncat >\"$tmpdir/_kr\" <<'JAN_EOF_kr__kr_57b8c8c7f0b8'\n#compdef\
\ kr\n\n# Zsh completion for kr\n# Generated automatically - customize\
\ as needed\n\n_kr() {\n local context state line\n typeset -A opt_args\n\
\ \n _arguments -C \\\n '(-h --help)'{-h,--help}'[Show help\
\ information]' \\\n '(-v --version)'{-v,--version}'[Show version\
\ information]' \\\n '*::arg:_files'\n}\n\n_kr \"$@\"\nJAN_EOF_kr__kr_57b8c8c7f0b8\n\
chmod +x \"$tmpdir/_kr\" 2>/dev/null || true\ncat >\"$tmpdir/kr.sh\" <<'JAN_EOF_kr_kr_sh_66fc229fcaa9'\n\
#!/bin/bash \n# (c) 2022 Pat Beagan: MIT License\n\nkr () \n{ \n java\
\ -jar \"$1\"\n}\n\nkr \"$@\"\ntrackusage \"$0\"\nJAN_EOF_kr_kr_sh_66fc229fcaa9\n\
chmod +x \"$tmpdir/kr.sh\" 2>/dev/null || true\ncd \"$tmpdir\"\nexec \"\
$tmpdir/kr.sh\" \"$@\"\n"
passthrough: true
last_branch:
about: A script for automated tasks.
path: ../scripts/source/last_branch
commands:
help:
about: Describe this script.
exec:
argv:
- bash
- -lc
- 'cat <<''EOF''
last_branch
A script for automated tasks.
EOF
'
run:
about: Run the script (inlined); forwards args.
exec:
argv:
- bash
- -lc
- "set -euo pipefail\ntmpdir=\"$(mktemp -d)\"\ntrap 'rm -rf \"$tmpdir\"\
' EXIT\ncat >\"$tmpdir/_last_branch\" <<'JAN_EOF_last_branch__last_branch_0fa4d9acfa10'\n\
#compdef last_branch\n\n# Zsh completion for last_branch\n# Generated\
\ automatically - customize as needed\n\n_last_branch() {\n local context\
\ state line\n typeset -A opt_args\n \n _arguments -C \\\n \
\ '(-h --help)'{-h,--help}'[Show help information]' \\\n '(-v\
\ --version)'{-v,--version}'[Show version information]' \\\n '*::arg:_files'\n\
}\n\n_last_branch \"$@\"\nJAN_EOF_last_branch__last_branch_0fa4d9acfa10\n\
chmod +x \"$tmpdir/_last_branch\" 2>/dev/null || true\ncat >\"$tmpdir/last_branch.sh\"\
\ <<'JAN_EOF_last_branch_last_branch_sh_b20fab477837'\n#!/bin/bash\n#\
\ (c) 2022 Pat Beagan: MIT License\n\nlast_branch () \n{ \n git branch\
\ --sort=committerdate\n}\n\nlast_branch \"$@\"\nJAN_EOF_last_branch_last_branch_sh_b20fab477837\n\
chmod +x \"$tmpdir/last_branch.sh\" 2>/dev/null || true\ncd \"$tmpdir\"\
\nexec \"$tmpdir/last_branch.sh\" \"$@\"\n"
passthrough: true
last_commits_with_string:
about: A script for automated tasks.
path: ../scripts/source/last_commits_with_string
commands:
help:
about: Describe this script.
exec:
argv:
- bash
- -lc
- 'cat <<''EOF''
last_commits_with_string
A script for automated tasks.
EOF
'
run:
about: Run the script (inlined); forwards args.
exec:
argv:
- bash
- -lc
- "set -euo pipefail\ntmpdir=\"$(mktemp -d)\"\ntrap 'rm -rf \"$tmpdir\"\
' EXIT\ncat >\"$tmpdir/_last_commits_with_string\" <<'JAN_EOF_last_commits_with_string__last_commits_with_stri_8e8169f9fa11'\n\
#compdef last_commits_with_string\n\n# Zsh completion for last_commits_with_string\n\
# Generated automatically - customize as needed\n\n_last_commits_with_string()\
\ {\n local context state line\n typeset -A opt_args\n \n \
\ _arguments -C \\\n '(-h --help)'{-h,--help}'[Show help information]'\
\ \\\n '(-v --version)'{-v,--version}'[Show version information]'\
\ \\\n '*::arg:_files'\n}\n\n_last_commits_with_string \"$@\"\n\
JAN_EOF_last_commits_with_string__last_commits_with_stri_8e8169f9fa11\n\
chmod +x \"$tmpdir/_last_commits_with_string\" 2>/dev/null || true\ncat\
\ >\"$tmpdir/last_commits_with_string.sh\" <<'JAN_EOF_last_commits_with_string_last_commits_with_strin_acfed730107d'\n\
#!/bin/bash \n# (c) 2022 Pat Beagan: MIT License\n\nlast_commits_with_string\
\ () \n{ \n for i in $(ag \"$1\" | grep .php | sed 's/:.*//g' | sort\
\ | uniq );\n do\n echo \"$i\" && head <(gitfilehistory \"$i\"\
);\n done\n}\n\nlast_commits_with_string \"$@\"\nJAN_EOF_last_commits_with_string_last_commits_with_strin_acfed730107d\n\
chmod +x \"$tmpdir/last_commits_with_string.sh\" 2>/dev/null || true\n\
cd \"$tmpdir\"\nexec \"$tmpdir/last_commits_with_string.sh\" \"$@\"\n"
passthrough: true
lastfield:
about: A script for automated tasks.
path: ../scripts/source/lastfield
commands:
help:
about: Describe this script.
exec:
argv:
- bash
- -lc
- 'cat <<''EOF''
lastfield
A script for automated tasks.
EOF
'
run:
about: Run the script (inlined); forwards args.
exec:
argv:
- bash
- -lc
- "set -euo pipefail\ntmpdir=\"$(mktemp -d)\"\ntrap 'rm -rf \"$tmpdir\"\
' EXIT\ncat >\"$tmpdir/_lastfield\" <<'JAN_EOF_lastfield__lastfield_e9b8f898b177'\n\
#compdef lastfield\n\n# Zsh completion for lastfield\n# Generated automatically\
\ - customize as needed\n\n_lastfield() {\n local context state line\n\
\ typeset -A opt_args\n \n _arguments -C \\\n '(-h --help)'{-h,--help}'[Show\
\ help information]' \\\n '(-v --version)'{-v,--version}'[Show\
\ version information]' \\\n '*::arg:_files'\n}\n\n_lastfield \"\
$@\"\nJAN_EOF_lastfield__lastfield_e9b8f898b177\nchmod +x \"$tmpdir/_lastfield\"\
\ 2>/dev/null || true\ncat >\"$tmpdir/lastfield.sh\" <<'JAN_EOF_lastfield_lastfield_sh_6c71b28d0a52'\n\
#!/bin/bash \n# (c) 2022 Pat Beagan: MIT License\n\nlastfield () \n{ \n\
\ awk -F \"/\" '{print $NF}'\n}\n\nlastfield \"$@\"\ntrackusage \"\
$0\"\nJAN_EOF_lastfield_lastfield_sh_6c71b28d0a52\nchmod +x \"$tmpdir/lastfield.sh\"\
\ 2>/dev/null || true\ncd \"$tmpdir\"\nexec \"$tmpdir/lastfield.sh\" \"\
$@\"\n"
passthrough: true
lastlog:
about: A script for automated tasks.
path: ../scripts/source/lastlog
commands:
help:
about: Describe this script.
exec:
argv:
- bash
- -lc
- 'cat <<''EOF''
lastlog
A script for automated tasks.
EOF
'
run:
about: Run the script (inlined); forwards args.
exec:
argv:
- bash
- -lc
- "set -euo pipefail\ntmpdir=\"$(mktemp -d)\"\ntrap 'rm -rf \"$tmpdir\"\
' EXIT\ncat >\"$tmpdir/_lastlog\" <<'JAN_EOF_lastlog__lastlog_e010e319858f'\n\
#compdef lastlog\n\n# Zsh completion for lastlog\n# Generated automatically\
\ - customize as needed\n\n_lastlog() {\n local context state line\n\
\ typeset -A opt_args\n \n _arguments -C \\\n '(-h --help)'{-h,--help}'[Show\
\ help information]' \\\n '(-v --version)'{-v,--version}'[Show\
\ version information]' \\\n '*::arg:_files'\n}\n\n_lastlog \"\
$@\"\nJAN_EOF_lastlog__lastlog_e010e319858f\nchmod +x \"$tmpdir/_lastlog\"\
\ 2>/dev/null || true\ncat >\"$tmpdir/lastlog.sh\" <<'JAN_EOF_lastlog_lastlog_sh_8f50f41837ad'\n\
#!/bin/bash \n# (c) 2022 Pat Beagan: MIT License\n\nlastlog () \n{ \n\
\ cd /var/log;\n less $(ls -1t | head -1)\n}\n\nlastlog \"$@\"\n\
trackusage \"$0\"\nJAN_EOF_lastlog_lastlog_sh_8f50f41837ad\nchmod +x \"\
$tmpdir/lastlog.sh\" 2>/dev/null || true\ncd \"$tmpdir\"\nexec \"$tmpdir/lastlog.sh\"\
\ \"$@\"\n"
passthrough: true
lastmod:
about: A script for automated tasks.
path: ../scripts/source/lastmod
commands:
help:
about: Describe this script.
exec:
argv:
- bash
- -lc
- 'cat <<''EOF''
lastmod
A script for automated tasks.
EOF
'
run:
about: Run the script (inlined); forwards args.
exec:
argv:
- bash
- -lc
- "set -euo pipefail\ntmpdir=\"$(mktemp -d)\"\ntrap 'rm -rf \"$tmpdir\"\
' EXIT\ncat >\"$tmpdir/_lastmod\" <<'JAN_EOF_lastmod__lastmod_e1a1726da0ed'\n\
#compdef lastmod\n\n# Zsh completion for lastmod\n# Generated automatically\
\ - customize as needed\n\n_lastmod() {\n local context state line\n\
\ typeset -A opt_args\n \n _arguments -C \\\n '(-h --help)'{-h,--help}'[Show\
\ help information]' \\\n '(-v --version)'{-v,--version}'[Show\
\ version information]' \\\n '*::arg:_files'\n}\n\n_lastmod \"\
$@\"\nJAN_EOF_lastmod__lastmod_e1a1726da0ed\nchmod +x \"$tmpdir/_lastmod\"\
\ 2>/dev/null || true\ncat >\"$tmpdir/lastmod.sh\" <<'JAN_EOF_lastmod_lastmod_sh_900160872db5'\n\
#!/bin/bash \n# (c) 2022 Pat Beagan: MIT License\n\nlastmod () \n{ \n\
\ if [ `uname` = \"Darwin\" ]; then\n find . -type f -print0\
\ | xargs -0 stat -f \"%m %N\" | sort -rn | head -5 | cut -f2- -d\" \"\
;\n else\n if [ `uname` = \"Linux\" ]; then\n find\
\ $1 -type f -print0 | xargs -0 stat --format '%Y :%y %n' | sort -nr |\
\ cut -d: -f2- | head;\n else\n echo 'No suitable command\
\ for this system.';\n fi;\n fi\n}\n\nlastmod \"$@\"\ntrackusage\
\ \"$0\"\nJAN_EOF_lastmod_lastmod_sh_900160872db5\nchmod +x \"$tmpdir/lastmod.sh\"\
\ 2>/dev/null || true\ncd \"$tmpdir\"\nexec \"$tmpdir/lastmod.sh\" \"\
$@\"\n"
passthrough: true
links-browse:
about: 'Generate an HTML page from a list of URLs (passed as arguments), open
it in the default browser, then exit. No temporary file is created: the page
is opened via a `data:` URL.'
path: ../scripts/source/links-browse
commands:
help:
about: Describe this script.
exec:
argv:
- bash
- -lc
- 'cat <<''EOF''
links-browse
Generate an HTML page from a list of URLs (passed as arguments), open
it in the default browser, then exit. No temporary file is created: the
page is opened via a `data:` URL.
EOF
'
run:
about: Run the script (inlined); forwards args.
exec:
argv:
- bash
- -lc
- "set -euo pipefail\ntmpdir=\"$(mktemp -d)\"\ntrap 'rm -rf \"$tmpdir\"\
' EXIT\ncat >\"$tmpdir/links-browse.sh\" <<'JAN_EOF_links_browse_links_browse_sh_fb65f6b10011'\n\
#!/usr/bin/env bash\n# links-browse: Generate an HTML page from link arguments\
\ and open it in the browser.\n# Uses a data URL so no temporary file\
\ is created. (c) 2025 Pat Beagan: MIT License\n\nset -euo pipefail\n\n\
usage() {\n cat << EOF\nUsage: links-browse URL [URL ...]\n\nGenerates\
\ a minimal HTML page listing the given URLs as links, opens it in the\n\
default browser, then exits. No file is written to disk (uses a data URL).\n\
\nExample:\n links-browse https://example.com https://github.com\nEOF\n\
}\n\nif [[ $# -eq 0 ]] || [[ \"$1\" == \"-h\" ]] || [[ \"$1\" == \"--help\"\
\ ]]; then\n usage\n exit 0\nfi\n\nbuild_html() {\n cat << 'HTMLEOF'\n\
<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n <meta charset=\"utf-8\"\
>\n <title>Links</title>\n <style>\n body { font-family: system-ui,\
\ sans-serif; margin: 2rem; max-width: 60rem; }\n a { display: block;\
\ margin: 0.5rem 0; }\n </style>\n</head>\n<body>\n <h1>Links</h1>\n\
\ <ul>\nHTMLEOF\n for url in \"$@\"; do\n # Escape HTML specials\
\ in the URL for the href and in the display text\n url_escaped=$(printf\
\ '%s' \"$url\" | sed 's/&/\\&/g; s/</\\</g; s/>/\\>/g; s/\"\
/\\"/g')\n printf ' <li><a href=\"%s\">%s</a></li>\\n'\
\ \"$url_escaped\" \"$url_escaped\"\n done\n echo ' </ul>'\n \
\ echo '</body>'\n echo '</html>'\n}\n\nhtml=$(build_html \"$@\")\n\
\n# Encode for data URL (percent-encoding). Python is used for reliable\
\ encoding.\nencoded=$(printf '%s' \"$html\" | python3 -c \"\nimport sys\n\
import urllib.parse\nprint(urllib.parse.quote(sys.stdin.read(), safe=''))\n\
\")\n\ndata_url=\"data:text/html;charset=utf-8,$encoded\"\n\n# Prefer\
\ launching a browser directly with the data URL (no temp file, works\
\ with Snap/sandbox).\n# xdg-open often uses gio, which doesn't support\
\ data URLs; sandboxed browsers can't read /tmp or ~/.cache.\nfor browser\
\ in firefox chromium-browser google-chrome chromium; do\n if command\
\ -v \"$browser\" &>/dev/null; then\n exec \"$browser\" \"$data_url\"\
\n fi\ndone\n\n# Fallback: xdg-open (macOS open, or Linux when it works\
\ with data URLs)\nif command -v xdg-open &>/dev/null; then\n exec\
\ xdg-open \"$data_url\"\nelif command -v open &>/dev/null; then\n \
\ exec open \"$data_url\"\nfi\n\necho \"links-browse: no browser found\
\ (tried firefox, chromium, xdg-open, open)\" >&2\nexit 1\nJAN_EOF_links_browse_links_browse_sh_fb65f6b10011\n\
chmod +x \"$tmpdir/links-browse.sh\" 2>/dev/null || true\ncd \"$tmpdir\"\
\nexec \"$tmpdir/links-browse.sh\" \"$@\"\n"
passthrough: true
lll:
about: A script for automated tasks.
path: ../scripts/source/lll
commands:
help:
about: Describe this script.
exec:
argv:
- bash
- -lc
- 'cat <<''EOF''
lll
A script for automated tasks.
EOF
'
run:
about: Run the script (inlined); forwards args.
exec:
argv:
- bash
- -lc
- "set -euo pipefail\ntmpdir=\"$(mktemp -d)\"\ntrap 'rm -rf \"$tmpdir\"\
' EXIT\ncat >\"$tmpdir/_lll\" <<'JAN_EOF_lll__lll_7e8a27a3cd69'\n#compdef\
\ lll\n\n# Zsh completion for lll\n# Generated automatically - customize\
\ as needed\n\n_lll() {\n local context state line\n typeset -A\
\ opt_args\n \n _arguments -C \\\n '(-h --help)'{-h,--help}'[Show\
\ help information]' \\\n '(-v --version)'{-v,--version}'[Show\
\ version information]' \\\n '*::arg:_files'\n}\n\n_lll \"$@\"\n\
JAN_EOF_lll__lll_7e8a27a3cd69\nchmod +x \"$tmpdir/_lll\" 2>/dev/null ||\
\ true\ncat >\"$tmpdir/lll.sh\" <<'JAN_EOF_lll_lll_sh_3bd4e81ad633'\n\
#!/bin/bash \n# (c) 2022 Pat Beagan: MIT License\n\n. $LIB_MACHINE_TYPES\n\
\nlll () \n{ \n if is-test system os mac; then\n ls\n else\n\
\ ls --color=auto -l --full-time;\n fi\n}\n\nlll \"$@\"\ntrackusage\
\ \"$0\"\nJAN_EOF_lll_lll_sh_3bd4e81ad633\nchmod +x \"$tmpdir/lll.sh\"\
\ 2>/dev/null || true\ncd \"$tmpdir\"\nexec \"$tmpdir/lll.sh\" \"$@\"\n"
passthrough: true
lookbehind:
about: A script for automated tasks.
path: ../scripts/source/lookbehind
commands:
help:
about: Describe this script.
exec:
argv:
- bash
- -lc
- 'cat <<''EOF''
lookbehind
A script for automated tasks.
EOF
'
run:
about: Run the script (inlined); forwards args.
exec:
argv:
- bash
- -lc
- "set -euo pipefail\ntmpdir=\"$(mktemp -d)\"\ntrap 'rm -rf \"$tmpdir\"\
' EXIT\ncat >\"$tmpdir/_lookbehind\" <<'JAN_EOF_lookbehind__lookbehind_f073ea9131ae'\n\
#compdef lookbehind\n\n# Zsh completion for lookbehind\n# Generated automatically\
\ - customize as needed\n\n_lookbehind() {\n local context state line\n\
\ typeset -A opt_args\n \n _arguments -C \\\n '(-h --help)'{-h,--help}'[Show\
\ help information]' \\\n '(-v --version)'{-v,--version}'[Show\
\ version information]' \\\n '*::arg:_files'\n}\n\n_lookbehind\
\ \"$@\"\nJAN_EOF_lookbehind__lookbehind_f073ea9131ae\nchmod +x \"$tmpdir/_lookbehind\"\
\ 2>/dev/null || true\ncat >\"$tmpdir/lookbehind.sh\" <<'JAN_EOF_lookbehind_lookbehind_sh_dfc6e305b218'\n\
#!/bin/bash \n# (c) 2022 Pat Beagan: MIT License\n\nlookbehind () \n{\
\ \n printf \"((?!%s).)*\" \"$1\"\n}\n\nlookbehind \"$@\"\ntrackusage\
\ \"$0\"\nJAN_EOF_lookbehind_lookbehind_sh_dfc6e305b218\nchmod +x \"$tmpdir/lookbehind.sh\"\
\ 2>/dev/null || true\ncd \"$tmpdir\"\nexec \"$tmpdir/lookbehind.sh\"\
\ \"$@\"\n"
passthrough: true
loop:
about: A script for automated tasks.
path: ../scripts/source/loop
commands:
help:
about: Describe this script.
exec:
argv:
- bash
- -lc
- 'cat <<''EOF''
loop
A script for automated tasks.
EOF
'
run:
about: Run the script (inlined); forwards args.
exec:
argv:
- bash
- -lc
- "set -euo pipefail\ntmpdir=\"$(mktemp -d)\"\ntrap 'rm -rf \"$tmpdir\"\
' EXIT\ncat >\"$tmpdir/_loop\" <<'JAN_EOF_loop__loop_b4b0be554acf'\n#compdef\
\ loop\n\n# Zsh completion for loop\n# Generated automatically - customize\
\ as needed\n\n_loop() {\n local context state line\n typeset -A\
\ opt_args\n \n _arguments -C \\\n '(-h --help)'{-h,--help}'[Show\
\ help information]' \\\n '(-v --version)'{-v,--version}'[Show\
\ version information]' \\\n '*::arg:_files'\n}\n\n_loop \"$@\"\
\nJAN_EOF_loop__loop_b4b0be554acf\nchmod +x \"$tmpdir/_loop\" 2>/dev/null\
\ || true\ncat >\"$tmpdir/loop.sh\" <<'JAN_EOF_loop_loop_sh_e8600719c96a'\n\
#!/bin/bash \n# (c) 2022 Pat Beagan: MIT License\n\nloop () \n{\n local\
\ shouldClear='false'\t\n if [ \"$1\" == \"-c\" ]; then\n \tshouldClear=\"\
true\"\n\tshift;\n fi;\n\n while :; do\n eval $@;\n \
\ sleep 0.5;\n if [ $shouldClear == \"true\" ]; then\n \
\ clear;\n fi;\n done\n}\n\nloop \"$*\"\ntrackusage \"\
$0\"\nJAN_EOF_loop_loop_sh_e8600719c96a\nchmod +x \"$tmpdir/loop.sh\"\
\ 2>/dev/null || true\ncd \"$tmpdir\"\nexec \"$tmpdir/loop.sh\" \"$@\"\
\n"
passthrough: true
magic-collector:
about: A robust CLI tool that collects Kotlin files containing magic comments,
optionally strips imports, and creates a ZIP archive with preserved directory
structure.
path: ../scripts/source/magic-collector
commands:
help:
about: Describe this script.
exec:
argv:
- bash
- -lc
- 'cat <<''EOF''
magic-collector
A robust CLI tool that collects Kotlin files containing magic comments,
optionally strips imports, and creates a ZIP archive with preserved directory
structure.
EOF
'
run:
about: Run the script (inlined); forwards args.
exec:
argv:
- bash
- -lc
- "set -euo pipefail\ntmpdir=\"$(mktemp -d)\"\ntrap 'rm -rf \"$tmpdir\"\
' EXIT\ncat >\"$tmpdir/_magic-collector\" <<'JAN_EOF_magic_collector__magic_collector_51047fedc589'\n\
#compdef magic-collector\n\n# Zsh completion for magic-collector\n# Generated\
\ automatically - customize as needed\n# Usage: magic-collector.py <root>\
\ [options]\n\n_magic-collector() {\n local context state line\n \
\ typeset -A opt_args\n \n _arguments -C \\\n '(-h --help)'{-h,--help}'[Show\
\ help information]' \\\n '(-v --version)'{-v,--version}'[Show\
\ version information]' \\\n '--strip-imports[Remove import statements\
\ from copied files]' \\\n '--zip-out[Explicit path for the output\
\ zip file]:zip file:_files' \\\n '--keep-temp[Keep temporary working\
\ directory after zipping]' \\\n '--verbose[Enable debug logging]'\
\ \\\n '1:root directory:_files -/'\n}\n\n_magic-collector \"$@\"\
\nJAN_EOF_magic_collector__magic_collector_51047fedc589\nchmod +x \"$tmpdir/_magic-collector\"\
\ 2>/dev/null || true\ncat >\"$tmpdir/magic-collector.py\" <<'JAN_EOF_magic_collector_magic_collector_py_759225336008'\n\
#!/usr/bin/env python3\n\"\"\"\nMagic Collector - Export source files\
\ with magic comments\n\nA robust CLI tool that collects Kotlin files\
\ containing magic comments,\noptionally strips imports, and creates a\
\ ZIP archive with preserved directory structure.\n\nMagic Comment Format:\n\
The tool searches for files containing the magic comment:\n // MAGIC_IMPORT_ME\n\
\nThis comment can have optional whitespace before the double slash and\
\ after it.\nThe comment is case-sensitive and must be followed by a word\
\ boundary.\nExamples of valid magic comments:\n // MAGIC_IMPORT_ME\n\
\ //MAGIC_IMPORT_ME\n // MAGIC_IMPORT_ME\n // MAGIC_IMPORT_ME\
\ // with trailing comment\n\nFeatures:\n- Flexible magic comment matching\
\ with regex\n- Better import stripping with regex (safe for Kotlin)\n\
- Preserve relative directory structure (avoids collisions)\n- Clean up\
\ temp dir by default, but allow keeping it via --keep-temp\n- Handle\
\ missing ag gracefully (fallback to Python scanning)\n- Exclude .git,\
\ build, and other noisy directories by default\n- Add logging and error\
\ handling\n- Preserve file metadata (timestamps) inside the ZIP\n- Include\
\ unit-testable helper functions\n\nAuthor: Generated from note #278\n\
Version: 1.0.0\nLicense: MIT\n\"\"\"\n\nimport argparse\nimport subprocess\n\
import tempfile\nimport shutil\nimport os\nimport re\nimport sys\nimport\
\ logging\nimport zipfile\nfrom pathlib import Path\n\n# === CONFIGURATION\
\ ===\nMAGIC_COMMENT_PATTERN = r\"//\\s*MAGIC_IMPORT_ME\\b\" # regex\
\ for magic comment\nIMPORT_PATTERN = re.compile(r\"^\\s*import\\s+.*\"\
) # Kotlin import regex\nEXCLUDE_DIRS = {\".git\", \"build\", \".idea\"\
, \".gradle\"}\n\nlogger = logging.getLogger(\"magic_collector\")\n\n\
# === SEARCH ===\ndef find_files_with_magic_comment(root: Path):\n \
\ \"\"\"Find files containing the magic comment using ag if available,\
\ else fallback.\"\"\"\n try:\n subprocess.run([\"ag\", \"--version\"\
], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, check=True)\n\
\ logger.info(\"Using ag (silver searcher) for file search.\")\n\
\ # Build exclude patterns for ag\n exclude_args = []\n\
\ for exclude_dir in EXCLUDE_DIRS:\n exclude_args.extend([\"\
--ignore-dir\", exclude_dir])\n \n result = subprocess.run(\n\
\ [\"ag\", \"-l\"] + exclude_args + [MAGIC_COMMENT_PATTERN,\
\ str(root)],\n stdout=subprocess.PIPE,\n stderr=subprocess.PIPE,\n\
\ text=True,\n check=True\n )\n return\
\ [Path(line.strip()) for line in result.stdout.splitlines()]\n except\
\ (subprocess.CalledProcessError, FileNotFoundError):\n logger.warning(\"\
ag not available or failed, falling back to Python scan.\")\n return\
\ fallback_scan(root)\n\n\ndef fallback_scan(root: Path):\n \"\"\"\
Fallback: recursively scan files under root in Python.\"\"\"\n matches\
\ = []\n for path in root.rglob(\"*.kt\"):\n if any(part in\
\ EXCLUDE_DIRS for part in path.parts):\n continue\n \
\ try:\n text = path.read_text(encoding=\"utf-8\", errors=\"\
ignore\")\n if re.search(MAGIC_COMMENT_PATTERN, text):\n \
\ matches.append(path)\n except Exception as e:\n\
\ logger.error(\"Failed to read %s: %s\", path, e)\n return\
\ matches\n\n# === FILE PROCESSING ===\ndef process_and_copy(src: Path,\
\ dst: Path, strip_imports: bool):\n \"\"\"Process one file: remove\
\ magic comment and optionally imports.\"\"\"\n dst.parent.mkdir(parents=True,\
\ exist_ok=True)\n\n with src.open(\"r\", encoding=\"utf-8\", errors=\"\
ignore\") as f_in, \\\n dst.open(\"w\", encoding=\"utf-8\") as\
\ f_out:\n for line in f_in:\n if re.search(MAGIC_COMMENT_PATTERN,\
\ line):\n continue\n if strip_imports and IMPORT_PATTERN.match(line):\n\
\ continue\n f_out.write(line)\n\n shutil.copystat(src,\
\ dst) # preserve metadata\n\n# === ZIPPING ===\ndef make_zip_from_dir(src_dir:\
\ Path, zip_path: Path):\n \"\"\"Create a zip archive from src_dir.\"\
\"\"\n with zipfile.ZipFile(zip_path, mode=\"w\", compression=zipfile.ZIP_DEFLATED)\
\ as zf:\n for root, _, files in os.walk(src_dir):\n \
\ for fname in files:\n abs_path = Path(root) / fname\n\
\ rel = abs_path.relative_to(src_dir)\n \
\ zf.write(abs_path, arcname=str(rel))\n\n# === MAIN ===\ndef main():\n\
\ parser = argparse.ArgumentParser(\n description=\"Collect\
\ Kotlin files with a magic comment (// MAGIC_IMPORT_ME), optionally strip\
\ imports, and zip them.\"\n )\n parser.add_argument(\"root\", type=Path,\
\ help=\"Root directory of the codebase to scan\")\n parser.add_argument(\"\
--strip-imports\", action=\"store_true\", help=\"Remove import statements\
\ from copied files\")\n parser.add_argument(\"--zip-out\", type=Path,\
\ help=\"Explicit path for the output zip file\")\n parser.add_argument(\"\
--keep-temp\", action=\"store_true\", help=\"Keep temporary working directory\
\ after zipping\")\n parser.add_argument(\"--verbose\", action=\"store_true\"\
, help=\"Enable debug logging\")\n\n args = parser.parse_args()\n \
\ logging.basicConfig(level=logging.DEBUG if args.verbose else logging.INFO,\
\ format=\"%(levelname)s: %(message)s\")\n\n if not args.root.exists():\n\
\ logger.error(\"Root directory %s does not exist.\", args.root)\n\
\ sys.exit(1)\n\n files = find_files_with_magic_comment(args.root)\n\
\ if not files:\n logger.info(\"No files found with the magic\
\ comment.\")\n return\n\n tmpdir = Path(tempfile.mkdtemp(prefix=\"\
magic_collect_\"))\n logger.debug(\"Created temp directory at %s\"\
, tmpdir)\n\n for f in files:\n try:\n rel = f.relative_to(args.root)\n\
\ except ValueError:\n rel = f.name # fallback if file\
\ is outside root\n dst = tmpdir / rel\n process_and_copy(f,\
\ dst, args.strip_imports)\n\n zip_path = args.zip_out or Path(tempfile.gettempdir())\
\ / f\"collected_magic_{os.getpid()}.zip\"\n make_zip_from_dir(tmpdir,\
\ zip_path)\n logger.info(\"Created zip at %s\", zip_path)\n\n if\
\ not args.keep_temp:\n shutil.rmtree(tmpdir)\n logger.debug(\"\
Removed temp directory %s\", tmpdir)\n else:\n logger.info(\"\
Temp directory kept at %s\", tmpdir)\n\n print(zip_path) # machine-readable\
\ output\n\nif __name__ == \"__main__\":\n main()\nJAN_EOF_magic_collector_magic_collector_py_759225336008\n\
chmod +x \"$tmpdir/magic-collector.py\" 2>/dev/null || true\ncat >\"$tmpdir/metadata.json\"\
\ <<'JAN_EOF_magic_collector_metadata_json_1aba0c5253bc'\n{\n \"name\"\
: \"magic-collector\",\n \"version\": \"1.0.0\",\n \"description\":\
\ \"A robust CLI tool that collects Kotlin files containing magic comments,\
\ optionally strips imports, and creates a ZIP archive with preserved\
\ directory structure.\",\n \"author\": \"Generated from note #278\"\
,\n \"license\": \"MIT\",\n \"type\": \"script\",\n \"language\": \"\
python\",\n \"executable\": \"magic-collector.py\",\n \"source_path\"\
: \"source/magic-collector/magic-collector.py\",\n \"install_path\":\
\ \"dist/magic-collector\",\n \"completion_path\": \"completions/_magic-collector\"\
,\n \"tags\": [\"kotlin\", \"file-processing\", \"zip\", \"cli\", \"\
automation\"],\n \"dependencies\": [],\n \"requirements\": [\n \"\
Python 3.6+\",\n \"Optional: ag (silver searcher) for faster file discovery\"\
\n ],\n \"features\": [\n \"Flexible magic comment detection with\
\ regex\",\n \"Import stripping for Kotlin files\",\n \"Directory\
\ structure preservation\",\n \"Smart file discovery with ag fallback\"\
,\n \"Noise filtering (excludes build directories)\",\n \"Metadata\
\ preservation\",\n \"Temporary directory management\",\n \"Comprehensive\
\ logging\"\n ],\n \"usage_examples\": [\n \"magic-collector.py /path/to/codebase\"\
,\n \"magic-collector.py /path/to/codebase --strip-imports\",\n \
\ \"magic-collector.py /path/to/codebase --zip-out output.zip --verbose\"\
\n ]\n}\nJAN_EOF_magic_collector_metadata_json_1aba0c5253bc\nchmod +x\
\ \"$tmpdir/metadata.json\" 2>/dev/null || true\ncd \"$tmpdir\"\nexec\
\ \"$tmpdir/magic-collector.py\" \"$@\"\n"
passthrough: true
manbash:
about: A script for automated tasks.
path: ../scripts/source/manbash
commands:
help:
about: Describe this script.
exec:
argv:
- bash
- -lc
- 'cat <<''EOF''
manbash
A script for automated tasks.
EOF
'
run:
about: Run the script (inlined); forwards args.
exec:
argv:
- bash
- -lc
- "set -euo pipefail\ntmpdir=\"$(mktemp -d)\"\ntrap 'rm -rf \"$tmpdir\"\
' EXIT\ncat >\"$tmpdir/_manbash\" <<'JAN_EOF_manbash__manbash_bf9eb913968b'\n\
#compdef manbash\n\n# Zsh completion for manbash\n# Generated automatically\
\ - customize as needed\n\n_manbash() {\n local context state line\n\
\ typeset -A opt_args\n \n _arguments -C \\\n '(-h --help)'{-h,--help}'[Show\
\ help information]' \\\n '(-v --version)'{-v,--version}'[Show\
\ version information]' \\\n '*::arg:_files'\n}\n\n_manbash \"\
$@\"\nJAN_EOF_manbash__manbash_bf9eb913968b\nchmod +x \"$tmpdir/_manbash\"\
\ 2>/dev/null || true\ncat >\"$tmpdir/manbash.sh\" <<'JAN_EOF_manbash_manbash_sh_decdbba58a6e'\n\
#!/bin/bash \n# (c) 2022 Pat Beagan: MIT License\n\nmanbash () \n{ \n\
\ man -P \"less '+/^ *'${1}\" bash\n}\n\nmanbash \"$@\"\ntrackusage\
\ \"$0\"\nJAN_EOF_manbash_manbash_sh_decdbba58a6e\nchmod +x \"$tmpdir/manbash.sh\"\
\ 2>/dev/null || true\ncd \"$tmpdir\"\nexec \"$tmpdir/manbash.sh\" \"\
$@\"\n"
passthrough: true
manbook:
about: A script for automated tasks.
path: ../scripts/source/manbook
commands:
help:
about: Describe this script.
exec:
argv:
- bash
- -lc
- 'cat <<''EOF''
manbook
A script for automated tasks.
EOF
'
run:
about: Run the script (inlined); forwards args.
exec:
argv:
- bash
- -lc
- "set -euo pipefail\ntmpdir=\"$(mktemp -d)\"\ntrap 'rm -rf \"$tmpdir\"\
' EXIT\ncat >\"$tmpdir/_manbook\" <<'JAN_EOF_manbook__manbook_3d1a5bcc6d5d'\n\
#compdef manbook\n\n# Zsh completion for manbook\n# Generated automatically\
\ - customize as needed\n\n_manbook() {\n local context state line\n\
\ typeset -A opt_args\n \n _arguments -C \\\n '(-h --help)'{-h,--help}'[Show\
\ help information]' \\\n '(-v --version)'{-v,--version}'[Show\
\ version information]' \\\n '*::arg:_files'\n}\n\n_manbook \"\
$@\"\nJAN_EOF_manbook__manbook_3d1a5bcc6d5d\nchmod +x \"$tmpdir/_manbook\"\
\ 2>/dev/null || true\ncat >\"$tmpdir/manbook.sh\" <<'JAN_EOF_manbook_manbook_sh_6d10e1d9f2d7'\n\
#!/bin/bash \n# (c) 2022 Pat Beagan: MIT License\n\nmanbook () \n{ \n\
\ cat $1 | groff -man -Tps > book.ps\n}\n\nmanbook \"$@\"\ntrackusage\
\ \"$0\"\nJAN_EOF_manbook_manbook_sh_6d10e1d9f2d7\nchmod +x \"$tmpdir/manbook.sh\"\
\ 2>/dev/null || true\ncd \"$tmpdir\"\nexec \"$tmpdir/manbook.sh\" \"\
$@\"\n"
passthrough: true
math:
about: A script for automated tasks.
path: ../scripts/source/math
commands:
help:
about: Describe this script.
exec:
argv:
- bash
- -lc
- 'cat <<''EOF''
math
A script for automated tasks.
EOF
'
run:
about: Run the script (inlined); forwards args.
exec:
argv:
- bash
- -lc
- "set -euo pipefail\ntmpdir=\"$(mktemp -d)\"\ntrap 'rm -rf \"$tmpdir\"\
' EXIT\ncat >\"$tmpdir/_math\" <<'JAN_EOF_math__math_28673299b68b'\n#compdef\
\ math\n\n# Zsh completion for math\n# Generated automatically - customize\
\ as needed\n\n_math() {\n local context state line\n typeset -A\
\ opt_args\n \n _arguments -C \\\n '(-h --help)'{-h,--help}'[Show\
\ help information]' \\\n '(-v --version)'{-v,--version}'[Show\
\ version information]' \\\n '*::arg:_files'\n}\n\n_math \"$@\"\
\nJAN_EOF_math__math_28673299b68b\nchmod +x \"$tmpdir/_math\" 2>/dev/null\
\ || true\ncat >\"$tmpdir/math.sh\" <<'JAN_EOF_math_math_sh_ac03b1e9f611'\n\
#!/bin/bash \n# (c) 2022 Pat Beagan: MIT License\n\nmath () \n{ \n \
\ echo \"$*\" | bc -l\n}\n\nmath \"$@\"\ntrackusage \"$0\"\nJAN_EOF_math_math_sh_ac03b1e9f611\n\
chmod +x \"$tmpdir/math.sh\" 2>/dev/null || true\ncd \"$tmpdir\"\nexec\
\ \"$tmpdir/math.sh\" \"$@\"\n"
passthrough: true
mean:
about: A script for automated tasks.
path: ../scripts/source/mean
commands:
help:
about: Describe this script.
exec:
argv:
- bash
- -lc
- 'cat <<''EOF''
mean
A script for automated tasks.
EOF
'
run:
about: Run the script (inlined); forwards args.
exec:
argv:
- bash
- -lc
- "set -euo pipefail\ntmpdir=\"$(mktemp -d)\"\ntrap 'rm -rf \"$tmpdir\"\
' EXIT\ncat >\"$tmpdir/_mean\" <<'JAN_EOF_mean__mean_e8b53ce40f5f'\n#compdef\
\ mean\n\n# Zsh completion for mean\n# Generated automatically - customize\
\ as needed\n\n_mean() {\n local context state line\n typeset -A\
\ opt_args\n \n _arguments -C \\\n '(-h --help)'{-h,--help}'[Show\
\ help information]' \\\n '(-v --version)'{-v,--version}'[Show\
\ version information]' \\\n '*::arg:_files'\n}\n\n_mean \"$@\"\
\nJAN_EOF_mean__mean_e8b53ce40f5f\nchmod +x \"$tmpdir/_mean\" 2>/dev/null\
\ || true\ncat >\"$tmpdir/mean.sh\" <<'JAN_EOF_mean_mean_sh_897eba1e9b09'\n\
#!/bin/bash \n# (c) 2022 Pat Beagan: MIT License\n\nmean () \n{ \n \
\ math $(sum \"$1\")/$(count_list \"$1\")\n}\n\nmean \"$@\"\ntrackusage\
\ \"$0\"\nJAN_EOF_mean_mean_sh_897eba1e9b09\nchmod +x \"$tmpdir/mean.sh\"\
\ 2>/dev/null || true\ncd \"$tmpdir\"\nexec \"$tmpdir/mean.sh\" \"$@\"\
\n"
passthrough: true
median:
about: A script for automated tasks.
path: ../scripts/source/median
commands:
help:
about: Describe this script.
exec:
argv:
- bash
- -lc
- 'cat <<''EOF''
median
A script for automated tasks.
EOF
'
run:
about: Run the script (inlined); forwards args.
exec:
argv:
- bash
- -lc
- "set -euo pipefail\ntmpdir=\"$(mktemp -d)\"\ntrap 'rm -rf \"$tmpdir\"\
' EXIT\ncat >\"$tmpdir/_median\" <<'JAN_EOF_median__median_e964f2392009'\n\
#compdef median\n\n# Zsh completion for median\n# Generated automatically\
\ - customize as needed\n\n_median() {\n local context state line\n\
\ typeset -A opt_args\n \n _arguments -C \\\n '(-h --help)'{-h,--help}'[Show\
\ help information]' \\\n '(-v --version)'{-v,--version}'[Show\
\ version information]' \\\n '*::arg:_files'\n}\n\n_median \"$@\"\
\nJAN_EOF_median__median_e964f2392009\nchmod +x \"$tmpdir/_median\" 2>/dev/null\
\ || true\ncat >\"$tmpdir/median.sh\" <<'JAN_EOF_median_median_sh_3a6ba52e46fb'\n\
#!/bin/bash \n# (c) 2022 Pat Beagan: MIT License\n\nmedian () \n{ \n \
\ echo -e \"$1\" | tr ',' '\\n' | sort -n | awk '{arr[NR]=$1}\n END\
\ { if (NR%2==1) print arr[(NR+1)/2]; else print (arr[NR/2]+arr[NR/2+1])/2}'\n\
}\n\nmedian \"$@\"\ntrackusage \"$0\"\nJAN_EOF_median_median_sh_3a6ba52e46fb\n\
chmod +x \"$tmpdir/median.sh\" 2>/dev/null || true\ncd \"$tmpdir\"\nexec\
\ \"$tmpdir/median.sh\" \"$@\"\n"
passthrough: true
metadata_purge:
about: A script for automated tasks.
path: ../scripts/source/metadata_purge
commands:
help:
about: Describe this script.
exec:
argv:
- bash
- -lc
- 'cat <<''EOF''
metadata_purge
A script for automated tasks.
EOF
'
run:
about: Run the script (inlined); forwards args.
exec:
argv:
- bash
- -lc
- "set -euo pipefail\ntmpdir=\"$(mktemp -d)\"\ntrap 'rm -rf \"$tmpdir\"\
' EXIT\ncat >\"$tmpdir/_metadata_purge\" <<'JAN_EOF_metadata_purge__metadata_purge_f5a6da7e01f9'\n\
#compdef metadata_purge\n\n# Zsh completion for metadata_purge\n# Generated\
\ automatically - customize as needed\n\n_metadata_purge() {\n local\
\ context state line\n typeset -A opt_args\n \n _arguments -C\
\ \\\n '(-h --help)'{-h,--help}'[Show help information]' \\\n \
\ '(-v --version)'{-v,--version}'[Show version information]' \\\n\
\ '*::arg:_files'\n}\n\n_metadata_purge \"$@\"\nJAN_EOF_metadata_purge__metadata_purge_f5a6da7e01f9\n\
chmod +x \"$tmpdir/_metadata_purge\" 2>/dev/null || true\ncat >\"$tmpdir/metadata_purge.sh\"\
\ <<'JAN_EOF_metadata_purge_metadata_purge_sh_e73cd39112a3'\n#!/bin/bash\n\
# (c) 2022 Pat Beagan: MIT License\n\nmetadata_purge () \n{ \n for\
\ i in *.jpg;\n do\n echo \"Processing $i\";\n exiftool\
\ -all= \"$i\";\n done\n}\n\nmetatdata_purge \"$@\"\ntrackusage \"\
$0\"\nJAN_EOF_metadata_purge_metadata_purge_sh_e73cd39112a3\nchmod +x\
\ \"$tmpdir/metadata_purge.sh\" 2>/dev/null || true\ncd \"$tmpdir\"\n\
exec \"$tmpdir/metadata_purge.sh\" \"$@\"\n"
passthrough: true
minecraft-photopack:
about: A script for automated tasks.
path: ../scripts/source/minecraft-photopack
commands:
help:
about: Describe this script.
exec:
argv:
- bash
- -lc
- 'cat <<''EOF''
minecraft-photopack
A script for automated tasks.
EOF
'
run:
about: Run the script (inlined); forwards args.
exec:
argv:
- bash
- -lc
- "set -euo pipefail\ntmpdir=\"$(mktemp -d)\"\ntrap 'rm -rf \"$tmpdir\"\
' EXIT\ncat >\"$tmpdir/_minecraft-photopack\" <<'JAN_EOF_minecraft_photopack__minecraft_photopack_4f83d8051b80'\n\
#compdef minecraft-photopack\n\n# Zsh completion for minecraft-photopack\n\
# Generated automatically - customize as needed\n\n_minecraft-photopack()\
\ {\n local context state line\n typeset -A opt_args\n \n \
\ _arguments -C \\\n '(-h --help)'{-h,--help}'[Show help information]'\
\ \\\n '(-v --version)'{-v,--version}'[Show version information]'\
\ \\\n '*::arg:_files'\n}\n\n_minecraft-photopack \"$@\"\nJAN_EOF_minecraft_photopack__minecraft_photopack_4f83d8051b80\n\
chmod +x \"$tmpdir/_minecraft-photopack\" 2>/dev/null || true\ncat >\"\
$tmpdir/minecraft-photopack.sh\" <<'JAN_EOF_minecraft_photopack_minecraft_photopack_sh_4d8c4c1daf15'\n\
#!/usr/bin/env zsh\n# (c) 2022 Pat Beagan: MIT License\n\nset -euo pipefail\n\
IFS=$'\\n\\t'\n\nhelp() {\n error_code=$?\n echo \"\n---\nConverts\
\ a list of images into a minecraft painting resource pack\n\nPlease make\
\ sure that any listed images are valid.\n\"\n exit $error_code\n}\n\
\ncsv=(\n '16,16,alban'\n '16,16,aztec'\n '16,16,aztec2'\n \
\ '16,16,bomb'\n '16,16,kebab'\n '16,16,plant'\n '16,16,wasteland'\n\
\ '32,16,courbet'\n '32,16,pool'\n '32,16,sea'\n '32,16,creebet'\n\
\ '32,16,sunset'\n '16,32,graham'\n '16,32,wanderer'\n '32,32,bust'\n\
\ '32,32,match'\n '32,32,skull_and_roses'\n '32,32,stage'\n \
\ '32,32,void'\n '32,32,wither'\n '64,32,fighters'\n '64,48,donkey_kong'\n\
\ '64,48,skeleton'\n '64,64,burning_skull'\n '64,64,pigscene'\n\
\ '64,64,pointer'\n)\n\nminecraft-photopack() {\n\n local timestamp=$(date\
\ +%s)\n local output_folder=\"painting-pack-$timestamp\"\n mkdir\
\ \"$output_folder\"\n echo '{\n \"pack\": {\n \"pack_format\"\
: 9,\n \"description\":'\"Painting pack $timestamp\"'\n }\n}' >> \"\
$output_folder\"/pack.mcmeta\n echo 'Generated painting pack' >> \"\
$output_folder\"/README.txt\n mkdir -p \"$output_folder\"/assets/minecraft/textures/painting\n\
\ wget -O \"$output_folder\"/pack.png https://upload.wikimedia.org/wikipedia/commons/5/57/Tiny6pixel.png\n\
\n local scale=3\n\n for i in $csv; do\n # read one line\n\
\ IFS=, read -rA array <<<\"$i\"\n\n local filename=\"unchanged\"\
\n if [ $# -gt 0 ]; then\n filename=\"$1\"\n\n \
\ array[1]=$(( $array[1] * $scale ))\n array[2]=$(( $array[2]\
\ * $scale ))\n\n magick \\\n convert $filename\
\ \\\n -resize $array[1]x$array[2]^ \\\n \
\ -gravity center \\\n -extent $array[1]x$array[2] \\\n\
\ -flatten \\\n -strip \\\n \
\ -colorspace RGB \\\n -depth 24 \\\n \
\ -define png:compression-filter=1 \\\n -define png:compression-level=9\
\ \\\n -define png:compression-strategy=2 \\\n \
\ unoptimized_$array[3].png || return 1\n\n local\
\ input=unoptimized_$array[3].png\n local output=\"$output_folder\"\
/assets/minecraft/textures/painting/$array[3].png\n\n if\
\ which pngcrush &>/dev/null; then\n pngcrush \"$input\"\
\ \"$output\"\n else\n mv \"$input\"\
\ \"$output\"\n fi\n\n rm \"$input\"\n \
\ shift\n fi\n\n echo \"$array[@] = $filename\"\
\n done\n}\n\nminecraft-photopack \"$@\" || help\ntrackusage \"$0\"\
\nJAN_EOF_minecraft_photopack_minecraft_photopack_sh_4d8c4c1daf15\nchmod\
\ +x \"$tmpdir/minecraft-photopack.sh\" 2>/dev/null || true\ncd \"$tmpdir\"\
\nexec \"$tmpdir/minecraft-photopack.sh\" \"$@\"\n"
passthrough: true
module-dependencies:
about: A script for automated tasks.
path: ../scripts/source/module-dependencies
commands:
help:
about: Describe this script.
exec:
argv:
- bash
- -lc
- 'cat <<''EOF''
module-dependencies
A script for automated tasks.
EOF
'
run:
about: Run the script (inlined); forwards args.
exec:
argv:
- bash
- -lc
- "set -euo pipefail\ntmpdir=\"$(mktemp -d)\"\ntrap 'rm -rf \"$tmpdir\"\
' EXIT\ncat >\"$tmpdir/_module-dependencies\" <<'JAN_EOF_module_dependencies__module_dependencies_136fac5f2116'\n\
#compdef module-dependencies\n\n# Zsh completion for module-dependencies\n\
# Generated automatically - customize as needed\n\n\n_module-dependencies()\
\ {\n local context state line\n typeset -A opt_args\n \n \
\ _arguments -C \\\n '(-h --help)'{-h,--help}'[Show help information]'\
\ \\\n '(-v --version)'{-v,--version}'[Show version information]'\
\ \\\n '-n[Custom option]' \\ '*::arg:_files'\n}\n\n_module-dependencies\
\ \"$@\"\nJAN_EOF_module_dependencies__module_dependencies_136fac5f2116\n\
chmod +x \"$tmpdir/_module-dependencies\" 2>/dev/null || true\ncat >\"\
$tmpdir/module-dependencies.zsh\" <<'JAN_EOF_module_dependencies_module_dependencies_zsh_daf9fcc9fe67'\n\
#!/bin/zsh\n\n:<< COMMENT\nThis will print all of the import statements\
\ which are in files under the \ncurrent directory. It can be used to\
\ plan for what kind of module we'll \nneed to create in order to extract\
\ all of the contents of the current folder.\nCOMMENT\n\nag import --nogroup\
\ --nofilename | sed 's/;//g' | sort | uniq\nJAN_EOF_module_dependencies_module_dependencies_zsh_daf9fcc9fe67\n\
chmod +x \"$tmpdir/module-dependencies.zsh\" 2>/dev/null || true\ncd \"\
$tmpdir\"\nexec \"$tmpdir/module-dependencies.zsh\" \"$@\"\n"
passthrough: true
mountcd:
about: A script for automated tasks.
path: ../scripts/source/mountcd
commands:
help:
about: Describe this script.
exec:
argv:
- bash
- -lc
- 'cat <<''EOF''
mountcd
A script for automated tasks.
EOF
'
run:
about: Run the script (inlined); forwards args.
exec:
argv:
- bash
- -lc
- "set -euo pipefail\ntmpdir=\"$(mktemp -d)\"\ntrap 'rm -rf \"$tmpdir\"\
' EXIT\ncat >\"$tmpdir/_mountcd\" <<'JAN_EOF_mountcd__mountcd_63eeaa8789f5'\n\
#compdef mountcd\n\n# Zsh completion for mountcd\n# Generated automatically\
\ - customize as needed\n\n_mountcd() {\n local context state line\n\
\ typeset -A opt_args\n \n _arguments -C \\\n '(-h --help)'{-h,--help}'[Show\
\ help information]' \\\n '(-v --version)'{-v,--version}'[Show\
\ version information]' \\\n '*::arg:_files'\n}\n\n_mountcd \"\
$@\"\nJAN_EOF_mountcd__mountcd_63eeaa8789f5\nchmod +x \"$tmpdir/_mountcd\"\
\ 2>/dev/null || true\ncat >\"$tmpdir/mountcd.sh\" <<'JAN_EOF_mountcd_mountcd_sh_e57303a2f691'\n\
#!/bin/bash \n# (c) 2022 Pat Beagan: MIT License\n\nmountcd () \n{ \n\
\ mount /path/to/file.iso /mnt/cdrom -oloop\n}\n\nmountcd \"$@\"\n\
trackusage \"$0\"\nJAN_EOF_mountcd_mountcd_sh_e57303a2f691\nchmod +x \"\
$tmpdir/mountcd.sh\" 2>/dev/null || true\ncd \"$tmpdir\"\nexec \"$tmpdir/mountcd.sh\"\
\ \"$@\"\n"
passthrough: true
mtg-booster:
about: A script for automated tasks.
path: ../scripts/source/mtg-booster
commands:
help:
about: Describe this script.
exec:
argv:
- bash
- -lc
- 'cat <<''EOF''
mtg-booster
A script for automated tasks.
EOF
'
run:
about: Run the script (inlined); forwards args.
exec:
argv:
- bash
- -lc
- "set -euo pipefail\ntmpdir=\"$(mktemp -d)\"\ntrap 'rm -rf \"$tmpdir\"\
' EXIT\ncat >\"$tmpdir/_mtg-booster\" <<'JAN_EOF_mtg_booster__mtg_booster_169e681eef64'\n\
#compdef mtg-booster\n\n# Zsh completion for mtg-booster\n# Generated\
\ automatically - customize as needed\n\n_mtg-booster() {\n local context\
\ state line\n typeset -A opt_args\n \n _arguments -C \\\n \
\ '(-h --help)'{-h,--help}'[Show help information]' \\\n '(-v\
\ --version)'{-v,--version}'[Show version information]' \\\n '*::arg:_files'\n\
}\n\n_mtg-booster \"$@\"\nJAN_EOF_mtg_booster__mtg_booster_169e681eef64\n\
chmod +x \"$tmpdir/_mtg-booster\" 2>/dev/null || true\ncat >\"$tmpdir/mtg-booster.js\"\
\ <<'JAN_EOF_mtg_booster_mtg_booster_js_2ce44b41de58'\n#!/usr/bin/env\
\ -S deno run --allow-net --allow-write --allow-read --allow-run\n\nimport\
\ { compress } from \"https://deno.land/x/zip@v1.2.3/mod.ts\";\n\nconst\
\ startUrl = \"https://api.scryfall.com/cards/search\" +\n \"?format=json\"\
\ +\n \"&include_extras=true\" +\n \"&include_multilingual=false\" +\n\
\ \"&include_variations=true\" +\n \"&order=set\" +\n \"&page=1\" +\n\
\ \"&q=e%3A\" +\n \"sok\" +\n // \"neo\" +\n // \"dmu\" +\n \"&unique=prints\"\
;\n\nconst manaTypeRegex = /[A-Z]/gi;\nconst uniq = (value, index, self)\
\ => self.indexOf(value) === index;\n\nconst groupCardsByRarity = (cards)\
\ => cards\n .filter((it) => it)\n .filter((it) => !it.isBasicLand &&\
\ !it.isToken)\n .reduce((acc, value) => {\n if (!acc[value.rarity])\
\ {\n acc[value.rarity] = [];\n }\n acc[value.rarity].push(value);\n\
\ return acc;\n }, {});\n\nconst groupCardsByMana = (cards) => cards\n\
\ .filter((it) => it)\n .reduce((acc, value) => {\n if (!acc[value.manaType])\
\ {\n acc[value.manaType] = [];\n }\n acc[value.manaType].push(value);\n\
\ return acc;\n }, {});\n\nfunction getCards(url) {\n console.log(\"\
Visit next page\");\n return fetch(url)\n .then((response) => response.json())\n\
\ .then(async (response) => {\n const out = response.data.map((it)\
\ => {\n try {\n const manaType = it.mana_cost.match(manaTypeRegex)\n\
\ const priceUSDstr = it.prices[\"usd\"]\n return {\n\
\ id: it.collector_number,\n name: it.name,\n \
\ rarity: it.rarity,\n scryfall_uri: it.scryfall_uri,\n\
\ image_url: it.image_uris.small,\n isBasicLand:\
\ it.type_line.includes(\"Basic Land\"),\n isToken: it.type_line.includes(\"\
Token\"),\n manaType: manaType ? manaType.filter(uniq).sort().join(\"\
\") : \"-\",\n convertedManaCost: it.cmc,\n price:\
\ priceUSDstr ? parseFloat(priceUSDstr) : -1\n };\n }\
\ catch (e) {\n console.log(e)\n console.log(it)\n \
\ return null\n }\n });\n if (response.has_more)\
\ {\n out.push.apply(out, await getCards(response.next_page));\n\
\ }\n return out.filter((it) => it);\n })\n .catch((error)\
\ => console.log(error));\n}\n\nasync function generateDeck(numBoosters,\
\ resolvedCards, cardsByRarity, indexDeck) {\n const allCards = [];\n\
\ const genFiles = []\n\n // generating booster files\n await generateBoosterFiles(resolvedCards.filter((it)\
\ => it));\n\n // using the generated booster info to create filtered\
\ sets based on mana type\n const cardsByMana = groupCardsByMana(allCards.flat());\n\
\ await writeManaGroupedPages(cardsByMana);\n await writePricePage(allCards,\
\ genFiles);\n await writeIndexFile(cardsByMana, numBoosters, genFiles);\n\
\ await writeAllCardsPage(allCards, genFiles);\n\n await compress(genFiles,\
\ `sealed-deck-${indexDeck}.zip`, { overwrite: true });\n\n genFiles.forEach(element\
\ => {\n Deno.remove(element)\n });\n\n async function writeAllCardsPage(allCards,\
\ genFiles) {\n const filename = \"mtg-all-cards.html\";\n const\
\ sortedCards = sortByField(\n sortByField(\n sortByField(\n\
\ allCards.flat(),\n \"id\"),\n \"convertedManaCost\"\
),\n \"manaType\"\n )\n\n const output = createAllCardsContent(sortedCards);\n\
\ genFiles.push(filename);\n await Deno.writeTextFile(filename,\
\ output);\n\n function createAllCardsContent(cards) {\n return\
\ `\n <html><body>\n <div style=\"display: flex; flex-wrap:\
\ wrap;\">\n ${cards.filter((it) => it).map((it, index) => {\n \
\ return `\n <div id=\"${index}\">\n <a href=\"${it.scryfall_uri}\"\
>\n <img src=\"${it.image_url}\"/>\n </a>\n <div onclick=\"\
rmCard(${index})\">\n Remove\n </div>\n </div>`;\n \
\ }).join(\"\\n\")}\n </div>\n <script>\n function rmCard(cardId)\
\ {\n document.getElementById(cardId).style.display = \"none\"\n\
\ }\n </script>\n </body></html>\n `;\n }\n }\n\n\
\ async function generateBoosterFiles(resolvedCards) {\n for (let\
\ index = 0; index < numBoosters; index++) {\n const cards = await\
\ buildBooster(resolvedCards, cardsByRarity);\n allCards.push(cards);\n\
\ console.log(cards.map((it) => it ? it.name : \"UNKNOWN\"));\n \
\ const output = createBoosterFileContent(cards);\n const filename\
\ = `mtg-booster-${index}.html`;\n genFiles.push(filename);\n \
\ await Deno.writeTextFile(filename, output);\n }\n\n\n function\
\ buildBooster(allCards, cardsByRarity) {\n const getRandomFromArray\
\ = (arr) => arr[Math.floor(Math.random() * arr.length)];\n\n function\
\ getRandomByRarity(cardsByRarity, rarity) {\n try {\n \
\ return cardsByRarity[rarity][\n Math.floor(Math.random()\
\ * cardsByRarity[rarity].length)\n ];\n } catch (e) {\n\
\ console.log(e)\n console.log(cardsByRarity);\n \
\ console.log(rarity);\n return []\n }\n }\n\
\n const findBasicLands = (cards) => cards\n .filter((it)\
\ => it.isBasicLand);\n\n return [\n Array(10).fill(0).map(()\
\ => getRandomByRarity(cardsByRarity, \"common\")),\n Array(3).fill(0).map(()\
\ => getRandomByRarity(cardsByRarity, \"uncommon\")),\n [\n \
\ Math.floor(Math.random() * 8) === 0\n ? getRandomByRarity(cardsByRarity,\
\ \"mythic\")\n : getRandomByRarity(cardsByRarity, \"rare\"\
),\n ],\n [getRandomFromArray(findBasicLands(allCards))],\n\
\ ].flatMap((it) => it);\n }\n }\n\n async function writeManaGroupedPages(cardsByMana)\
\ {\n for (const key in cardsByMana) {\n if (Object.hasOwnProperty.call(cardsByMana,\
\ key)) {\n const element = cardsByMana[key];\n const output\
\ = createBoosterFileContent(element);\n const filename = `mtg-booster-filtered-${key}.html`;\n\
\ genFiles.push(filename);\n await Deno.writeTextFile(filename,\
\ output);\n }\n }\n }\n}\n\nasync function writePricePage(allCards,\
\ genFiles) {\n const cardsByPrice = sortByField(allCards.flat(), \"\
price\").filter((it) => it)\n const output = `\n <html><body>\n ${cardsByPrice.map((it)\
\ => `<a href=\"${it.scryfall_uri}\"><div>${it.name}: ${it.price}</div></a>`).join(\"\
\\n\")}\n </body></html>\n `;\n const filename = `mtg-price.html`;\n\
\ genFiles.push(filename);\n await Deno.writeTextFile(filename, output);\n\
}\n\nfunction sortByField(arr, field) {\n function byField(field) {\n\
\ return (a, b) => {\n if (a[field] > b[field]) {\n return\
\ -1;\n } else if (a[field] < b[field]) {\n return 1;\n \
\ } else {\n return 0;\n }\n };\n }\n return arr.sort(byField(field))\n\
}\n\nasync function writeIndexFile(cardsByMana, numBoosters, genFiles)\
\ {\n const filename = \"index.html\";\n const output = createIndexFileContent(cardsByMana,\
\ numBoosters);\n genFiles.push(filename);\n await Deno.writeTextFile(filename,\
\ output);\n\n function createIndexFileContent(cardsByMana, numBoosters)\
\ {\n const lines = []\n for (let index = 0; index < numBoosters;\
\ index++) {\n lines.push(`<a href=\"./mtg-booster-${index}.html\"\
><div>Booster #${index}</div></a>`)\n }\n lines.push('<hr>')\n \
\ const keys = []\n for (const key in cardsByMana) {\n keys.push(key)\n\
\ }\n keys.sort().forEach(key => {\n if (Object.hasOwnProperty.call(cardsByMana,\
\ key)) {\n const element = cardsByMana[key];\n lines.push(`<a\
\ href=\"./mtg-booster-filtered-${key}.html\"><div>${key}: <strong>${element.length}</strong>\
\ cards</div></a>`)\n }\n })\n lines.push('<hr>')\n lines.push(`<a\
\ href=\"./mtg-price.html\"><div>Cards by price</a>`)\n lines.push(`<a\
\ href=\"./mtg-all-cards.html\"><div>All cards</a>`)\n return `\n \
\ <html><body>\n ${lines.flat().join(\"\\n\")}\n </body></html>\n`\n\
\ }\n}\n\nfunction createBoosterFileContent(cards) {\n return `\n <html><body>\n\
\ ${cards.filter((it) => it).map((it) => `<a href=\"${it.scryfall_uri}\"\
><img src=\"${it.image_url}\"/></a>`\n ).join(\"\\n\")}\n </body></html>\n\
`;\n}\n\nasync function main() {\n console.log(startUrl);\n const resolvedCards\
\ = await getCards(startUrl);;\n\n const cardsByRarity = groupCardsByRarity(resolvedCards);\n\
\ const numBoosters = 6;\n const numDecks = 3;\n for (let indexDeck\
\ = 0; indexDeck < numDecks; indexDeck++) {\n await generateDeck(numBoosters,\
\ resolvedCards, cardsByRarity, indexDeck);\n }\n console.log(startUrl)\n\
}\nmain();\nJAN_EOF_mtg_booster_mtg_booster_js_2ce44b41de58\nchmod +x\
\ \"$tmpdir/mtg-booster.js\" 2>/dev/null || true\ncd \"$tmpdir\"\nexec\
\ \"$tmpdir/mtg-booster.js\" \"$@\"\n"
passthrough: true
multiline:
about: A script for automated tasks.
path: ../scripts/source/multiline
commands:
help:
about: Describe this script.
exec:
argv:
- bash
- -lc
- 'cat <<''EOF''
multiline
A script for automated tasks.
EOF
'
run:
about: Run the script (inlined); forwards args.
exec:
argv:
- bash
- -lc
- "set -euo pipefail\ntmpdir=\"$(mktemp -d)\"\ntrap 'rm -rf \"$tmpdir\"\
' EXIT\ncat >\"$tmpdir/_multiline\" <<'JAN_EOF_multiline__multiline_3b778677bb61'\n\
#compdef multiline\n\n# Zsh completion for multiline\n# Generated automatically\
\ - customize as needed\n\n_multiline() {\n local context state line\n\
\ typeset -A opt_args\n \n _arguments -C \\\n '(-h --help)'{-h,--help}'[Show\
\ help information]' \\\n '(-v --version)'{-v,--version}'[Show\
\ version information]' \\\n '*::arg:_files'\n}\n\n_multiline \"\
$@\"\nJAN_EOF_multiline__multiline_3b778677bb61\nchmod +x \"$tmpdir/_multiline\"\
\ 2>/dev/null || true\ncat >\"$tmpdir/multiline.sh\" <<'JAN_EOF_multiline_multiline_sh_adced3dccfa0'\n\
#!/bin/bash\n# (c) 2022 Pat Beagan: MIT License\n\nmultiline () \n{ \n\
\ echo \"$@\" | tr \" \" \"\\n\"\n}\n\nmultiline \"$@\"\ntrackusage\
\ \"$0\"\nJAN_EOF_multiline_multiline_sh_adced3dccfa0\nchmod +x \"$tmpdir/multiline.sh\"\
\ 2>/dev/null || true\ncd \"$tmpdir\"\nexec \"$tmpdir/multiline.sh\" \"\
$@\"\n"
passthrough: true
new-module:
about: A script for automated tasks.
path: ../scripts/source/new-module
commands:
help:
about: Describe this script.
exec:
argv:
- bash
- -lc
- 'cat <<''EOF''
new-module
A script for automated tasks.
EOF
'
run:
about: Run the script (inlined); forwards args.
exec:
argv:
- bash
- -lc
- "set -euo pipefail\ntmpdir=\"$(mktemp -d)\"\ntrap 'rm -rf \"$tmpdir\"\
' EXIT\ncat >\"$tmpdir/_new-module\" <<'JAN_EOF_new_module__new_module_c4fde047f04f'\n\
#compdef new-module\n\n# Zsh completion for new-module\n# Generated automatically\
\ - customize as needed\n\n_new-module() {\n local context state line\n\
\ typeset -A opt_args\n \n _arguments -C \\\n '(-h --help)'{-h,--help}'[Show\
\ help information]' \\\n '(-v --version)'{-v,--version}'[Show\
\ version information]' \\\n '*::arg:_files'\n}\n\n_new-module\
\ \"$@\"\nJAN_EOF_new_module__new_module_c4fde047f04f\nchmod +x \"$tmpdir/_new-module\"\
\ 2>/dev/null || true\ncat >\"$tmpdir/new-module.py\" <<'JAN_EOF_new_module_new_module_py_33955dd7a021'\n\
#!/usr/bin/env python3\n# (c) 2022 Pat Beagan: MIT License\n\nfrom os\
\ import makedirs, path, getcwd\nfrom sys import argv\nimport argparse\n\
from pathlib import Path\n\nroot_dir = path.realpath(getcwd())\n\nprint(getcwd())\n\
\n\ndef to_path(input: str):\n return input.replace(\"-\", \"/\")\n\
\n\ndef to_dotpath(input: str):\n return input.replace(\"-\", \".\"\
)\n\n\ndef package_to_path(input: str):\n return input.replace(\".\"\
, \"/\")\n\n\nclass Gradle:\n\n def __init__(self, module: str, package_name):\n\
\ self.module = module\n self.package_name = package_name\n\
\n def setup_settings_gradle(self):\n settings_file = path.join(root_dir,\
\ \"settings.gradle.kts\")\n lines = []\n Path(settings_file).touch()\n\
\ with open(settings_file, \"r\") as f:\n lines = f.readlines()\n\
\ lines.append(f\"\\ninclude(\\\":{self.module}\\\")\\n\")\n \
\ with open(settings_file, \"w\") as f:\n f.writelines(lines)\n\
\n\nclass GradleAndroid(Gradle):\n\n def run(self):\n self.setup_main_directory()\n\
\ self.setup_test_directory()\n self.setup_build_gradle()\n\
\ self.setup_settings_gradle()\n\n def setup_build_gradle(self):\n\
\ with open(path.join(root_dir, self.module, \"build.gradle.kts\"\
), \"w+\") as f:\n f.write(\"\"\"\nplugins {\n kotlin(\"\
jvm\")\n}\n\nandroid {\n compileSdkVersion = 21\n minSdkVersion\
\ 21\n}\n \"\"\")\n\n def setup_main_directory(self):\n prefix\
\ = path.join(\n root_dir,\n self.module,\n \
\ \"src\",\n \"main\")\n src_dir = path.join(\n\
\ prefix,\n \"java\",\n package_to_path(self.package_name),\n\
\ to_path(self.module))\n res_dir = path.join(prefix,\
\ \"res\")\n makedirs(src_dir)\n makedirs(path.join(res_dir,\
\ \"layout\"))\n makedirs(path.join(res_dir, \"values\"))\n \
\ with open(path.join(src_dir, \"Main.kt\"), \"w+\") as f:\n \
\ f.writelines(\n [\n f\"package\
\ {self.package_name}.{to_dotpath(self.module)}\\n\",\n \
\ 'fun main() = println(\"hello world\")',\n ]\n \
\ )\n with open(path.join(prefix, \"AndroidManifest.xml\"\
), \"w+\") as f:\n f.writelines(\n [\n \
\ '<?xml version=\"1.0\" encoding=\"utf-8\"?>\\n',\n \
\ '<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\"\
\\n',\n f' package=\"{self.package_name}.{self.module}\"\
>'.replace(\"-\", \".\"),\n \"</manifest>\",\n \
\ ]\n )\n\n def setup_test_directory(self):\n\
\ prefix = path.join(\n root_dir,\n self.module,\n\
\ \"src\",\n \"test\")\n makedirs(path.join(\n\
\ prefix,\n \"java\",\n package_to_path(self.package_name),\n\
\ to_path(self.module)))\n extensions_dir = path.join(\n\
\ prefix,\n \"resources\",\n \"mockito-extensions\"\
)\n makedirs(extensions_dir)\n with open(path.join(extensions_dir,\
\ \"org.mockito.plugins.MockMaker\"), \"w+\") as f:\n f.write(\"\
# mock-maker-inline\")\n\n\nclass GradleJvm(Gradle):\n\n def run(self):\n\
\ self.setup_main_directory()\n self.setup_test_directory()\n\
\ self.setup_build_gradle()\n self.setup_settings_gradle()\n\
\n def setup_build_gradle(self):\n with open(path.join(root_dir,\
\ self.module, \"build.gradle.kts\"), \"w+\") as f:\n f.write(\"\
\"\"\nplugins {\n kotlin(\"jvm\")\n id(\"java-library\")\n}\n\n\
repositories {\n mavenCentral()\n}\n \"\"\")\n\n def setup_main_directory(self):\n\
\ src_dir = path.join(\n path.join(\n \
\ root_dir,\n self.module,\n \"src\",\n\
\ \"main\"),\n \"java\",\n package_to_path(self.package_name),\n\
\ to_path(self.module))\n makedirs(src_dir)\n \
\ with open(path.join(src_dir, \"Main.kt\"), \"w+\") as f:\n \
\ f.writelines(\n [\n f\"package\
\ {self.package_name}.{to_dotpath(self.module)}\\n\",\n \
\ 'fun main() = println(\"hello world\")',\n ]\n \
\ )\n\n def setup_test_directory(self):\n prefix =\
\ path.join(\n root_dir,\n self.module,\n \
\ \"src\",\n \"test\")\n makedirs(path.join(\n\
\ prefix,\n \"java\",\n package_to_path(self.package_name),\n\
\ to_path(self.module)))\n\nclass GradleMultiplatform(Gradle):\n\
\n def run(self):\n self.setup_main_directory_all()\n \
\ self.setup_build_gradle()\n self.setup_settings_gradle()\n\n\
\ def setup_build_gradle(self):\n with open(path.join(root_dir,\
\ self.module, \"build.gradle.kts\"), \"w+\") as f:\n f.write(\"\
\"\"\nplugins {\n kotlin(\"multiplatform\") version \"1.8.0\"\n}\n\n\
kotlin {\n jvm {\n compilations.all {\n kotlinOptions.jvmTarget\
\ = \"1.8\"\n }\n withJava()\n testRuns[\"test\"\
].executionTask.configure {\n useJUnitPlatform()\n }\n\
\ }\n js(BOTH) {\n browser {\n commonWebpackConfig\
\ {\n cssSupport {\n enabled.set(true)\n\
\ }\n }\n }\n }\n val hostOs =\
\ System.getProperty(\"os.name\")\n val isMingwX64 = hostOs.startsWith(\"\
Windows\")\n val nativeTarget = when {\n hostOs == \"Mac OS\
\ X\" -> macosX64(\"native\")\n hostOs == \"Linux\" -> linuxX64(\"\
native\")\n isMingwX64 -> mingwX64(\"native\")\n else ->\
\ throw GradleException(\"Host OS is not supported in Kotlin/Native.\"\
)\n }\n\n sourceSets {\n val commonMain by getting\n \
\ val commonTest by getting {\n dependencies {\n \
\ implementation(kotlin(\"test\"))\n }\n }\n\
\ val jvmMain by getting\n val jvmTest by getting\n \
\ val jsMain by getting\n val jsTest by getting\n val\
\ nativeMain by getting\n val nativeTest by getting\n }\n}\n\
\ \"\"\")\n\n def setup_main_directory_all(self):\n source_sets\
\ = [\n \"jsMain\",\n \"jvmMain\",\n \
\ \"commonTest\",\n \"nativeMain\",\n \"jsTest\"\
,\n \"nativeTest\",\n \"jvmTest\",\n \
\ \"commonMain\",\n ]\n prefix = path.join(\n \
\ root_dir,\n self.module,\n \"src\",\n \
\ )\n for i in source_sets:\n self.setup_main_directory(i,\
\ prefix)\n\n def setup_main_directory(self, source_set, prefix):\n\
\ src_dir = path.join(\n prefix,\n source_set,\n\
\ \"kotlin\",\n package_to_path(self.package_name),\n\
\ to_path(self.module))\n makedirs(src_dir)\n \
\ with open(path.join(src_dir, \"Main.kt\"), \"w+\") as f:\n \
\ f.writelines(\n [\n f\"package\
\ {self.package_name}.{to_dotpath(self.module)}\\n\",\n \
\ 'fun main() = println(\"hello world\")',\n ]\n \
\ )\n\n\nif __name__ == \"__main__\":\n\n parser = argparse.ArgumentParser(description=\"\
\"\"\n Creates a new module in a gradle project\n \"\"\")\n\
\ parser.add_argument(\"module_name\", help=\"The name of the module\"\
, type=str)\n parser.add_argument(\"package_name\", help=\"The package\
\ name\", type=str)\n\n arg_group = parser.add_mutually_exclusive_group()\n\
\ arg_group.add_argument(\"-a\", \"--android\", action=\"store_true\"\
,\n help=\"generates a new android module\"\
)\n arg_group.add_argument(\"-m\", \"--multiplatform\", action=\"store_true\"\
,\n help=\"generates a new kotlin multiplatform\
\ module\")\n arg_group.add_argument(\"-j\", \"--jvm\", action=\"store_true\"\
,\n help=\"generates a new kotlin jvm module\"\
)\n\n args = parser.parse_args()\n\n ############################################################################\n\
\n if args.android:\n print(f\"Generating Android module: {args.module_name}\"\
)\n GradleAndroid(args.module_name, args.package_name).run()\n\
\ elif args.multiplatform:\n print(f\"Generating Multiplatform\
\ module: {args.module_name}\")\n GradleMultiplatform(args.module_name,\
\ args.package_name).run()\n elif args.jvm:\n print(f\"Generating\
\ JVM module: {args.module_name}\")\n GradleJvm(args.module_name,\
\ args.package_name).run()\n else:\n parser.print_help()\n \
\ exit(1)\nJAN_EOF_new_module_new_module_py_33955dd7a021\nchmod\
\ +x \"$tmpdir/new-module.py\" 2>/dev/null || true\ncat >\"$tmpdir/new-module.sh\"\
\ <<'JAN_EOF_new_module_new_module_sh_b7d444e9b1ca'\n#!/bin/bash\n# (c)\
\ 2022 Pat Beagan: MIT License\nset -euo pipefail\n\nif [ $# -ne 1 ];\
\ then \n\techo \"Usage: $0 <module-name>\"\n\texit 1\nfi\n\necho \"include(\\\
\"$1\\\")\" >> settings.gradle.kts\nmkdir -p \"$1/src/main/kotlin/com/example\"\
\nmkdir -p \"$1/src/main/resources/\"\ncat << EOF > \"$1/src/main/kotlin/com/example/Main.kt\"\
\npackage com.example;\n\nfun main() = println(\"Hello\")\nEOF\ncat <<\
\ EOF > \"$1/build.gradle.kts\"\nplugins {\n kotlin(\"jvm\")\n}\n\n\
group = \"com.example\"\nversion = \"1.0\"\n\nrepositories {\n mavenCentral()\n\
}\n\ndependencies {\n implementation(kotlin(\"stdlib\"))\n}\nEOF\n\
JAN_EOF_new_module_new_module_sh_b7d444e9b1ca\nchmod +x \"$tmpdir/new-module.sh\"\
\ 2>/dev/null || true\ncd \"$tmpdir\"\nexec \"$tmpdir/new-module.sh\"\
\ \"$@\"\n"
passthrough: true
nn:
about: A script for automated tasks.
path: ../scripts/source/nn
commands:
help:
about: Describe this script.
exec:
argv:
- bash
- -lc
- 'cat <<''EOF''
nn
A script for automated tasks.
EOF
'
run:
about: Run the script (inlined); forwards args.
exec:
argv:
- bash
- -lc
- "set -euo pipefail\ntmpdir=\"$(mktemp -d)\"\ntrap 'rm -rf \"$tmpdir\"\
' EXIT\ncat >\"$tmpdir/_nn\" <<'JAN_EOF_nn__nn_33370ea13bec'\n#compdef\
\ nn\n\n# Zsh completion for nn\n# Generated automatically - customize\
\ as needed\n\n_nn() {\n local context state line\n typeset -A opt_args\n\
\ \n _arguments -C \\\n '(-h --help)'{-h,--help}'[Show help\
\ information]' \\\n '(-v --version)'{-v,--version}'[Show version\
\ information]' \\\n '*::arg:_files'\n}\n\n_nn \"$@\"\nJAN_EOF_nn__nn_33370ea13bec\n\
chmod +x \"$tmpdir/_nn\" 2>/dev/null || true\ncat >\"$tmpdir/nn.sh\" <<'JAN_EOF_nn_nn_sh_70e33e758c0a'\n\
#!/bin/zsh\n# (c) 2022 Pat Beagan: MIT License\nset -euo pipefail\n\n\
nn () {\n\tif [[ \"sync\" == \"$*\" ]]\n\tthen\n\t# copy serverside notes\
\ to local\n aws s3 cp s3://nn-note-bucket/notes.txt ~/notes-remote.txt\n\
\t# combine serverside and local notes\n cat ~/notes.txt ~/notes-remote.txt\
\ | sort | uniq > ~/notes-new.txt\n\t# backup current notes\n mv\
\ ~/notes.txt ~/notes-bak.txt\n\t# overwrite current notes with the combined\
\ notes\n mv ~/notes-new.txt ~/notes.txt\n\t# push the newly combined\
\ local notes to the server\n aws s3 cp ~/notes.txt s3://nn-note-bucket\n\
\telif [ -n \"$*\" ]\n\tthen\n\t\techo $(date \"+%y.%m.%d.%H.%M.%S\")\
\ \"$@\" >> ~/notes.txt\n\telse\n\t\tcat ~/notes.txt\n\tfi\n}\n\nnn \"\
$*\"\ntrackusage \"$0\"\nJAN_EOF_nn_nn_sh_70e33e758c0a\nchmod +x \"$tmpdir/nn.sh\"\
\ 2>/dev/null || true\ncd \"$tmpdir\"\nexec \"$tmpdir/nn.sh\" \"$@\"\n"
passthrough: true
note:
about: A script for automated tasks.
path: ../scripts/source/note
commands:
help:
about: Describe this script.
exec:
argv:
- bash
- -lc
- 'cat <<''EOF''
note
A script for automated tasks.
EOF
'
run:
about: Run the script (inlined); forwards args.
exec:
argv:
- bash
- -lc
- "set -euo pipefail\ntmpdir=\"$(mktemp -d)\"\ntrap 'rm -rf \"$tmpdir\"\
' EXIT\ncat >\"$tmpdir/_note\" <<'JAN_EOF_note__note_26d1f35c9081'\n#compdef\
\ note\n\n# Zsh completion for note\n# Generated automatically - customize\
\ as needed\n\n_note() {\n local context state line\n typeset -A\
\ opt_args\n \n _arguments -C \\\n '(-h --help)'{-h,--help}'[Show\
\ help information]' \\\n '(-v --version)'{-v,--version}'[Show\
\ version information]' \\\n '*::arg:_files'\n}\n\n_note \"$@\"\
\nJAN_EOF_note__note_26d1f35c9081\nchmod +x \"$tmpdir/_note\" 2>/dev/null\
\ || true\ncat >\"$tmpdir/note.lua\" <<'JAN_EOF_note_note_lua_8756d06b8365'\n\
#!/usr/bin/env lua\n\n-- luarocks --local install luasocket\n-- luarocks\
\ --local install luafilesystem\n\n-- Enhanced Note-Taking App in Lua\n\
local lfs = require(\"lfs\") -- Lua File System module for managing files\n\
\nlocal notes_dir = \"notes\"\n\n-- Ensure notes directory exists\nlocal\
\ function ensure_notes_dir()\n if not lfs.attributes(notes_dir, \"\
mode\") then\n lfs.mkdir(notes_dir)\n print(\"Created notes\
\ directory: \" .. notes_dir)\n end\nend\n\n-- Helper function: Get\
\ all note names\nlocal function get_all_notes()\n local notes = {}\n\
\ for file in lfs.dir(notes_dir) do\n if file:match(\"%.md$\"\
) then\n local name_new = file:gsub(\"%.md$\", \"\")\n \
\ print(name_new)\n table.insert(notes, name_new) --\
\ Remove the \".md\" extension\n end\n end\n return notes\n\
end\n\n-- Helper function: Fuzzy match for autocomplete\nlocal function\
\ fuzzy_match(input, choices)\n local matches = {}\n for _, choice\
\ in ipairs(choices) do\n if choice:lower():find(input:lower(),\
\ 1, true) then\n table.insert(matches, choice)\n end\n\
\ end\n return matches\nend\n\n-- Autocomplete prompt\nlocal function\
\ autocomplete_prompt(prompt, choices)\n io.write(prompt)\n local\
\ input = io.read()\n local matches = fuzzy_match(input, choices)\n\
\ if #matches == 1 then\n return matches[1]\n elseif #matches\
\ > 1 then\n print(\"Multiple matches found:\")\n for i,\
\ match in ipairs(matches) do\n print(i .. \". \" .. match)\n\
\ end\n io.write(\"Choose a number (or press Enter to cancel):\
\ \")\n local choice = tonumber(io.read())\n if choice and\
\ matches[choice] then\n return matches[choice]\n end\n\
\ else\n print(\"No matches found.\")\n end\n return nil\n\
end\n\n-- List all notes\nlocal function list_notes()\n local notes\
\ = get_all_notes()\n if #notes == 0 then\n print(\"No notes\
\ available.\")\n else\n print(\"Available notes:\")\n \
\ for _, note in ipairs(notes) do\n print(\"- \" .. note)\n\
\ end\n end\nend\n\n-- Create a new note\nlocal function create_note()\n\
\ io.write(\"Enter new note name: \")\n local note_name = io.read()\n\
\ local file_path = notes_dir .. \"/\" .. note_name .. \".md\"\n \
\ if lfs.attributes(file_path, \"mode\") then\n print(\"Error:\
\ Note already exists.\")\n return\n end\n print(\"Write\
\ your note content (end with an empty line):\")\n local content =\
\ {}\n while true do\n local line = io.read()\n if line\
\ == \"\" then break end\n table.insert(content, line)\n end\n\
\ local file = io.open(file_path, \"w\")\n file:write(table.concat(content,\
\ \"\\n\"))\n file:close()\n print(\"Note created: \" .. file_path)\n\
end\n\n-- Read a note\nlocal function read_note()\n local notes = get_all_notes()\n\
\ if #notes == 0 then\n print(\"No notes available to read.\"\
)\n return\n end\n local note_name = autocomplete_prompt(\"\
Enter note name (partial name allowed): \", notes)\n if not note_name\
\ then\n print(\"Read operation cancelled.\")\n return\n\
\ end\n local file_path = notes_dir .. \"/\" .. note_name .. \"\
.md\"\n local file = io.open(file_path, \"r\")\n if not file then\n\
\ print(\"Error: Note not found.\")\n return\n end\n\
\ print(\"\\n--- Content of \" .. note_name .. \".md ---\")\n print(file:read(\"\
*a\"))\n file:close()\nend\n\n-- Delete a note\nlocal function delete_note()\n\
\ local notes = get_all_notes()\n if #notes == 0 then\n print(\"\
No notes available to delete.\")\n return\n end\n local note_name\
\ = autocomplete_prompt(\"Enter note name to delete (partial name allowed):\
\ \", notes)\n if not note_name then\n print(\"Delete operation\
\ cancelled.\")\n return\n end\n local file_path = notes_dir\
\ .. \"/\" .. note_name .. \".md\"\n if not lfs.attributes(file_path,\
\ \"mode\") then\n print(\"Error: Note not found.\")\n return\n\
\ end\n os.remove(file_path)\n print(\"Note deleted: \" .. file_path)\n\
end\n\n-- Main menu\nlocal function main_menu()\n ensure_notes_dir()\n\
\ while true do\n print(\"\\n--- Enhanced Note-Taking App ---\"\
)\n print(\"1. List Notes\")\n print(\"2. Create Note\"\
)\n print(\"3. Read Note\")\n print(\"4. Delete Note\")\n\
\ print(\"5. Exit\")\n io.write(\"Choose an option: \")\n\
\ local choice = tonumber(io.read())\n if choice == 1 then\n\
\ list_notes()\n elseif choice == 2 then\n \
\ create_note()\n elseif choice == 3 then\n read_note()\n\
\ elseif choice == 4 then\n delete_note()\n elseif\
\ choice == 5 then\n print(\"Goodbye!\")\n break\n\
\ else\n print(\"Invalid choice, please try again.\"\
)\n end\n end\nend\n\n-- Run the app\nmain_menu()\nJAN_EOF_note_note_lua_8756d06b8365\n\
chmod +x \"$tmpdir/note.lua\" 2>/dev/null || true\ncd \"$tmpdir\"\nexec\
\ \"$tmpdir/note.lua\" \"$@\"\n"
passthrough: true
note-aggron:
about: A script for automated tasks.
path: ../scripts/source/note-aggron
commands:
help:
about: Describe this script.
exec:
argv:
- bash
- -lc
- 'cat <<''EOF''
note-aggron
A script for automated tasks.
EOF
'
run:
about: Run the script (inlined); forwards args.
exec:
argv:
- bash
- -lc
- "set -euo pipefail\ntmpdir=\"$(mktemp -d)\"\ntrap 'rm -rf \"$tmpdir\"\
' EXIT\ncat >\"$tmpdir/_note-aggron\" <<'JAN_EOF_note_aggron__note_aggron_d1915ec82687'\n\
#compdef note-aggron\n\n# Zsh completion for note-aggron\n# Generated\
\ automatically - customize as needed\n\n_note-aggron() {\n local context\
\ state line\n typeset -A opt_args\n \n _arguments -C \\\n \
\ '(-h --help)'{-h,--help}'[Show help information]' \\\n '(-v\
\ --version)'{-v,--version}'[Show version information]' \\\n '*::arg:_files'\n\
}\n\n_note-aggron \"$@\"\nJAN_EOF_note_aggron__note_aggron_d1915ec82687\n\
chmod +x \"$tmpdir/_note-aggron\" 2>/dev/null || true\ncat >\"$tmpdir/note-aggron.sh\"\
\ <<'JAN_EOF_note_aggron_note_aggron_sh_97ce84fba5de'\n#!/usr/bin/env\
\ zsh\n\nfunction main() {\n title=\"$1\"\n description=\"$2\"\n\n \
\ curl 'http://localhost:8080/notes/add' -X POST \\\n -H 'Accept: text/*'\
\ \\\n -H 'Accept-Language: en-US,en;q=0.5' \\\n -H 'Accept-Encoding:\
\ gzip, deflate, br' \\\n -H 'Content-Type: application/x-www-form-urlencoded'\
\ \\\n -H 'Upgrade-Insecure-Requests: 1' \\\n -H 'Sec-Fetch-Dest:\
\ document' \\\n -H 'Sec-Fetch-Mode: navigate' \\\n -H 'Sec-Fetch-Site:\
\ none' \\\n -H 'Sec-Fetch-User: ?1' \\\n -H 'Pragma: no-cache'\
\ \\\n -H 'Cache-Control: no-cache' \\\n --data-urlencode 'input-title='\"\
$title\" \\\n --data-urlencode 'input-content='\"$description\"\n}\n\
\nif [ $# -ne 2 ]; then\n echo requires a title and a description.\n\
\ exit 1\nfi\n\nmain \"$1\" \"$2\"\nJAN_EOF_note_aggron_note_aggron_sh_97ce84fba5de\n\
chmod +x \"$tmpdir/note-aggron.sh\" 2>/dev/null || true\ncd \"$tmpdir\"\
\nexec \"$tmpdir/note-aggron.sh\" \"$@\"\n"
passthrough: true
nz:
about: A script for automated tasks.
path: ../scripts/source/nz
commands:
help:
about: Describe this script.
exec:
argv:
- bash
- -lc
- 'cat <<''EOF''
nz
A script for automated tasks.
EOF
'
run:
about: Run the script (inlined); forwards args.
exec:
argv:
- bash
- -lc
- "set -euo pipefail\ntmpdir=\"$(mktemp -d)\"\ntrap 'rm -rf \"$tmpdir\"\
' EXIT\ncat >\"$tmpdir/_nz\" <<'JAN_EOF_nz__nz_c6f7652eb781'\n#compdef\
\ nz\n\n# Zsh completion for nz\n# Generated automatically - customize\
\ as needed\n\n_nz() {\n local context state line\n typeset -A opt_args\n\
\ \n _arguments -C \\\n '(-h --help)'{-h,--help}'[Show help\
\ information]' \\\n '(-v --version)'{-v,--version}'[Show version\
\ information]' \\\n '*::arg:_files'\n}\n\n_nz \"$@\"\nJAN_EOF_nz__nz_c6f7652eb781\n\
chmod +x \"$tmpdir/_nz\" 2>/dev/null || true\ncat >\"$tmpdir/nz.sh\" <<'JAN_EOF_nz_nz_sh_26914953a043'\n\
#!/bin/zsh\n# (c) 2022 Pat Beagan: MIT License\nset -euo pipefail\n\n\
nn () {\n local nnfile=\"$NNFILE\"\n\n local prefix=\"notes-enc\"\
\n local bucket=\"s3://nn-note-bucket\"\n local notesRemoteArtifact=\"\
$bucket/$prefix.txt.gpg\"\n local notesLocalEnc=\"${HOME}/$prefix.txt.gpg\"\
\n local notesLocal=\"${HOME}/$prefix.txt\"\n local notesRemoteEnc=\"\
${HOME}/$prefix-remote.txt.gpg\"\n local notesRemote=\"${HOME}/$prefix-remote.txt\"\
\n local notesBak=\"${HOME}/$prefix-bak.txt\"\n local notesNew=\"\
${HOME}/$prefix-new.txt\"\n\n touch \"$notesLocal\"\n \n function\
\ encrypt_notes () {\n # encrypt notes\n gpg \\\n \
\ --batch \\\n --yes \\\n --passphrase-file\
\ \"$NNFILE\" \\\n --output \"$notesLocalEnc\" \\\n \
\ -c \"$notesLocal\" \n }\n\n function decrypt_notes () {\n\
\ # decrypt notes\n gpg \\\n --batch \\\n \
\ --yes \\\n --passphrase-file \"$NNFILE\" \\\n \
\ --output \"$notesRemote\" \\\n -d \"$notesRemoteEnc\"\
\ \n }\n\n function combine_notes () {\n # combine serverside\
\ and local notes\n cat \"$notesLocal\" \"$notesRemote\" | sort\
\ | uniq > \"$notesNew\"\n\n # backup current notes\n mv\
\ \"$notesLocal\" \"$notesBak\"\n\n # overwrite current notes with\
\ the combined notes\n mv \"$notesNew\" \"$notesLocal\"\n\n \
\ # printing differences\n diff \"$notesBak\" \"$notesLocal\"\
\n }\n\n function usage () {\n cat << EOF\nUsage: $0 [sync]\
\ <contents>\n\nIf \"sync\" is the only argument to the script, \n \
\ it will attempt to synchronize the local list with the encrypted list\
\ on the server.\n\nIf there are no arguments at all, \n the script\
\ will print out the contents of the local list.\n\nIf there are any other\
\ arguments, \n they will be stored in the list located at '$notesLocal',\
\ with a timestamp.\nEOF\n }\n\n if [[ \"help\" == \"$*\" ]]\n \
\ then\n usage\n elif [[ \"sync\" == \"$*\" ]]\n then\n\
\ \n # copy serverside notes to local\n set +e\n\
\ aws s3 cp \"$notesRemoteArtifact\" \"$notesRemoteEnc\" \n \
\ \n if [[ ! $? -eq 0 ]]; then\n echo\n \
\ echo \"There was an issue with downloading the file.\"\n \
\ echo \"Does the file actually exist?\"\n echo\n \
\ echo \"Preparing a sample file to upload\"\n echo \"\
...\"\n\n touch \"$notesLocal\"\n encrypt_notes\n\
\ \n echo\n echo \"Use the following\
\ command to put the initial file on the server.\"\n echo \"\
$ aws s3 cp $notesLocalEnc $bucket\"\n exit 1\n fi\t\
\n set -e\n \n decrypt_notes\n combine_notes\n\
\ encrypt_notes\n\n # push the newly combined local notes\
\ to the server\n aws s3 cp \"$notesLocalEnc\" \"$bucket\"\n\n\
\ elif [ -n \"$*\" ]\n then\n echo $(date \"+%y.%m.%d.%H.%M.%S\"\
) \"$@\" >> \"$notesLocal\"\n else\n cat \"$notesLocal\"\n \
\ fi\n}\n\nnn \"$*\"\ntrackusage \"$0\"\nJAN_EOF_nz_nz_sh_26914953a043\n\
chmod +x \"$tmpdir/nz.sh\" 2>/dev/null || true\ncd \"$tmpdir\"\nexec \"\
$tmpdir/nz.sh\" \"$@\"\n"
passthrough: true
oncron:
about: A script for automated tasks.
path: ../scripts/source/oncron
commands:
help:
about: Describe this script.
exec:
argv:
- bash
- -lc
- 'cat <<''EOF''
oncron
A script for automated tasks.
EOF
'
run:
about: Run the script (inlined); forwards args.
exec:
argv:
- bash
- -lc
- "set -euo pipefail\ntmpdir=\"$(mktemp -d)\"\ntrap 'rm -rf \"$tmpdir\"\
' EXIT\ncat >\"$tmpdir/_oncron\" <<'JAN_EOF_oncron__oncron_755c49f817c0'\n\
#compdef oncron\n\n# Zsh completion for oncron\n# Generated automatically\
\ - customize as needed\n\n_oncron() {\n local context state line\n\
\ typeset -A opt_args\n \n _arguments -C \\\n '(-h --help)'{-h,--help}'[Show\
\ help information]' \\\n '(-v --version)'{-v,--version}'[Show\
\ version information]' \\\n '*::arg:_files'\n}\n\n_oncron \"$@\"\
\nJAN_EOF_oncron__oncron_755c49f817c0\nchmod +x \"$tmpdir/_oncron\" 2>/dev/null\
\ || true\ncat >\"$tmpdir/oncron.py\" <<'JAN_EOF_oncron_oncron_py_07ce630bcac8'\n\
#!/usr/bin/env python3\n\nimport os\nimport subprocess\nimport datetime\n\
\n# Define a dictionary of cron expressions to bash commands\ncron_to_bash\
\ = {\n '30 10 * * *': \"echo 'This command runs every day at 10:30\
\ AM' >> ~/cron.txt\",\n '0 18 * * *': \"echo 'This command runs every\
\ day at 6:00 PM' >> ~/cron.txt\",\n '30 15 * * *': \"echo 'This command\
\ runs every day at 6:00 PM' >> ~/cron.txt\",\n '* * * * *': \"echo\
\ 'This command runs every minute' >> ~/cron.txt\",\n}\n\ndef execute_bash_command(command):\n\
\ process = subprocess.Popen(command, stdout=subprocess.PIPE, shell=True)\n\
\ output, error = process.communicate()\n if error:\n print(f\"\
Error: {error}\")\n else:\n print(f\"Output: {output}\")\n\n\
def parse_cron_expression(expression):\n fields = expression.split()\n\
\ return {\n \"minute\": fields[0],\n \"hour\": fields[1],\n\
\ \"day_of_month\": fields[2],\n \"month\": fields[3],\n\
\ \"day_of_week\": fields[4],\n }\n\ndef cron_expression_matches_time(parsed_cron,\
\ dt):\n minute_match = parsed_cron[\"minute\"] == \"*\" or int(parsed_cron[\"\
minute\"]) == dt.minute\n hour_match = parsed_cron[\"hour\"] == \"\
*\" or int(parsed_cron[\"hour\"]) == dt.hour\n day_of_month_match =\
\ parsed_cron[\"day_of_month\"] == \"*\" or int(parsed_cron[\"day_of_month\"\
]) == dt.day\n month_match = parsed_cron[\"month\"] == \"*\" or int(parsed_cron[\"\
month\"]) == dt.month\n day_of_week_match = parsed_cron[\"day_of_week\"\
] == \"*\" or int(parsed_cron[\"day_of_week\"]) == dt.weekday()\n\n \
\ return minute_match and hour_match and day_of_month_match and month_match\
\ and day_of_week_match\n\n# Check if any cron expression matches the\
\ current time and execute the corresponding command\nnow = datetime.datetime.now()\n\
for cron_expression, bash_command in cron_to_bash.items():\n parsed_cron\
\ = parse_cron_expression(cron_expression)\n if cron_expression_matches_time(parsed_cron,\
\ now):\n execute_bash_command(bash_command)\nJAN_EOF_oncron_oncron_py_07ce630bcac8\n\
chmod +x \"$tmpdir/oncron.py\" 2>/dev/null || true\ncd \"$tmpdir\"\nexec\
\ \"$tmpdir/oncron.py\" \"$@\"\n"
passthrough: true
open:
about: A script for automated tasks.
path: ../scripts/source/open
commands:
help:
about: Describe this script.
exec:
argv:
- bash
- -lc
- 'cat <<''EOF''
open
A script for automated tasks.
EOF
'
run:
about: Run the script (inlined); forwards args.
exec:
argv:
- bash
- -lc
- "set -euo pipefail\ntmpdir=\"$(mktemp -d)\"\ntrap 'rm -rf \"$tmpdir\"\
' EXIT\ncat >\"$tmpdir/_open\" <<'JAN_EOF_open__open_ccac7eef8837'\n#compdef\
\ open\n\n# Zsh completion for open\n# Generated automatically - customize\
\ as needed\n\n_open() {\n local context state line\n typeset -A\
\ opt_args\n \n _arguments -C \\\n '(-h --help)'{-h,--help}'[Show\
\ help information]' \\\n '(-v --version)'{-v,--version}'[Show\
\ version information]' \\\n '*::arg:_files'\n}\n\n_open \"$@\"\
\nJAN_EOF_open__open_ccac7eef8837\nchmod +x \"$tmpdir/_open\" 2>/dev/null\
\ || true\ncat >\"$tmpdir/open.sh\" <<'JAN_EOF_open_open_sh_a35674a734f0'\n\
#!/bin/bash \n# (c) 2022 Pat Beagan: MIT License\n\nopen () \n{ \n \
\ if [ \"$(uname)\" == \"Linux\" ]; then\n gnome-open \"$@\";\n\
\ else\n if [ \"$(uname)\" == \"Darwin\" ]; then\n \
\ command open \"$@\";\n else\n echo \"This command\
\ is not supported.\";\n fi;\n fi\n}\n\nopen \"$@\"\ntrackusage\
\ \"$0\"\nJAN_EOF_open_open_sh_a35674a734f0\nchmod +x \"$tmpdir/open.sh\"\
\ 2>/dev/null || true\ncd \"$tmpdir\"\nexec \"$tmpdir/open.sh\" \"$@\"\
\n"
passthrough: true
openai_cli:
about: A script for automated tasks.
path: ../scripts/source/openai_cli
commands:
help:
about: Describe this script.
exec:
argv:
- bash
- -lc
- 'cat <<''EOF''
openai_cli
A script for automated tasks.
EOF
'
run:
about: Run the script (inlined); forwards args.
exec:
argv:
- bash
- -lc
- "set -euo pipefail\ntmpdir=\"$(mktemp -d)\"\ntrap 'rm -rf \"$tmpdir\"\
' EXIT\ncat >\"$tmpdir/_openai_cli\" <<'JAN_EOF_openai_cli__openai_cli_4bc2107d29dd'\n\
#compdef openai_cli\n\n# Zsh completion for openai_cli\n# Generated automatically\
\ - customize as needed\n\n\n_openai_cli() {\n local context state\
\ line\n typeset -A opt_args\n \n _arguments -C \\\n '(-h\
\ --help)'{-h,--help}'[Show help information]' \\\n '(-v --version)'{-v,--version}'[Show\
\ version information]' \\\n '-d[Custom option]' \\\n '-H[Custom\
\ option]' \\\n '-T[Custom option]' \\ '*::arg:_files'\n\
}\n\n_openai_cli \"$@\"\nJAN_EOF_openai_cli__openai_cli_4bc2107d29dd\n\
chmod +x \"$tmpdir/_openai_cli\" 2>/dev/null || true\ncat >\"$tmpdir/openai_cli.py\"\
\ <<'JAN_EOF_openai_cli_openai_cli_py_1e03276f2b54'\n#!/usr/bin/env python3\n\
\nimport argparse\nimport os\nimport sys\nfrom openai import OpenAI\n\
import datetime\nimport itertools\nimport time\nimport threading\n\ndef\
\ parse():\n # Set up argument parser\n parser = argparse.ArgumentParser(description='Forward\
\ a request to OpenAI and display the results in real-time.')\n parser.add_argument('--prompt',\
\ help='The prompt to send to OpenAI', required=True)\n parser.add_argument('--model',\
\ help='The model to use (e.g., gpt-3.5-turbo)', default=\"gpt-3.5-turbo\"\
)\n parser.add_argument('--max_tokens', help='The maximum number of\
\ tokens to generate', type=int, default=100)\n parser.add_argument('--spinner',\
\ help='Whether to have a spinner', type=bool, default=False)\n return\
\ parser.parse_args()\n\ndef main(args):\n \"\"\"\n A command-line\
\ tool to forward a request to OpenAI and display the results in real-time.\n\
\ \n Usage:\n python openai_cli.py --prompt \"Hello, world!\"\
\n \"\"\"\n\n # Check for API key in environment\n api_key =\
\ os.getenv('OPENAI_API_KEY')\n if not api_key:\n print(\"Error:\
\ OPENAI_API_KEY environment variable is not set.\", file=sys.stderr)\n\
\ sys.exit(1)\n\n # Set API key\n OpenAI.api_key = api_key\n\
\ client = OpenAI()\n\n # Send request and print response\n try:\n\
\ response = client.chat.completions.create(\n model=args.model,\n\
\ messages=[\n {\"role\": \"user\", \"content\": args.prompt},\n\
\ ]\n )\n\n with open(\"/tmp/ai_completions.txt\"\
, mode='a') as file:\n file.write(\"\\n\" + str(datetime.datetime.now())\
\ + \"\\n\")\n file.wr:ite(str(response))\n\n print(response.choices[0].message.content)\n\
\ except Exception as e:\n print(f\"Error: {e}\", file=sys.stderr)\n\
\ndef start_spinner():\n spinner = itertools.cycle(['-', '/', '|',\
\ '\\\\'])\n while True:\n sys.stdout.write(next(spinner))\n\
\ sys.stdout.flush()\n time.sleep(0.1)\n sys.stdout.write('\\\
b')\n\ndef stop_spinner():\n sys.stdout.write('\\b')\n sys.stdout.flush()\n\
\nif __name__ == '__main__':\n args = parse()\n \n if args.spinner:\n\
\ spinner_thread = threading.Thread(target=start_spinner)\n \
\ spinner_thread.start()\n \n main(args)\n \n if args.spinner:\n\
\ spinner_thread.join()\n sys.exit()\nJAN_EOF_openai_cli_openai_cli_py_1e03276f2b54\n\
chmod +x \"$tmpdir/openai_cli.py\" 2>/dev/null || true\ncat >\"$tmpdir/openai_cli.zsh\"\
\ <<'JAN_EOF_openai_cli_openai_cli_zsh_c536e6177eb2'\n#!/usr/bin/env zsh\n\
\n# Check if the API key is set\nif [[ -z \"$OPENAI_API_KEY\" ]]; then\n\
\ echo \"Error: OPENAI_API_KEY environment variable is not set.\" >&2\n\
\ exit 1\nfi\n\n# Default values\nMODEL=\"text-davinci-003\"\nMAX_TOKENS=100\n\
\n# Usage message\nusage() {\n echo \"Usage: $0 -p <prompt> [-m <model>]\
\ [-t <max_tokens>]\" >&2\n}\n\n# Parse command-line options\nwhile getopts\
\ \":p:m:t:\" opt; do\n case \"$opt\" in\n p) PROMPT=$OPTARG\
\ ;;\n m) MODEL=$OPTARG ;;\n t) MAX_TOKENS=$OPTARG ;;\n\
\ \\?) echo \"Invalid option: -$OPTARG\" >&2\n usage\n\
\ exit 1 ;;\n :) echo \"Option -$OPTARG requires an\
\ argument.\" >&2\n usage\n exit 1 ;;\n esac\n\
done\n\n# Check if prompt is provided\nif [[ -z \"$PROMPT\" ]]; then\n\
\ echo \"Error: Prompt is required.\" >&2\n usage\n exit 1\n\
fi\n\n# Send request to OpenAI API\nRESPONSE=$(curl -s -X POST \"https://api.openai.com/v1/engines/$MODEL/completions\"\
\ \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization:\
\ Bearer $OPENAI_API_KEY\" \\\n -d \"{\\\"prompt\\\": \\\"$PROMPT\\\
\", \\\"max_tokens\\\": $MAX_TOKENS}\")\n\n# Check for curl errors\nif\
\ [[ $? -ne 0 ]]; then\n echo \"Error: Failed to connect to OpenAI\
\ API.\" >&2\n exit 1\nfi\n\n# Extract and print the response text\n\
echo $RESPONSE | jq -r '.choices[0].text' || {\n echo \"Error: Failed\
\ to parse response.\" >&2\n exit 1\n}\nJAN_EOF_openai_cli_openai_cli_zsh_c536e6177eb2\n\
chmod +x \"$tmpdir/openai_cli.zsh\" 2>/dev/null || true\ncd \"$tmpdir\"\
\nexec \"$tmpdir/openai_cli.zsh\" \"$@\"\n"
passthrough: true
partify:
about: A script for automated tasks.
path: ../scripts/source/partify
commands:
help:
about: Describe this script.
exec:
argv:
- bash
- -lc
- 'cat <<''EOF''
partify
A script for automated tasks.
EOF
'
run:
about: Run the script (inlined); forwards args.
exec:
argv:
- bash
- -lc
- "set -euo pipefail\ntmpdir=\"$(mktemp -d)\"\ntrap 'rm -rf \"$tmpdir\"\
' EXIT\ncat >\"$tmpdir/_partify\" <<'JAN_EOF_partify__partify_b0109eb74d41'\n\
#compdef partify\n\n# Zsh completion for partify\n# Generated automatically\
\ - customize as needed\n\n_partify() {\n local context state line\n\
\ typeset -A opt_args\n \n _arguments -C \\\n '(-h --help)'{-h,--help}'[Show\
\ help information]' \\\n '(-v --version)'{-v,--version}'[Show\
\ version information]' \\\n '*::arg:_files'\n}\n\n_partify \"\
$@\"\nJAN_EOF_partify__partify_b0109eb74d41\nchmod +x \"$tmpdir/_partify\"\
\ 2>/dev/null || true\ncat >\"$tmpdir/partify.sh\" <<'JAN_EOF_partify_partify_sh_67930bbfeb78'\n\
#!/bin/bash \n# (c) 2022 Pat Beagan: MIT License\n\n# Creates a party\
\ gif of a static image by replacing the given color with the \"Party\
\ Parrot\" colors\n#\n# @param -i --input-file The filename of the static\
\ image file to modify\n# @param -c --color The hex of the color\
\ to replace with party colors\n# @param -f --fuzz Threshold used\
\ to match pixel color similarity to the given color. 0-100\n# @param\
\ -o --output-file The filename to output the gif\n#\n# Sample Request:\
\ partify -i static_img.png -c \"#000000\" -f 10 -o party_img.gif\n#\n\
# @author Sean Ezrol\n# @author Ross Regitsky\n\nwhile [[ $# -gt 1 ]]\n\
do\nkey=\"$1\"\n case $key in\n -i|--input-file)\n INPUTFILE=$2\n \
\ shift\n ;;\n -c|--color)\n COLOR=$2\n shift\n ;;\n -f|--fuzz)\n\
\ FUZZ=$2\n shift\n ;;\n -o|--output-file)\n OUTPUTFILE=$2\n shift\n\
\ ;;\n *)\n # unknown arg\n ;;\nesac\nshift\ndone\n\necho Input\
\ - \"${INPUTFILE}\"\nparty_colors=(\"#FA8C8E\" \"#FCD890\" \"#36FF89\"\
\ \"#3DFFFC\" \"#81B8FC\" \"#F491FF\" \"#FB8DFC\" \"#FA69F5\" \"#FA69B9\"\
\ \"#FA696E\" )\nfor i in \"${!party_colors[@]}\"\ndo\n magick convert\
\ -fill \"${party_colors[i]}\" -fuzz \"${FUZZ}%\" -opaque \"${COLOR}\"\
\ \"${INPUTFILE}\" temp$i.miff\ndone\n\ncmd=\"magick convert -delay 4\
\ -loop 0 -coalesce -layers OptimizeFrame \"\nfor i in \"${!party_colors[@]}\"\
\ndo\n cmd+=\"temp$i.miff \" \ndone\ncmd+=${OUTPUTFILE}\necho $cmd\n\
eval $cmd\n\nrm temp*.miff\nJAN_EOF_partify_partify_sh_67930bbfeb78\n\
chmod +x \"$tmpdir/partify.sh\" 2>/dev/null || true\ncd \"$tmpdir\"\n\
exec \"$tmpdir/partify.sh\" \"$@\"\n"
passthrough: true
pasteToEmulator:
about: A script for automated tasks.
path: ../scripts/source/pasteToEmulator
commands:
help:
about: Describe this script.
exec:
argv:
- bash
- -lc
- 'cat <<''EOF''
pasteToEmulator
A script for automated tasks.
EOF
'
run:
about: Run the script (inlined); forwards args.
exec:
argv:
- bash
- -lc
- "set -euo pipefail\ntmpdir=\"$(mktemp -d)\"\ntrap 'rm -rf \"$tmpdir\"\
' EXIT\ncat >\"$tmpdir/_pasteToEmulator\" <<'JAN_EOF_pasteToEmulator__pasteToEmulator_881d01523221'\n\
#compdef pasteToEmulator\n\n# Zsh completion for pasteToEmulator\n# Generated\
\ automatically - customize as needed\n\n_pasteToEmulator() {\n local\
\ context state line\n typeset -A opt_args\n \n _arguments -C\
\ \\\n '(-h --help)'{-h,--help}'[Show help information]' \\\n \
\ '(-v --version)'{-v,--version}'[Show version information]' \\\n\
\ '*::arg:_files'\n}\n\n_pasteToEmulator \"$@\"\nJAN_EOF_pasteToEmulator__pasteToEmulator_881d01523221\n\
chmod +x \"$tmpdir/_pasteToEmulator\" 2>/dev/null || true\ncat >\"$tmpdir/pasteToEmulator.sh\"\
\ <<'JAN_EOF_pasteToEmulator_pasteToEmulator_sh_6b7752a1b809'\n#!/bin/bash\
\ \n# (c) 2022 Pat Beagan: MIT License\n\npasteToEmulator () \n{ \n \
\ adb shell input text \"${1}\"\n}\n\npasteToEmulator \"$@\"\nJAN_EOF_pasteToEmulator_pasteToEmulator_sh_6b7752a1b809\n\
chmod +x \"$tmpdir/pasteToEmulator.sh\" 2>/dev/null || true\ncd \"$tmpdir\"\
\nexec \"$tmpdir/pasteToEmulator.sh\" \"$@\"\n"
passthrough: true
peek:
about: A script for automated tasks.
path: ../scripts/source/peek
commands:
help:
about: Describe this script.
exec:
argv:
- bash
- -lc
- 'cat <<''EOF''
peek
A script for automated tasks.
EOF
'
run:
about: Run the script (inlined); forwards args.
exec:
argv:
- bash
- -lc
- "set -euo pipefail\ntmpdir=\"$(mktemp -d)\"\ntrap 'rm -rf \"$tmpdir\"\
' EXIT\ncat >\"$tmpdir/_peek\" <<'JAN_EOF_peek__peek_d2d701ac49a2'\n#compdef\
\ peek\n\n# Zsh completion for peek\n# Generated automatically - customize\
\ as needed\n\n_peek() {\n local context state line\n typeset -A\
\ opt_args\n \n _arguments -C \\\n '(-h --help)'{-h,--help}'[Show\
\ help information]' \\\n '(-v --version)'{-v,--version}'[Show\
\ version information]' \\\n '*::arg:_files'\n}\n\n_peek \"$@\"\
\nJAN_EOF_peek__peek_d2d701ac49a2\nchmod +x \"$tmpdir/_peek\" 2>/dev/null\
\ || true\ncat >\"$tmpdir/peek.sh\" <<'JAN_EOF_peek_peek_sh_6943796d319f'\n\
#!/bin/bash \n# (c) 2022 Pat Beagan: MIT License\n\npeek () \n{ \n \
\ tree -L 2\n}\n\npeek \"$@\"\ntrackusage \"$0\"\nJAN_EOF_peek_peek_sh_6943796d319f\n\
chmod +x \"$tmpdir/peek.sh\" 2>/dev/null || true\ncd \"$tmpdir\"\nexec\
\ \"$tmpdir/peek.sh\" \"$@\"\n"
passthrough: true
pretty-csv:
about: A script for automated tasks.
path: ../scripts/source/pretty-csv
commands:
help:
about: Describe this script.
exec:
argv:
- bash
- -lc
- 'cat <<''EOF''
pretty-csv
A script for automated tasks.
EOF
'
run:
about: Run the script (inlined); forwards args.
exec:
argv:
- bash
- -lc
- "set -euo pipefail\ntmpdir=\"$(mktemp -d)\"\ntrap 'rm -rf \"$tmpdir\"\
' EXIT\ncat >\"$tmpdir/_pretty-csv\" <<'JAN_EOF_pretty_csv__pretty_csv_6b32457eea42'\n\
#compdef pretty-csv\n\n# Zsh completion for pretty-csv\n# Generated automatically\
\ - customize as needed\n\n_pretty-csv() {\n local context state line\n\
\ typeset -A opt_args\n \n _arguments -C \\\n '(-h --help)'{-h,--help}'[Show\
\ help information]' \\\n '(-v --version)'{-v,--version}'[Show\
\ version information]' \\\n '*::arg:_files'\n}\n\n_pretty-csv\
\ \"$@\"\nJAN_EOF_pretty_csv__pretty_csv_6b32457eea42\nchmod +x \"$tmpdir/_pretty-csv\"\
\ 2>/dev/null || true\ncat >\"$tmpdir/pretty-csv.py\" <<'JAN_EOF_pretty_csv_pretty_csv_py_26e8b13debfc'\n\
#!/usr/bin/env python3\n\n\"\"\"\nScript Name: color_csv_display.py\n\
Description: This script reads a CSV file and prints each column in a\
\ different ANSI color.\nUsage: python color_csv_display.py -f <path_to_csv_file>\n\
\"\"\"\n\nimport csv\nimport argparse\n\n# ANSI color codes\nCOLORS =\
\ [\n '\\033[31m', # Red\n '\\033[32m', # Green\n '\\033[33m',\
\ # Yellow\n '\\033[34m', # Blue\n '\\033[35m', # Magenta\n \
\ '\\033[36m', # Cyan\n '\\033[37m', # White\n '\\033[0m' \
\ # Reset\n]\n\ndef parse_arguments():\n \"\"\" Parse command line\
\ arguments. \"\"\"\n parser = argparse.ArgumentParser(description='Display\
\ CSV file with columns in different colors.')\n parser.add_argument('-f',\
\ '--file', required=True, help='Path to the CSV file')\n return parser.parse_args()\n\
\ndef print_colored_csv(file_path):\n \"\"\" Read and print CSV file\
\ with each column in a different color. \"\"\"\n try:\n with\
\ open(file_path, newline='') as csvfile:\n reader = csv.reader(csvfile)\n\
\ for row in reader:\n colored_row = [f\"{COLORS[i\
\ % len(COLORS)]}{col}{COLORS[-1]}\" for i, col in enumerate(row)]\n \
\ print(' '.join(colored_row))\n except FileNotFoundError:\n\
\ print(f\"Error: File '{file_path}' not found.\")\n except\
\ Exception as e:\n print(f\"Error: {e}\")\n\ndef main():\n \
\ args = parse_arguments()\n print_colored_csv(args.file)\n\nif __name__\
\ == \"__main__\":\n main()\nJAN_EOF_pretty_csv_pretty_csv_py_26e8b13debfc\n\
chmod +x \"$tmpdir/pretty-csv.py\" 2>/dev/null || true\ncd \"$tmpdir\"\
\nexec \"$tmpdir/pretty-csv.py\" \"$@\"\n"
passthrough: true
prev-command:
about: A script for automated tasks.
path: ../scripts/source/prev-command
commands:
help:
about: Describe this script.
exec:
argv:
- bash
- -lc
- 'cat <<''EOF''
prev-command
A script for automated tasks.
EOF
'
run:
about: Run the script (inlined); forwards args.
exec:
argv:
- bash
- -lc
- "set -euo pipefail\ntmpdir=\"$(mktemp -d)\"\ntrap 'rm -rf \"$tmpdir\"\
' EXIT\ncat >\"$tmpdir/_prev-command\" <<'JAN_EOF_prev_command__prev_command_ba3d9bdcf6a0'\n\
#compdef prev-command\n\n# Zsh completion for prev-command\n# Generated\
\ automatically - customize as needed\n\n_prev-command() {\n local\
\ context state line\n typeset -A opt_args\n \n _arguments -C\
\ \\\n '(-h --help)'{-h,--help}'[Show help information]' \\\n \
\ '(-v --version)'{-v,--version}'[Show version information]' \\\n\
\ '*::arg:_files'\n}\n\n_prev-command \"$@\"\nJAN_EOF_prev_command__prev_command_ba3d9bdcf6a0\n\
chmod +x \"$tmpdir/_prev-command\" 2>/dev/null || true\ncat >\"$tmpdir/prev-command.sh\"\
\ <<'JAN_EOF_prev_command_prev_command_sh_bf164ba86cab'\n#!/usr/bin/env\
\ zsh\n\nset -euo pipefail\n\nscriptname=\"$(basename \"$0\")\"\nhelp()\
\ {\n error_code=$?\n echo \"\nUsage: $scriptname [-h|--help] <prefix>\n\
\nSearches command history for commands that start with the given prefix.\n\
Uses omz_history for enhanced history functionality.\n\nArguments:\n \
\ prefix Command prefix to search for\n\nFeatures:\n - Searches through\
\ command history\n - Uses Oh My Zsh history function\n - Colorized\
\ output for better readability\n - Excludes common development directories\
\ from search\n\nExamples:\n $scriptname git # Shows all git\
\ commands from history\n $scriptname docker # Shows all docker\
\ commands from history\n\"\n exit $error_code\n}\n\nmain() {\n\n \
\ emulate -L zsh\n zmodload zsh/zutil || return 1\n\n local help\n\
\ zparseopts -D -F -K -- \\\n {h,-help}=help ||\n return\
\ 1\n\n if (($#help)); then help; fi\n\n# prev-command() { history\
\ | cut -d' ' -f2-100 | sed 's/^ *//g' | grep \"^$1 \"; }\nprev-command\
\ () {\n\tomz_history |\n cut -d' ' -f2-100 |\n sed 's/^\
\ *//g' |\n grep --color=auto --exclude-dir={.bzr,CVS,.git,.hg,.svn,.idea,.tox}\
\ \"^$1 \"\n}\n\n prev-command \"$@\" || help\n}\n\nmain \"$@\" ||\
\ help\ntrackusage \"$0\"\nJAN_EOF_prev_command_prev_command_sh_bf164ba86cab\n\
chmod +x \"$tmpdir/prev-command.sh\" 2>/dev/null || true\ncd \"$tmpdir\"\
\nexec \"$tmpdir/prev-command.sh\" \"$@\"\n"
passthrough: true
psp:
about: A script for automated tasks.
path: ../scripts/source/psp
commands:
help:
about: Describe this script.
exec:
argv:
- bash
- -lc
- 'cat <<''EOF''
psp
A script for automated tasks.
EOF
'
run:
about: Run the script (inlined); forwards args.
exec:
argv:
- bash
- -lc
- "set -euo pipefail\ntmpdir=\"$(mktemp -d)\"\ntrap 'rm -rf \"$tmpdir\"\
' EXIT\ncat >\"$tmpdir/_psp\" <<'JAN_EOF_psp__psp_4fe997296e08'\n#compdef\
\ psp\n\n# Zsh completion for psp\n# Generated automatically - customize\
\ as needed\n\n_psp() {\n local context state line\n typeset -A\
\ opt_args\n \n _arguments -C \\\n '(-h --help)'{-h,--help}'[Show\
\ help information]' \\\n '(-v --version)'{-v,--version}'[Show\
\ version information]' \\\n '*::arg:_files'\n}\n\n_psp \"$@\"\n\
JAN_EOF_psp__psp_4fe997296e08\nchmod +x \"$tmpdir/_psp\" 2>/dev/null ||\
\ true\ncat >\"$tmpdir/psp.sh\" <<'JAN_EOF_psp_psp_sh_14a073f58727'\n\
#!/bin/bash \n# (c) 2022 Pat Beagan: MIT License\n\npsp () \n{ \n ps\
\ awwfux | less -S\n}\n\npsp \"$@\"\ntrackusage \"$0\"\nJAN_EOF_psp_psp_sh_14a073f58727\n\
chmod +x \"$tmpdir/psp.sh\" 2>/dev/null || true\ncd \"$tmpdir\"\nexec\
\ \"$tmpdir/psp.sh\" \"$@\"\n"
passthrough: true
pystart_script:
about: A script for automated tasks.
path: ../scripts/source/pystart_script
commands:
help:
about: Describe this script.
exec:
argv:
- bash
- -lc
- 'cat <<''EOF''
pystart_script
A script for automated tasks.
EOF
'
run:
about: Run the script (inlined); forwards args.
exec:
argv:
- bash
- -lc
- "set -euo pipefail\ntmpdir=\"$(mktemp -d)\"\ntrap 'rm -rf \"$tmpdir\"\
' EXIT\ncat >\"$tmpdir/_pystart_script\" <<'JAN_EOF_pystart_script__pystart_script_fef4e03b73b1'\n\
#compdef pystart_script\n\n# Zsh completion for pystart_script\n# Generated\
\ automatically - customize as needed\n\n_pystart_script() {\n local\
\ context state line\n typeset -A opt_args\n \n _arguments -C\
\ \\\n '(-h --help)'{-h,--help}'[Show help information]' \\\n \
\ '(-v --version)'{-v,--version}'[Show version information]' \\\n\
\ '*::arg:_files'\n}\n\n_pystart_script \"$@\"\nJAN_EOF_pystart_script__pystart_script_fef4e03b73b1\n\
chmod +x \"$tmpdir/_pystart_script\" 2>/dev/null || true\ncat >\"$tmpdir/pystart_script.py\"\
\ <<'JAN_EOF_pystart_script_pystart_script_py_9b83383a0766'\n#!/usr/bin/env\
\ python3\n# (c) 2022 Pat Beagan: MIT License\n\nimport os\nimport time\n\
import subprocess\nfrom sys import argv\n\n\ndef shdo(command):\n \"\
\"\"Stands for 'shell do', this will just run a bash command\"\"\"\n \
\ p = subprocess.Popen(command, shell=True, stderr=subprocess.PIPE)\n\
\ return p.communicate()\n\n\ndef shdox(command):\n \"\"\"Stands\
\ for 'shell do explicit', this will just run a bash command\"\"\"\n \
\ p = subprocess.Popen(command, stderr=subprocess.PIPE)\n return\
\ p.communicate()\n\n\ns_code_starter = '''#!/usr/bin/env python3\nimport\
\ os\nimport time\nimport subprocess\nimport argparse\nfrom sys import\
\ argv\n\ndescription = \"\"\"\nNew Script.\n\"\"\"\n\n##########################################################################################\n\
### Initialization boilerplate, included for portability \
\ ###\n##########################################################################################\n\
\nverbosity = 0\nverbosity_level = {'quiet': (None, -100), 'error': ('E:\
\ ', -2), 'warning': ('W: ', -1),\n 'info': ('', 0),\
\ 'debug': ('D: ', 1), 'verbose': ('V: ', 2), 'dump': ('Z: ', 3)}\n\n\n\
def dprint(s, s_verbosity_in: str = \"info\"):\n verbosity_in_prefix,\
\ verbosity_in_value = verbosity_level[s_verbosity_in]\n if verbosity\
\ == verbosity_level[\"quiet\"]:\n pass\n elif verbosity_in_value\
\ <= verbosity:\n print(verbosity_in_prefix + s)\n\n\ndef shdo(command):\n\
\ if type(command) == str:\n p = subprocess.Popen(command, shell=True,\
\ stderr=subprocess.PIPE)\n elif type(command) == list:\n p\
\ = subprocess.Popen(command, stderr=subprocess.PIPE)\n else:\n \
\ print(\"No way to infer command usage.\")\n return p.communicate()\n\
\n\ndef parse_args():\n parser = argparse.ArgumentParser(description=description)\n\
\ group = parser.add_mutually_exclusive_group()\n group.add_argument(\n\
\ \"-v\", \"--verbosity\", help=\"Increases the verbosity level.\
\ Supports up to -vvv.\", action=\"count\", default=0)\n group.add_argument(\"\
-q\", \"--quiet\", action=\"store_true\")\n\n ####################\n\
\ ### Replace here ###\n ####################\n parser.add_argument(\n\
\ \"pos1\", help=\"The item in the first position.\", type=int)\n\
\ ####################\n\n global verbosity\n args = parser.parse_args()\n\
\ if args.quiet:\n verbosity = verbosity_level[\"quiet\"]\n\
\ else:\n verbosity = args.verbosity\n return args\n\n##########################################################################################\n\
### Script content \
\ ###\n##########################################################################################\n\
\nif __name__ == \"__main__\":\n args = parse_args()\n\n #######################################\n\
\ ### Here for example, please delete ###\n #######################################\n\
\ dprint(\"At least: error\", \"error\")\n dprint(\"At least: warning\"\
, \"warning\")\n dprint(\"At least: info\", \"info\")\n dprint(\"\
At least: debug\", \"debug\")\n dprint(\"At least: verbose\", \"verbose\"\
)\n dprint(\"At least: dump\", \"dump\")\n print()\n\n out, err\
\ = shdo(f\"echo first:{args.pos1}\")\n print(f\"Out:{out}, Err:{err}\"\
)\n print()\n\n out, err = shdo([\"echo\", f\"second:{args.pos1}\"\
])\n print(f\"Out:{out}, Err:{err}\")\n print()\n'''\n\nif __name__\
\ == \"__main__\":\n s_name = argv[1] + \".py\"\n with open(s_name,\
\ \"w\") as f:\n f.write(s_code_starter)\n shdo(f\"chmod 755\
\ {s_name} && code {s_name}\")\nJAN_EOF_pystart_script_pystart_script_py_9b83383a0766\n\
chmod +x \"$tmpdir/pystart_script.py\" 2>/dev/null || true\ncd \"$tmpdir\"\
\nexec \"$tmpdir/pystart_script.py\" \"$@\"\n"
passthrough: true
random:
about: A script for automated tasks.
path: ../scripts/source/random
commands:
help:
about: Describe this script.
exec:
argv:
- bash
- -lc
- 'cat <<''EOF''
random
A script for automated tasks.
EOF
'
run:
about: Run the script (inlined); forwards args.
exec:
argv:
- bash
- -lc
- "set -euo pipefail\ntmpdir=\"$(mktemp -d)\"\ntrap 'rm -rf \"$tmpdir\"\
' EXIT\ncat >\"$tmpdir/_random\" <<'JAN_EOF_random__random_5e253df84f7d'\n\
#compdef random\n\n# Zsh completion for random\n# Generated automatically\
\ - customize as needed\n\n_random() {\n local context state line\n\
\ typeset -A opt_args\n \n _arguments -C \\\n '(-h --help)'{-h,--help}'[Show\
\ help information]' \\\n '(-v --version)'{-v,--version}'[Show\
\ version information]' \\\n '*::arg:_files'\n}\n\n_random \"$@\"\
\nJAN_EOF_random__random_5e253df84f7d\nchmod +x \"$tmpdir/_random\" 2>/dev/null\
\ || true\ncat >\"$tmpdir/random.sh\" <<'JAN_EOF_random_random_sh_583689604e68'\n\
#!/usr/bin/env zsh\n# (c) 2022 Pat Beagan: MIT License\n\nset -euo pipefail\n\
IFS=$'\\n\\t'\n\nscriptname=\"$(basename \"$0\")\"\n\nhelp () {\n error_code=$?\n\
\ echo \"\nUsage: $scriptname [-h|--help] <max_number>\n\nGenerates\
\ a random number between 1 and the specified maximum value.\n\nArguments:\n\
\ max_number Maximum value for the random number (inclusive)\n\nExamples:\n\
\ $scriptname 10 # Random number between 1 and 10\n $scriptname\
\ 100 # Random number between 1 and 100\n $scriptname 6 \
\ # Simulates a die roll (1-6)\n\"\n if [[ ! $error_code -eq 0 ]];\
\ then echo \"Err: $error_code\"; fi\n}\n\nrandom () {\n\tif [ ! $# -eq\
\ 1 ]\n\tthen\n\t\techo \"Requires int arg\"\n\t\treturn 1\n\tfi\n\techo\
\ $((1 + RANDOM % $1))\n}\n\nrandom \"$@\" || help\ntrackusage \"$0\"\n\
JAN_EOF_random_random_sh_583689604e68\nchmod +x \"$tmpdir/random.sh\"\
\ 2>/dev/null || true\ncd \"$tmpdir\"\nexec \"$tmpdir/random.sh\" \"$@\"\
\n"
passthrough: true
randomart-of:
about: A script for automated tasks.
path: ../scripts/source/randomart-of
commands:
help:
about: Describe this script.
exec:
argv:
- bash
- -lc
- 'cat <<''EOF''
randomart-of
A script for automated tasks.
EOF
'
run:
about: Run the script (inlined); forwards args.
exec:
argv:
- bash
- -lc
- "set -euo pipefail\ntmpdir=\"$(mktemp -d)\"\ntrap 'rm -rf \"$tmpdir\"\
' EXIT\ncat >\"$tmpdir/_randomart-of\" <<'JAN_EOF_randomart_of__randomart_of_6740b3e1c44e'\n\
#compdef randomart-of\n\n# Zsh completion for randomart-of\n# Generated\
\ automatically - customize as needed\n\n_randomart-of() {\n local\
\ context state line\n typeset -A opt_args\n \n _arguments -C\
\ \\\n '(-h --help)'{-h,--help}'[Show help information]' \\\n \
\ '(-v --version)'{-v,--version}'[Show version information]' \\\n\
\ '*::arg:_files'\n}\n\n_randomart-of \"$@\"\nJAN_EOF_randomart_of__randomart_of_6740b3e1c44e\n\
chmod +x \"$tmpdir/_randomart-of\" 2>/dev/null || true\ncat >\"$tmpdir/randomart-of.sh\"\
\ <<'JAN_EOF_randomart_of_randomart_of_sh_85fd0d01aa0f'\n#!/usr/bin/env\
\ zsh\n\nset -euo pipefail\n\nscriptname=\"$(basename \"$0\")\"\nhelp()\
\ {\n error_code=$?\n echo \"\nUsage: $scriptname [-h|--help] <key_file>\n\
\nDisplays the randomart (ASCII art representation) of an SSH key.\nUses\
\ ssh-keygen to show the visual fingerprint of the key.\n\nArguments:\n\
\ key_file Path to the SSH key file (public or private)\n\nFeatures:\n\
\ - Shows ASCII art representation of SSH key fingerprint\n - Uses ssh-keygen\
\ -lv for detailed key information\n - Visual way to verify key fingerprints\n\
\nExamples:\n $scriptname ~/.ssh/id_rsa.pub\n $scriptname ~/.ssh/id_ed25519\n\
\"\n exit $error_code\n}\n\nmain() {\n\n emulate -L zsh\n zmodload\
\ zsh/zutil || return 1\n\n local help\n zparseopts -D -F -K --\
\ \\\n {h,-help}=help ||\n return 1\n\n if (($#help));\
\ then help; fi\n\nrandomart-of () {\n\tssh-keygen -lv -f \"$1\"\n}\n\n\
\ randomart-of \"$@\" || help\n}\n\nmain \"$@\" || help\ntrackusage\
\ \"$0\"\nJAN_EOF_randomart_of_randomart_of_sh_85fd0d01aa0f\nchmod +x\
\ \"$tmpdir/randomart-of.sh\" 2>/dev/null || true\ncd \"$tmpdir\"\nexec\
\ \"$tmpdir/randomart-of.sh\" \"$@\"\n"
passthrough: true
realconf:
about: A script for automated tasks.
path: ../scripts/source/realconf
commands:
help:
about: Describe this script.
exec:
argv:
- bash
- -lc
- 'cat <<''EOF''
realconf
A script for automated tasks.
EOF
'
run:
about: Run the script (inlined); forwards args.
exec:
argv:
- bash
- -lc
- "set -euo pipefail\ntmpdir=\"$(mktemp -d)\"\ntrap 'rm -rf \"$tmpdir\"\
' EXIT\ncat >\"$tmpdir/_realconf\" <<'JAN_EOF_realconf__realconf_9c8ed249d499'\n\
#compdef realconf\n\n# Zsh completion for realconf\n# Generated automatically\
\ - customize as needed\n\n_realconf() {\n local context state line\n\
\ typeset -A opt_args\n \n _arguments -C \\\n '(-h --help)'{-h,--help}'[Show\
\ help information]' \\\n '(-v --version)'{-v,--version}'[Show\
\ version information]' \\\n '*::arg:_files'\n}\n\n_realconf \"\
$@\"\nJAN_EOF_realconf__realconf_9c8ed249d499\nchmod +x \"$tmpdir/_realconf\"\
\ 2>/dev/null || true\ncat >\"$tmpdir/realconf.sh\" <<'JAN_EOF_realconf_realconf_sh_a924607f9f3f'\n\
#!/bin/bash \n# (c) 2022 Pat Beagan: MIT License\n\nrealconf () \n{ \n\
\ cat $1 | grep --color=auto --color=auto -v '#' | grep --color=auto\
\ --color=auto -v '^$'\n}\n\nrealconf \"$@\"\ntrackusage \"$0\"\nJAN_EOF_realconf_realconf_sh_a924607f9f3f\n\
chmod +x \"$tmpdir/realconf.sh\" 2>/dev/null || true\ncd \"$tmpdir\"\n\
exec \"$tmpdir/realconf.sh\" \"$@\"\n"
passthrough: true
rec:
about: A script for automated tasks.
path: ../scripts/source/rec
commands:
help:
about: Describe this script.
exec:
argv:
- bash
- -lc
- 'cat <<''EOF''
rec
A script for automated tasks.
EOF
'
run:
about: Run the script (inlined); forwards args.
exec:
argv:
- bash
- -lc
- "set -euo pipefail\ntmpdir=\"$(mktemp -d)\"\ntrap 'rm -rf \"$tmpdir\"\
' EXIT\ncat >\"$tmpdir/_rec\" <<'JAN_EOF_rec__rec_c30b4a383ab3'\n#compdef\
\ rec\n\n# Zsh completion for rec\n# Generated automatically - customize\
\ as needed\n\n_rec() {\n local context state line\n typeset -A\
\ opt_args\n \n _arguments -C \\\n '(-h --help)'{-h,--help}'[Show\
\ help information]' \\\n '(-v --version)'{-v,--version}'[Show\
\ version information]' \\\n '*::arg:_files'\n}\n\n_rec \"$@\"\n\
JAN_EOF_rec__rec_c30b4a383ab3\nchmod +x \"$tmpdir/_rec\" 2>/dev/null ||\
\ true\ncat >\"$tmpdir/rec.sh\" <<'JAN_EOF_rec_rec_sh_f14b61eddefb'\n\
#!/bin/bash \n# (c) 2022 Pat Beagan: MIT License\n\nrec () \n{ \n script\
\ ~/Downloads/typescript-`date | sed 's/ /-/g'`.log;\n history > ~/Downloads/\"\
$(echo \"history-`date`.log\" | sed s/\\ /_/g)\"\n}\n\nrec \"$@\"\ntrackusage\
\ \"$0\"\nJAN_EOF_rec_rec_sh_f14b61eddefb\nchmod +x \"$tmpdir/rec.sh\"\
\ 2>/dev/null || true\ncd \"$tmpdir\"\nexec \"$tmpdir/rec.sh\" \"$@\"\n"
passthrough: true
rederr:
about: A script for automated tasks.
path: ../scripts/source/rederr
commands:
help:
about: Describe this script.
exec:
argv:
- bash
- -lc
- 'cat <<''EOF''
rederr
A script for automated tasks.
EOF
'
run:
about: Run the script (inlined); forwards args.
exec:
argv:
- bash
- -lc
- "set -euo pipefail\ntmpdir=\"$(mktemp -d)\"\ntrap 'rm -rf \"$tmpdir\"\
' EXIT\ncat >\"$tmpdir/_rederr\" <<'JAN_EOF_rederr__rederr_095e7f0dd09b'\n\
#compdef rederr\n\n# Zsh completion for rederr\n# Generated automatically\
\ - customize as needed\n\n_rederr() {\n local context state line\n\
\ typeset -A opt_args\n \n _arguments -C \\\n '(-h --help)'{-h,--help}'[Show\
\ help information]' \\\n '(-v --version)'{-v,--version}'[Show\
\ version information]' \\\n '*::arg:_files'\n}\n\n_rederr \"$@\"\
\nJAN_EOF_rederr__rederr_095e7f0dd09b\nchmod +x \"$tmpdir/_rederr\" 2>/dev/null\
\ || true\ncat >\"$tmpdir/rederr.sh\" <<'JAN_EOF_rederr_rederr_sh_aebaed1fc619'\n\
#!/bin/bash \n# (c) 2022 Pat Beagan: MIT License\n\nrederr () \n{ \n \
\ \"$@\" 2>&1 1>&3 | sed \"s,.*,\\033[31m&\\e[0m,\" 1>&2\n} 3>&1\n\n\
rederr \"$@\"\ntrackusage \"$0\"\nJAN_EOF_rederr_rederr_sh_aebaed1fc619\n\
chmod +x \"$tmpdir/rederr.sh\" 2>/dev/null || true\ncd \"$tmpdir\"\nexec\
\ \"$tmpdir/rederr.sh\" \"$@\"\n"
passthrough: true
remindme:
about: A script for automated tasks.
path: ../scripts/source/remindme
commands:
help:
about: Describe this script.
exec:
argv:
- bash
- -lc
- 'cat <<''EOF''
remindme
A script for automated tasks.
EOF
'
run:
about: Run the script (inlined); forwards args.
exec:
argv:
- bash
- -lc
- "set -euo pipefail\ntmpdir=\"$(mktemp -d)\"\ntrap 'rm -rf \"$tmpdir\"\
' EXIT\ncat >\"$tmpdir/_remindme\" <<'JAN_EOF_remindme__remindme_4f32473a9af6'\n\
#compdef remindme\n\n# Zsh completion for remindme\n# Generated automatically\
\ - customize as needed\n\n_remindme() {\n local context state line\n\
\ typeset -A opt_args\n \n _arguments -C \\\n '(-h --help)'{-h,--help}'[Show\
\ help information]' \\\n '(-v --version)'{-v,--version}'[Show\
\ version information]' \\\n '*::arg:_files'\n}\n\n_remindme \"\
$@\"\nJAN_EOF_remindme__remindme_4f32473a9af6\nchmod +x \"$tmpdir/_remindme\"\
\ 2>/dev/null || true\ncat >\"$tmpdir/remindme.sh\" <<'JAN_EOF_remindme_remindme_sh_1a44679fa4f4'\n\
#!/usr/bin/env zsh\n\nset -euo pipefail\n\nscriptname=\"$(basename \"\
$0\")\"\nhelp() {\n error_code=$?\n echo \"\nUsage: $scriptname\
\ [-h|--help] <reminder_text>\n\nCreates a reminder in the macOS Reminders\
\ app using AppleScript.\nAdds the reminder to the default 'Reminders'\
\ list.\n\nArguments:\n reminder_text Text content for the reminder\n\
\nFeatures:\n - Uses macOS Reminders app\n - Adds to default 'Reminders'\
\ list\n - Works with AppleScript automation\n\nExamples:\n $scriptname\
\ 'Call mom tomorrow'\n $scriptname 'Buy groceries on Friday'\n\"\n \
\ exit $error_code\n}\n\nmain() {\n\n emulate -L zsh\n zmodload\
\ zsh/zutil || return 1\n\n local help\n zparseopts -D -F -K --\
\ \\\n {h,-help}=help ||\n return 1\n\n if (($#help));\
\ then help; fi\n\nremindme () {\n\tosascript - \"$1\" <<END\non run a\n\
tell app \"Reminders\"\ntell list \"Reminders\" of default account\nmake\
\ new reminder with properties {name:item 1 of a}\nend\nend\nend\nEND\n\
}\n\n remindme \"$@\" || help\n}\n\nmain \"$@\" || help\ntrackusage\
\ \"$0\"\nJAN_EOF_remindme_remindme_sh_1a44679fa4f4\nchmod +x \"$tmpdir/remindme.sh\"\
\ 2>/dev/null || true\ncd \"$tmpdir\"\nexec \"$tmpdir/remindme.sh\" \"\
$@\"\n"
passthrough: true
restart_touchpad:
about: A script for automated tasks.
path: ../scripts/source/restart_touchpad
commands:
help:
about: Describe this script.
exec:
argv:
- bash
- -lc
- 'cat <<''EOF''
restart_touchpad
A script for automated tasks.
EOF
'
run:
about: Run the script (inlined); forwards args.
exec:
argv:
- bash
- -lc
- "set -euo pipefail\ntmpdir=\"$(mktemp -d)\"\ntrap 'rm -rf \"$tmpdir\"\
' EXIT\ncat >\"$tmpdir/_restart_touchpad\" <<'JAN_EOF_restart_touchpad__restart_touchpad_e18193702448'\n\
#compdef restart_touchpad\n\n# Zsh completion for restart_touchpad\n#\
\ Generated automatically - customize as needed\n\n_restart_touchpad()\
\ {\n local context state line\n typeset -A opt_args\n \n \
\ _arguments -C \\\n '(-h --help)'{-h,--help}'[Show help information]'\
\ \\\n '(-v --version)'{-v,--version}'[Show version information]'\
\ \\\n '*::arg:_files'\n}\n\n_restart_touchpad \"$@\"\nJAN_EOF_restart_touchpad__restart_touchpad_e18193702448\n\
chmod +x \"$tmpdir/_restart_touchpad\" 2>/dev/null || true\ncat >\"$tmpdir/restart_touchpad.sh\"\
\ <<'JAN_EOF_restart_touchpad_restart_touchpad_sh_7f8b79c04934'\nsudo\
\ modprobe -r psmouse\nsudo modprobe psmouse\nJAN_EOF_restart_touchpad_restart_touchpad_sh_7f8b79c04934\n\
chmod +x \"$tmpdir/restart_touchpad.sh\" 2>/dev/null || true\ncd \"$tmpdir\"\
\nexec \"$tmpdir/restart_touchpad.sh\" \"$@\"\n"
passthrough: true
restart_touchpad_2:
about: A script for automated tasks.
path: ../scripts/source/restart_touchpad_2
commands:
help:
about: Describe this script.
exec:
argv:
- bash
- -lc
- 'cat <<''EOF''
restart_touchpad_2
A script for automated tasks.
EOF
'
run:
about: Run the script (inlined); forwards args.
exec:
argv:
- bash
- -lc
- "set -euo pipefail\ntmpdir=\"$(mktemp -d)\"\ntrap 'rm -rf \"$tmpdir\"\
' EXIT\ncat >\"$tmpdir/_restart_touchpad_2\" <<'JAN_EOF_restart_touchpad_2__restart_touchpad_2_88be82e76d80'\n\
#compdef restart_touchpad_2\n\n# Zsh completion for restart_touchpad_2\n\
# Generated automatically - customize as needed\n\n_restart_touchpad_2()\
\ {\n local context state line\n typeset -A opt_args\n \n \
\ _arguments -C \\\n '(-h --help)'{-h,--help}'[Show help information]'\
\ \\\n '(-v --version)'{-v,--version}'[Show version information]'\
\ \\\n '*::arg:_files'\n}\n\n_restart_touchpad_2 \"$@\"\nJAN_EOF_restart_touchpad_2__restart_touchpad_2_88be82e76d80\n\
chmod +x \"$tmpdir/_restart_touchpad_2\" 2>/dev/null || true\ncat >\"\
$tmpdir/restart_touchpad_2.sh\" <<'JAN_EOF_restart_touchpad_2_restart_touchpad_2_sh_01b0d5d14c94'\n\
#!/bin/bash\n# (c) 2022 Pat Beagan: MIT License\n\nif [[ $1 == post ]];\
\ then\n modprobe -r psmouse\n modprobe psmouse\nfi\nJAN_EOF_restart_touchpad_2_restart_touchpad_2_sh_01b0d5d14c94\n\
chmod +x \"$tmpdir/restart_touchpad_2.sh\" 2>/dev/null || true\ncd \"\
$tmpdir\"\nexec \"$tmpdir/restart_touchpad_2.sh\" \"$@\"\n"
passthrough: true
revnum:
about: A script for automated tasks.
path: ../scripts/source/revnum
commands:
help:
about: Describe this script.
exec:
argv:
- bash
- -lc
- 'cat <<''EOF''
revnum
A script for automated tasks.
EOF
'
run:
about: Run the script (inlined); forwards args.
exec:
argv:
- bash
- -lc
- "set -euo pipefail\ntmpdir=\"$(mktemp -d)\"\ntrap 'rm -rf \"$tmpdir\"\
' EXIT\ncat >\"$tmpdir/_revnum\" <<'JAN_EOF_revnum__revnum_ba259139339e'\n\
#compdef revnum\n\n# Zsh completion for revnum\n# Generated automatically\
\ - customize as needed\n\n_revnum() {\n local context state line\n\
\ typeset -A opt_args\n \n _arguments -C \\\n '(-h --help)'{-h,--help}'[Show\
\ help information]' \\\n '(-v --version)'{-v,--version}'[Show\
\ version information]' \\\n '*::arg:_files'\n}\n\n_revnum \"$@\"\
\nJAN_EOF_revnum__revnum_ba259139339e\nchmod +x \"$tmpdir/_revnum\" 2>/dev/null\
\ || true\ncat >\"$tmpdir/revnum.sh\" <<'JAN_EOF_revnum_revnum_sh_6cdfddcf0d68'\n\
#!/bin/bash \n# (c) 2022 Pat Beagan: MIT License\n\nrevnum () \n{ \n \
\ git rev-list --count HEAD\n}\n\nrevnum \"$@\"\ntrackusage \"$0\"\n\
JAN_EOF_revnum_revnum_sh_6cdfddcf0d68\nchmod +x \"$tmpdir/revnum.sh\"\
\ 2>/dev/null || true\ncd \"$tmpdir\"\nexec \"$tmpdir/revnum.sh\" \"$@\"\
\n"
passthrough: true
savealias:
about: A script for automated tasks.
path: ../scripts/source/savealias
commands:
help:
about: Describe this script.
exec:
argv:
- bash
- -lc
- 'cat <<''EOF''
savealias
A script for automated tasks.
EOF
'
run:
about: Run the script (inlined); forwards args.
exec:
argv:
- bash
- -lc
- "set -euo pipefail\ntmpdir=\"$(mktemp -d)\"\ntrap 'rm -rf \"$tmpdir\"\
' EXIT\ncat >\"$tmpdir/_savealias\" <<'JAN_EOF_savealias__savealias_9769fcbebb90'\n\
#compdef savealias\n\n# Zsh completion for savealias\n# Generated automatically\
\ - customize as needed\n\n_savealias() {\n local context state line\n\
\ typeset -A opt_args\n \n _arguments -C \\\n '(-h --help)'{-h,--help}'[Show\
\ help information]' \\\n '(-v --version)'{-v,--version}'[Show\
\ version information]' \\\n '*::arg:_files'\n}\n\n_savealias \"\
$@\"\nJAN_EOF_savealias__savealias_9769fcbebb90\nchmod +x \"$tmpdir/_savealias\"\
\ 2>/dev/null || true\ncat >\"$tmpdir/savealias.py\" <<'JAN_EOF_savealias_savealias_py_fbb1929fc312'\n\
#!/usr/bin/env python3\n# (c) 2022 Pat Beagan: MIT License\n\nimport os\n\
import argparse\n\nfilename = \"../../alias\"\nfilename = os.path.dirname(os.path.realpath(__file__))\
\ + \"/\" + filename\n\ndescription = \"\"\"\nNew Script.\n\"\"\"\n\n\n\
def parse_args():\n parser = argparse.ArgumentParser(description=description)\n\
\ parser.add_argument(\"name\", help=\"The name of the alias\", type=str)\n\
\ parser.add_argument(\"script\", help=\"The content of the alias\"\
, type=str)\n args = parser.parse_args()\n return args\n\n\nif __name__\
\ == \"__main__\":\n args = parse_args()\n\n name = args.name\n\
\ script = args.script\n script = f\"alias {name}='{script}'\"\n\
\n with open(filename, \"a\") as f:\n f.write(\"\\n\")\n \
\ f.write(script)\n print(f'Wrote \"{script}\" to {filename}')\n\
JAN_EOF_savealias_savealias_py_fbb1929fc312\nchmod +x \"$tmpdir/savealias.py\"\
\ 2>/dev/null || true\ncd \"$tmpdir\"\nexec \"$tmpdir/savealias.py\" \"\
$@\"\n"
passthrough: true
script_content:
about: A script for automated tasks.
path: ../scripts/source/script_content
commands:
help:
about: Describe this script.
exec:
argv:
- bash
- -lc
- 'cat <<''EOF''
script_content
A script for automated tasks.
EOF
'
run:
about: Run the script (inlined); forwards args.
exec:
argv:
- bash
- -lc
- "set -euo pipefail\ntmpdir=\"$(mktemp -d)\"\ntrap 'rm -rf \"$tmpdir\"\
' EXIT\ncat >\"$tmpdir/_script_content\" <<'JAN_EOF_script_content__script_content_4c76bfeae440'\n\
#compdef script_content\n\n# Zsh completion for script_content\n# Generated\
\ automatically - customize as needed\n\n_script_content() {\n local\
\ context state line\n typeset -A opt_args\n \n _arguments -C\
\ \\\n '(-h --help)'{-h,--help}'[Show help information]' \\\n \
\ '(-v --version)'{-v,--version}'[Show version information]' \\\n\
\ '*::arg:_files'\n}\n\n_script_content \"$@\"\nJAN_EOF_script_content__script_content_4c76bfeae440\n\
chmod +x \"$tmpdir/_script_content\" 2>/dev/null || true\ncat >\"$tmpdir/script_content.sh\"\
\ <<'JAN_EOF_script_content_script_content_sh_d2bc0597505c'\n#!/bin/bash\n\
# (c) 2022 Pat Beagan: MIT License\n\nscript_content () \n{ \n cat\
\ $(which \"${1}\")\n}\n\nscript_content \"$@\"\ntrackusage \"$0\"\nJAN_EOF_script_content_script_content_sh_d2bc0597505c\n\
chmod +x \"$tmpdir/script_content.sh\" 2>/dev/null || true\ncd \"$tmpdir\"\
\nexec \"$tmpdir/script_content.sh\" \"$@\"\n"
passthrough: true
search-alltrails-from-file:
about: A script for automated tasks.
path: ../scripts/source/search-alltrails-from-file
commands:
help:
about: Describe this script.
exec:
argv:
- bash
- -lc
- 'cat <<''EOF''
search-alltrails-from-file
A script for automated tasks.
EOF
'
run:
about: Run the script (inlined); forwards args.
exec:
argv:
- bash
- -lc
- "set -euo pipefail\ntmpdir=\"$(mktemp -d)\"\ntrap 'rm -rf \"$tmpdir\"\
' EXIT\ncat >\"$tmpdir/_search-alltrails-from-file\" <<'JAN_EOF_search_alltrails_from_file__search_alltrails_fro_e03c64d083e5'\n\
#compdef search-alltrails-from-file\n\n# Zsh completion for search-alltrails-from-file\n\
# Generated automatically - customize as needed\n\n_search-alltrails-from-file()\
\ {\n local context state line\n typeset -A opt_args\n \n \
\ _arguments -C \\\n '(-h --help)'{-h,--help}'[Show help information]'\
\ \\\n '(-v --version)'{-v,--version}'[Show version information]'\
\ \\\n '*::arg:_files'\n}\n\n_search-alltrails-from-file \"$@\"\
\nJAN_EOF_search_alltrails_from_file__search_alltrails_fro_e03c64d083e5\n\
chmod +x \"$tmpdir/_search-alltrails-from-file\" 2>/dev/null || true\n\
cat >\"$tmpdir/search-alltrails-from-file.sh\" <<'JAN_EOF_search_alltrails_from_file_search_alltrails_from_85dbd80ad4e9'\n\
#!/bin/bash\n\n# Check if a file path is provided\nif [ $# -eq 0 ]\nthen\n\
\ echo \"Usage: $0 <file_path>\"\n exit 1\nfi\n\n# Read the file\
\ line by line\nwhile IFS= read -r line\ndo\n # Encode the line for\
\ URL usage\n encoded_line=$(echo \"$line\" | jq -sRr @uri)\n\n \
\ # Construct DuckDuckGo search URL\n search_url=\"https://duckduckgo.com/?q=$encoded_line&t=h_&ia=web\"\
\n\n # Open the URL in the default web browser\n xdg-open \"$search_url\"\
\n # Uncomment the next line if you are using macOS\n # open \"\
$search_url\"\n # Uncomment the next line if you are using Windows\n\
\ # start \"$search_url\"\n\n # Optional: wait a bit between opening\
\ each search to avoid overwhelming your browser\n sleep 2\n\ndone\
\ < \"$1\"\nJAN_EOF_search_alltrails_from_file_search_alltrails_from_85dbd80ad4e9\n\
chmod +x \"$tmpdir/search-alltrails-from-file.sh\" 2>/dev/null || true\n\
cd \"$tmpdir\"\nexec \"$tmpdir/search-alltrails-from-file.sh\" \"$@\"\n"
passthrough: true
search-ddg-from-file:
about: A script for automated tasks.
path: ../scripts/source/search-ddg-from-file
commands:
help:
about: Describe this script.
exec:
argv:
- bash
- -lc
- 'cat <<''EOF''
search-ddg-from-file
A script for automated tasks.
EOF
'
run:
about: Run the script (inlined); forwards args.
exec:
argv:
- bash
- -lc
- "set -euo pipefail\ntmpdir=\"$(mktemp -d)\"\ntrap 'rm -rf \"$tmpdir\"\
' EXIT\ncat >\"$tmpdir/_search-ddg-from-file\" <<'JAN_EOF_search_ddg_from_file__search_ddg_from_file_21b9e26eddee'\n\
#compdef search-ddg-from-file\n\n# Zsh completion for search-ddg-from-file\n\
# Generated automatically - customize as needed\n\n_search-ddg-from-file()\
\ {\n local context state line\n typeset -A opt_args\n \n \
\ _arguments -C \\\n '(-h --help)'{-h,--help}'[Show help information]'\
\ \\\n '(-v --version)'{-v,--version}'[Show version information]'\
\ \\\n '*::arg:_files'\n}\n\n_search-ddg-from-file \"$@\"\nJAN_EOF_search_ddg_from_file__search_ddg_from_file_21b9e26eddee\n\
chmod +x \"$tmpdir/_search-ddg-from-file\" 2>/dev/null || true\ncat >\"\
$tmpdir/search-ddg-from-file.sh\" <<'JAN_EOF_search_ddg_from_file_search_ddg_from_file_sh_85dbd80ad4e9'\n\
#!/bin/bash\n\n# Check if a file path is provided\nif [ $# -eq 0 ]\nthen\n\
\ echo \"Usage: $0 <file_path>\"\n exit 1\nfi\n\n# Read the file\
\ line by line\nwhile IFS= read -r line\ndo\n # Encode the line for\
\ URL usage\n encoded_line=$(echo \"$line\" | jq -sRr @uri)\n\n \
\ # Construct DuckDuckGo search URL\n search_url=\"https://duckduckgo.com/?q=$encoded_line&t=h_&ia=web\"\
\n\n # Open the URL in the default web browser\n xdg-open \"$search_url\"\
\n # Uncomment the next line if you are using macOS\n # open \"\
$search_url\"\n # Uncomment the next line if you are using Windows\n\
\ # start \"$search_url\"\n\n # Optional: wait a bit between opening\
\ each search to avoid overwhelming your browser\n sleep 2\n\ndone\
\ < \"$1\"\nJAN_EOF_search_ddg_from_file_search_ddg_from_file_sh_85dbd80ad4e9\n\
chmod +x \"$tmpdir/search-ddg-from-file.sh\" 2>/dev/null || true\ncd \"\
$tmpdir\"\nexec \"$tmpdir/search-ddg-from-file.sh\" \"$@\"\n"
passthrough: true
search-mavencentral:
about: A script for automated tasks.
path: ../scripts/source/search-mavencentral
commands:
help:
about: Describe this script.
exec:
argv:
- bash
- -lc
- 'cat <<''EOF''
search-mavencentral
A script for automated tasks.
EOF
'
run:
about: Run the script (inlined); forwards args.
exec:
argv:
- bash
- -lc
- "set -euo pipefail\ntmpdir=\"$(mktemp -d)\"\ntrap 'rm -rf \"$tmpdir\"\
' EXIT\ncat >\"$tmpdir/_search-mavencentral\" <<'JAN_EOF_search_mavencentral__search_mavencentral_a6c0380b7775'\n\
#compdef search-mavencentral\n\n# Zsh completion for search-mavencentral\n\
# Generated automatically - customize as needed\n\n_search-mavencentral()\
\ {\n local context state line\n typeset -A opt_args\n \n \
\ _arguments -C \\\n '(-h --help)'{-h,--help}'[Show help information]'\
\ \\\n '(-v --version)'{-v,--version}'[Show version information]'\
\ \\\n '*::arg:_files'\n}\n\n_search-mavencentral \"$@\"\nJAN_EOF_search_mavencentral__search_mavencentral_a6c0380b7775\n\
chmod +x \"$tmpdir/_search-mavencentral\" 2>/dev/null || true\ncat >\"\
$tmpdir/search-mavencentral.sh\" <<'JAN_EOF_search_mavencentral_search_mavencentral_sh_4ae7f0fcb336'\n\
#!/usr/bin/zsh\nset -x\n\nurl=\"http://search.maven.org/solrsearch/select\"\
\n\ntypeset -A params\nparams=(\n 'rows' '20'\n 'wt' 'json'\n)\n\
\nfunction construct() {\n local isFirst='true'\n\n for k v in \"\
${(@kv)params}\"; do \n if [ \"$isFirst\" = 'true' ]; then \n \
\ url=\"$url?$k=$v\"\n ifFirst='false'\n else\n\
\ url=\"$url&$k=$v\"\n fi\n echo $url\n done\n\
}\n\nconstruct\n\ncurl \"$url&q=$1\"\nJAN_EOF_search_mavencentral_search_mavencentral_sh_4ae7f0fcb336\n\
chmod +x \"$tmpdir/search-mavencentral.sh\" 2>/dev/null || true\ncd \"\
$tmpdir\"\nexec \"$tmpdir/search-mavencentral.sh\" \"$@\"\n"
passthrough: true
shard:
about: A script for automated tasks.
path: ../scripts/source/shard
commands:
help:
about: Describe this script.
exec:
argv:
- bash
- -lc
- 'cat <<''EOF''
shard
A script for automated tasks.
EOF
'
run:
about: Run the script (inlined); forwards args.
exec:
argv:
- bash
- -lc
- "set -euo pipefail\ntmpdir=\"$(mktemp -d)\"\ntrap 'rm -rf \"$tmpdir\"\
' EXIT\ncat >\"$tmpdir/_shard\" <<'JAN_EOF_shard__shard_ee5e249d8a2f'\n\
#compdef shard\n\n# Zsh completion for shard\n# Generated automatically\
\ - customize as needed\n\n_shard() {\n local context state line\n\
\ typeset -A opt_args\n \n _arguments -C \\\n '(-h --help)'{-h,--help}'[Show\
\ help information]' \\\n '(-v --version)'{-v,--version}'[Show\
\ version information]' \\\n '*::arg:_files'\n}\n\n_shard \"$@\"\
\nJAN_EOF_shard__shard_ee5e249d8a2f\nchmod +x \"$tmpdir/_shard\" 2>/dev/null\
\ || true\ncat >\"$tmpdir/shard.py\" <<'JAN_EOF_shard_shard_py_c362330fb00b'\n\
#!/usr/bin/env python3\n# (c) 2022 Pat Beagan: MIT License\nimport os\n\
import time\nimport subprocess\nimport argparse\nfrom sys import argv\n\
from os.path import join, getsize\nimport hashlib\nimport re\n\ndescription\
\ = \"\"\"\nNew Script.\n\"\"\"\n\nverbosity = 0\nverbosity_level = {\n\
\ \"quiet\": (None, -100),\n \"error\": (\"E: \", -2),\n \"warning\"\
: (\"W: \", -1),\n \"info\": (\"\", 0),\n \"debug\": (\"D: \", 1),\n\
\ \"verbose\": (\"V: \", 2),\n \"dump\": (\"Z: \", 3),\n}\n\n\n\
def dprint(s, s_verbosity_in: str = \"info\"):\n verbosity_in_prefix,\
\ verbosity_in_value = verbosity_level[s_verbosity_in]\n if verbosity\
\ == verbosity_level[\"quiet\"]:\n pass\n elif verbosity_in_value\
\ <= verbosity:\n print(verbosity_in_prefix + s)\n\n\ndef parse_args():\n\
\ parser = argparse.ArgumentParser(description=description)\n group\
\ = parser.add_mutually_exclusive_group()\n group.add_argument(\n \
\ \"-v\",\n \"--verbosity\",\n help=\"Increases the\
\ verbosity level. Supports up to -vvv.\",\n action=\"count\",\n\
\ default=0,\n )\n group.add_argument(\"-q\", \"--quiet\"\
, action=\"store_true\")\n\n global verbosity\n args = parser.parse_args()\n\
\ if args.quiet:\n verbosity = verbosity_level[\"quiet\"]\n\
\ else:\n verbosity = args.verbosity\n return args\n\n\n\
def attempt_non_collision_rename(new_name):\n ii = 1\n while True:\n\
\ basename = os.path.splitext(new_name)\n new_name = basename[0]\
\ + \"_\" + str(ii) + basename[1]\n if not os.path.exists(new_name):\n\
\ return new_name\n ii += 1\n\n\nif __name__ == \"__main__\"\
:\n args = parse_args()\n top = os.getcwd()\n files_arr = []\n\
\ for root, dirs, files in os.walk(\n top, topdown=True, onerror=None,\
\ followlinks=False\n ):\n print(root, \"consumes\", end=\"\
\ \")\n print(sum(getsize(join(root, name)) for name in files),\
\ end=\" \")\n print(\"bytes in\", len(files), \"non-directory\
\ files\")\n dprint(\"Test code.\", \"error\")\n curr_dir\
\ = os.path.basename(root)\n dirs.clear()\n\n # checking\
\ tmsu is active\n try:\n command = [\"tmsu\", \"files\"\
]\n subprocess.check_call(command)\n except subprocess.CalledProcessError:\n\
\ exit(\"failure running tmsu\")\n\n for f in files:\n\
\n file_name = f\"{root}/{f}\"\n\n with open(file_name,\
\ \"rb\") as in_file:\n\n # getting the hash of the file\n\
\ m = hashlib.sha256(in_file.read()).hexdigest()\n\n \
\ # generating the short hash directory\n \
\ short_hash = m[0:1]\n if not os.path.exists(short_hash):\n\
\ os.makedirs(short_hash)\n\n relative_new_name\
\ = m + os.path.splitext(file_name)[1]\n # f\"{curr_dir}.{f}\"\
\n new_name = f\"{short_hash}/{relative_new_name}\"\n\n\
\ # Make sure that we will not collide\n \
\ if os.path.exists(new_name):\n new_name = attempt_non_collision_rename(new_name)\n\
\n os.rename(file_name, new_name)\n print(\"\
Copied \" + file_name + \" as \" + new_name)\n\n # adding\
\ tags to the file\n try:\n cleanF =\
\ re.sub(\"\\W+\", \"_\", f)\n command = [\n \
\ \"tmsu\",\n \"tag\",\n \
\ f\"{new_name}\",\n f\"category={curr_dir}\"\
,\n f\"original_name={cleanF}\",\n \
\ ]\n print(command)\n subprocess.check_call(command)\n\
\ except subprocess.CalledProcessError:\n \
\ exit(\"failure running tmsu\")\n\n print()\nJAN_EOF_shard_shard_py_c362330fb00b\n\
chmod +x \"$tmpdir/shard.py\" 2>/dev/null || true\ncat >\"$tmpdir/shard.sh\"\
\ <<'JAN_EOF_shard_shard_sh_6645a450db94'\n#!/bin/bash\n# (c) 2022 Pat\
\ Beagan: MIT License\n\n. $LIB_MACHINE_TYPES\n\nshard () \n{ \n function\
\ perform_shard () \n { \n for i in $(find . -maxdepth 1 ! -name\
\ shard -type f);\n do\n ## Setting hashsum\n \
\ if is-test system os linux; then\n a=\"$(md5sum\
\ $i | sed 's/ .*//g')\";\n else\n if is-test\
\ system os mac; then\n temp=\"$(md5 $i)\";\n \
\ a=\"${temp##* }\";\n else\n \
\ echo Unsupported OS && return 1;\n fi;\n \
\ fi;\n\n ## Minifying hashsum\n b=$(echo\
\ \"${a:0:1}\");\n \n ## If the mini hashsum is\
\ valid, we can proceed with moving the file there.\n valid=\"\
0 1 2 3 4 5 6 7 8 9 a b c d e f\";\n if [[ \" $valid \" =~\
\ \" $b \" ]]; then\n mkdir -pv -p \"$b\";\n \
\ if is-test system os mac; then\n gmv --backup=numbered\
\ \"$i\" \"$b\";\n fi;\n if is-test system\
\ os linux; then\n mv --backup=numbered \"$i\" \"$b\"\
;\n fi;\n else\n echo \"$a Was\
\ not a valid minified hashsum.\";\n fi;\n done\n \
\ };\n if [ $# -ne 1 ]; then\n echo Please specify a directory\
\ to shard. The files in that directory will be reassigned to an alphanumeric\
\ directory. Best used with flatten.;\n else\n directory=\"\
$1\";\n cd \"$directory\" && rename 'y/ /_/' * && perform_shard;\n\
\ fi\n}\n\nshard \"$@\"\ntrackusage \"$0\"\nJAN_EOF_shard_shard_sh_6645a450db94\n\
chmod +x \"$tmpdir/shard.sh\" 2>/dev/null || true\ncd \"$tmpdir\"\nexec\
\ \"$tmpdir/shard.sh\" \"$@\"\n"
passthrough: true
show:
about: A script for automated tasks.
path: ../scripts/source/show
commands:
help:
about: Describe this script.
exec:
argv:
- bash
- -lc
- 'cat <<''EOF''
show
A script for automated tasks.
EOF
'
run:
about: Run the script (inlined); forwards args.
exec:
argv:
- bash
- -lc
- "set -euo pipefail\ntmpdir=\"$(mktemp -d)\"\ntrap 'rm -rf \"$tmpdir\"\
' EXIT\ncat >\"$tmpdir/_show\" <<'JAN_EOF_show__show_e8100a64487c'\n#compdef\
\ show\n\n# Zsh completion for show\n# Generated automatically - customize\
\ as needed\n\n_show() {\n local context state line\n typeset -A\
\ opt_args\n \n _arguments -C \\\n '(-h --help)'{-h,--help}'[Show\
\ help information]' \\\n '(-v --version)'{-v,--version}'[Show\
\ version information]' \\\n '*::arg:_files'\n}\n\n_show \"$@\"\
\nJAN_EOF_show__show_e8100a64487c\nchmod +x \"$tmpdir/_show\" 2>/dev/null\
\ || true\ncat >\"$tmpdir/show.py\" <<'JAN_EOF_show_show_py_f52ea09aa530'\n\
#!/usr/bin/env python3\n# (c) 2022 Pat Beagan: MIT License\nimport os\n\
import time\nimport subprocess\nimport argparse\nfrom sys import argv\n\
\n\ndescription = \"\"\"\nShows snippets for complicated tools, that are\
\ not suited to scripts, but could still be reused via a reference.\n\"\
\"\"\n\n\nmagick = \"\"\"\nmontage * -geometry 55x55+1+1 out.jpg\n\"\"\
\"\n\nurls = {\n \"lifecycle\": \"https://i.stack.imgur.com/1llRw.png;\"\
,\n \"versions\": \"https://source.android.com/source/build-numbers#platform-code-names-versions-api-levels-and-ndk-releases;\"\
,\n \"patterns\": \"https://i.pinimg.com/736x/5c/33/8e/5c338e86d098eb9955703b00dd3f20ea--programming-patterns-programming-languages.jpg;\"\
,\n \"cat\": \"https://static.pexels.com/photos/45201/kitty-cat-kitten-pet-45201.jpeg;\"\
,\n \"chair\": \"https://secure.img1-fg.wfcdn.com/im/60980607/resize-h800%5Ecompr-r85/2899/28992811/Chrisanna+Wingback+Chair.jpg;\"\
,\n \"androidbuild\": \"https://0d9321c1-a-db1c6dfe-s-sites.googlegroups.com/a/android.com/tools/tech-docs/new-build-system/build-workflow/Android%20Build%20Process.png?attachauth=ANoY7cp-hIec4CDD1jN5i8wfRE3DdJj80SYJjHxhZCFvE9SEJFYMWwexrscJVdEAAMALSkr-j7ijohyyBM0L-bU4NFn89--vSSBaoV3Yij7mXST6KH3MWKrGl0nVjHMmnles6yZsSMhA8k-Aq1SO-fso0Oisnlm3A9PfHj8a1tcSjq6vNqhEJH9keWsA6PK7-g28LBuR7VJ9pL0EAI94vxUVRf_tDQN67gncihsVFVmx7aLJ00TGEIUJv-KkL_Gna4KGV5JbXp7dT-pUSpLj1v3I6h4l_ykKQw%3D%3D&attredirects=0\"\
,\n}\n\n\ndef shdo(command):\n p = subprocess.Popen(command, shell=True,\
\ stderr=subprocess.PIPE)\n return p.communicate()\n\n\nif __name__\
\ == \"__main__\":\n parser = argparse.ArgumentParser(description=description)\n\
\ group = parser.add_mutually_exclusive_group()\n group.add_argument(\n\
\ \"--magick\", help=\"shows common imagemagick snippets\", action=\"\
store_true\"\n )\n group.add_argument(\n \"--url\", help=\"\
opens up web documentation. Use with '-' for options.\", type=str\n \
\ )\n args = parser.parse_args()\n\n if args.magick:\n print(magick)\n\
\ elif args.url:\n try:\n url = urls[args.url]\n\
\ shdo(f\"open {url}\")\n except KeyError:\n \
\ print(\"Not a valid url, options are:\")\n for k in urls:\n\
\ print(f\" {k}\")\n else:\n parser.print_help()\n\
JAN_EOF_show_show_py_f52ea09aa530\nchmod +x \"$tmpdir/show.py\" 2>/dev/null\
\ || true\ncd \"$tmpdir\"\nexec \"$tmpdir/show.py\" \"$@\"\n"
passthrough: true
simpleBackup:
about: A script for automated tasks.
path: ../scripts/source/simpleBackup
commands:
help:
about: Describe this script.
exec:
argv:
- bash
- -lc
- 'cat <<''EOF''
simpleBackup
A script for automated tasks.
EOF
'
run:
about: Run the script (inlined); forwards args.
exec:
argv:
- bash
- -lc
- "set -euo pipefail\ntmpdir=\"$(mktemp -d)\"\ntrap 'rm -rf \"$tmpdir\"\
' EXIT\ncat >\"$tmpdir/_simpleBackup\" <<'JAN_EOF_simpleBackup__simpleBackup_f9eeae3296ba'\n\
#compdef simpleBackup\n\n# Zsh completion for simpleBackup\n# Generated\
\ automatically - customize as needed\n\n_simpleBackup() {\n local\
\ context state line\n typeset -A opt_args\n \n _arguments -C\
\ \\\n '(-h --help)'{-h,--help}'[Show help information]' \\\n \
\ '(-v --version)'{-v,--version}'[Show version information]' \\\n\
\ '*::arg:_files'\n}\n\n_simpleBackup \"$@\"\nJAN_EOF_simpleBackup__simpleBackup_f9eeae3296ba\n\
chmod +x \"$tmpdir/_simpleBackup\" 2>/dev/null || true\ncat >\"$tmpdir/simpleBackup.sh\"\
\ <<'JAN_EOF_simpleBackup_simpleBackup_sh_70e72d58a03a'\n#!/bin/bash\n\
# (c) 2022 Pat Beagan: MIT License\n\ntrackusage \"$0\"\n\nDATE=$(date\
\ +%Y-%m-%d-%H%M%S)\nBACKUP_DIR=\"$HOME\"\nSOURCE=\"$HOME/Downloads/MyHome\"\
\n\ntar -cvzpf $BACKUP_DIR/backup-$DATE.tar.gz $SOURCE\nJAN_EOF_simpleBackup_simpleBackup_sh_70e72d58a03a\n\
chmod +x \"$tmpdir/simpleBackup.sh\" 2>/dev/null || true\ncd \"$tmpdir\"\
\nexec \"$tmpdir/simpleBackup.sh\" \"$@\"\n"
passthrough: true
snippets:
about: A script for automated tasks.
path: ../scripts/source/snippets
commands:
help:
about: Describe this script.
exec:
argv:
- bash
- -lc
- 'cat <<''EOF''
snippets
A script for automated tasks.
EOF
'
run:
about: Run the script (inlined); forwards args.
exec:
argv:
- bash
- -lc
- "set -euo pipefail\ntmpdir=\"$(mktemp -d)\"\ntrap 'rm -rf \"$tmpdir\"\
' EXIT\ncat >\"$tmpdir/_snippets\" <<'JAN_EOF_snippets__snippets_a3c9b309d0d8'\n\
#compdef snippets\n\n# Zsh completion for snippets\n# Generated automatically\
\ - customize as needed\n\n_snippets() {\n local context state line\n\
\ typeset -A opt_args\n \n _arguments -C \\\n '(-h --help)'{-h,--help}'[Show\
\ help information]' \\\n '(-v --version)'{-v,--version}'[Show\
\ version information]' \\\n '*::arg:_files'\n}\n\n_snippets \"\
$@\"\nJAN_EOF_snippets__snippets_a3c9b309d0d8\nchmod +x \"$tmpdir/_snippets\"\
\ 2>/dev/null || true\ncat >\"$tmpdir/snippets.sh\" <<'JAN_EOF_snippets_snippets_sh_4e250b7fc1ba'\n\
#!/bin/zsh\nfunction main() {\n local filename=\"\"\n if [ -z \"$1\"\
\ ]; then \n\t filename=\"snippet.txt\"\n else\n\t filename=\"$1\"\n\
\ fi\n eval \"$(fzf < \"$filename\")\"\n}\nmain \"$@\"\nJAN_EOF_snippets_snippets_sh_4e250b7fc1ba\n\
chmod +x \"$tmpdir/snippets.sh\" 2>/dev/null || true\ncd \"$tmpdir\"\n\
exec \"$tmpdir/snippets.sh\" \"$@\"\n"
passthrough: true
speedtest:
about: A script for automated tasks.
path: ../scripts/source/speedtest
commands:
help:
about: Describe this script.
exec:
argv:
- bash
- -lc
- 'cat <<''EOF''
speedtest
A script for automated tasks.
EOF
'
run:
about: Run the script (inlined); forwards args.
exec:
argv:
- bash
- -lc
- "set -euo pipefail\ntmpdir=\"$(mktemp -d)\"\ntrap 'rm -rf \"$tmpdir\"\
' EXIT\ncat >\"$tmpdir/_speedtest\" <<'JAN_EOF_speedtest__speedtest_10b40a269894'\n\
#compdef speedtest\n\n# Zsh completion for speedtest\n# Generated automatically\
\ - customize as needed\n\n_speedtest() {\n local context state line\n\
\ typeset -A opt_args\n \n _arguments -C \\\n '(-h --help)'{-h,--help}'[Show\
\ help information]' \\\n '(-v --version)'{-v,--version}'[Show\
\ version information]' \\\n '*::arg:_files'\n}\n\n_speedtest \"\
$@\"\nJAN_EOF_speedtest__speedtest_10b40a269894\nchmod +x \"$tmpdir/_speedtest\"\
\ 2>/dev/null || true\ncat >\"$tmpdir/speedtest.sh\" <<'JAN_EOF_speedtest_speedtest_sh_c4699dc39669'\n\
#!/bin/bash \n# (c) 2022 Pat Beagan: MIT License\n\nspeedtest () \n{ \n\
\ dd if=/dev/zero of=/dev/null bs=1M count=32768\n}\n\nspeedtest \"\
$@\"\nJAN_EOF_speedtest_speedtest_sh_c4699dc39669\nchmod +x \"$tmpdir/speedtest.sh\"\
\ 2>/dev/null || true\ncd \"$tmpdir\"\nexec \"$tmpdir/speedtest.sh\" \"\
$@\"\n"
passthrough: true
starlog:
about: A script for automated tasks.
path: ../scripts/source/starlog
commands:
help:
about: Describe this script.
exec:
argv:
- bash
- -lc
- 'cat <<''EOF''
starlog
A script for automated tasks.
EOF
'
run:
about: Run the script (inlined); forwards args.
exec:
argv:
- bash
- -lc
- "set -euo pipefail\ntmpdir=\"$(mktemp -d)\"\ntrap 'rm -rf \"$tmpdir\"\
' EXIT\ncat >\"$tmpdir/_starlog\" <<'JAN_EOF_starlog__starlog_cd6ed937f559'\n\
#compdef starlog\n\n# Zsh completion for starlog\n# Generated automatically\
\ - customize as needed\n\n_starlog() {\n local context state line\n\
\ typeset -A opt_args\n \n _arguments -C \\\n '(-h --help)'{-h,--help}'[Show\
\ help information]' \\\n '(-v --version)'{-v,--version}'[Show\
\ version information]' \\\n '*::arg:_files'\n}\n\n_starlog \"\
$@\"\nJAN_EOF_starlog__starlog_cd6ed937f559\nchmod +x \"$tmpdir/_starlog\"\
\ 2>/dev/null || true\ncat >\"$tmpdir/starlog.py\" <<'JAN_EOF_starlog_starlog_py_feaaa93dc47c'\n\
#!/usr/bin/env python3\n# (c) 2022 Pat Beagan: MIT License\n\nimport datetime\n\
from pathlib import Path\n\nfilename = str(Path.home()) + \"/starlog.txt\"\
\n\n\ndef prepare_section(f_in):\n def inner(s):\n f_in.write(s\
\ + \"\\n\")\n\n return inner\n\n\ndef indent(s):\n return \"\\\
n \" + input(s)\n\n\nif __name__ == \"__main__\":\n with open(filename,\
\ \"a+\") as f:\n section = prepare_section(f)\n section(\"\
\".join([\"-\" for i in range(40)]))\n section(str(datetime.datetime.now()))\n\
\ section(\"Rating: \" + input(\"How how are you? [-4,4]: \"))\n\
\ section(\"Who: \" + indent(\"Who did you see today?\"))\n \
\ section(\n \"Media: \"\n + indent(\"What shows\
\ are you watching?\")\n + indent(\"What books are you reading?\"\
)\n + indent(\"What games are you playing?\")\n )\n\
\ section(\"Ideas: \" + input(\"Any ideas that you would like to\
\ work on?\"))\n section(input(\"Tell me more!\\n\"))\nJAN_EOF_starlog_starlog_py_feaaa93dc47c\n\
chmod +x \"$tmpdir/starlog.py\" 2>/dev/null || true\ncd \"$tmpdir\"\n\
exec \"$tmpdir/starlog.py\" \"$@\"\n"
passthrough: true
sum:
about: A script for automated tasks.
path: ../scripts/source/sum
commands:
help:
about: Describe this script.
exec:
argv:
- bash
- -lc
- 'cat <<''EOF''
sum
A script for automated tasks.
EOF
'
run:
about: Run the script (inlined); forwards args.
exec:
argv:
- bash
- -lc
- "set -euo pipefail\ntmpdir=\"$(mktemp -d)\"\ntrap 'rm -rf \"$tmpdir\"\
' EXIT\ncat >\"$tmpdir/_sum\" <<'JAN_EOF_sum__sum_9d625b9e4a31'\n#compdef\
\ sum\n\n# Zsh completion for sum\n# Generated automatically - customize\
\ as needed\n\n_sum() {\n local context state line\n typeset -A\
\ opt_args\n \n _arguments -C \\\n '(-h --help)'{-h,--help}'[Show\
\ help information]' \\\n '(-v --version)'{-v,--version}'[Show\
\ version information]' \\\n '*::arg:_files'\n}\n\n_sum \"$@\"\n\
JAN_EOF_sum__sum_9d625b9e4a31\nchmod +x \"$tmpdir/_sum\" 2>/dev/null ||\
\ true\ncat >\"$tmpdir/sum.sh\" <<'JAN_EOF_sum_sum_sh_788b842f8068'\n\
#!/bin/bash \n# (c) 2022 Pat Beagan: MIT License\n\nsum () \n{ \n echo\
\ \"$1\" | tr ',' '+' | bc\n}\n\nsum \"$@\"\ntrackusage \"$0\"\nJAN_EOF_sum_sum_sh_788b842f8068\n\
chmod +x \"$tmpdir/sum.sh\" 2>/dev/null || true\ncd \"$tmpdir\"\nexec\
\ \"$tmpdir/sum.sh\" \"$@\"\n"
passthrough: true
svn:
about: A script for automated tasks.
path: ../scripts/source/svn
commands:
help:
about: Describe this script.
exec:
argv:
- bash
- -lc
- 'cat <<''EOF''
svn
A script for automated tasks.
EOF
'
run:
about: Run the script (inlined); forwards args.
exec:
argv:
- bash
- -lc
- "set -euo pipefail\ntmpdir=\"$(mktemp -d)\"\ntrap 'rm -rf \"$tmpdir\"\
' EXIT\ncat >\"$tmpdir/_svn\" <<'JAN_EOF_svn__svn_1d04d66ec69c'\n#compdef\
\ svn\n\n# Zsh completion for svn\n# Generated automatically - customize\
\ as needed\n\n_svn() {\n local context state line\n typeset -A\
\ opt_args\n \n _arguments -C \\\n '(-h --help)'{-h,--help}'[Show\
\ help information]' \\\n '(-v --version)'{-v,--version}'[Show\
\ version information]' \\\n '*::arg:_files'\n}\n\n_svn \"$@\"\n\
JAN_EOF_svn__svn_1d04d66ec69c\nchmod +x \"$tmpdir/_svn\" 2>/dev/null ||\
\ true\ncat >\"$tmpdir/svn.sh\" <<'JAN_EOF_svn_svn_sh_54e0ec711266'\n\
#!/bin/bash \n# (c) 2022 Pat Beagan: MIT License\n\nsvn () \n{ \n if\
\ [[ \"$@\" == \"add all\" ]] || [[ \"$@\" == \"addall\" ]]; then\n \
\ command svn add $(svn st | grep ? | sed s\"/\\?//\");\n else\n\
\ if [[ \"$@\" == \"rm all\" ]] || [[ \"$@\" == \"rmall\" ]]; then\n\
\ command svn rm $(svn st | grep ! | sed s\"/\\!//\");\n \
\ else\n if [[ \"$@\" == \"log\" ]]; then\n \
\ command svn log | less;\n else\n command\
\ svn \"$@\";\n fi;\n fi;\n fi\n}\n\nsvn \"$@\"\n\
JAN_EOF_svn_svn_sh_54e0ec711266\nchmod +x \"$tmpdir/svn.sh\" 2>/dev/null\
\ || true\ncd \"$tmpdir\"\nexec \"$tmpdir/svn.sh\" \"$@\"\n"
passthrough: true
tcommit:
about: A script for automated tasks.
path: ../scripts/source/tcommit
commands:
help:
about: Describe this script.
exec:
argv:
- bash
- -lc
- 'cat <<''EOF''
tcommit
A script for automated tasks.
EOF
'
run:
about: Run the script (inlined); forwards args.
exec:
argv:
- bash
- -lc
- "set -euo pipefail\ntmpdir=\"$(mktemp -d)\"\ntrap 'rm -rf \"$tmpdir\"\
' EXIT\ncat >\"$tmpdir/_tcommit\" <<'JAN_EOF_tcommit__tcommit_917bfe3eaba9'\n\
#compdef tcommit\n\n# Zsh completion for tcommit\n# Generated automatically\
\ - customize as needed\n\n_tcommit() {\n local context state line\n\
\ typeset -A opt_args\n \n _arguments -C \\\n '(-h --help)'{-h,--help}'[Show\
\ help information]' \\\n '(-v --version)'{-v,--version}'[Show\
\ version information]' \\\n '*::arg:_files'\n}\n\n_tcommit \"\
$@\"\nJAN_EOF_tcommit__tcommit_917bfe3eaba9\nchmod +x \"$tmpdir/_tcommit\"\
\ 2>/dev/null || true\ncat >\"$tmpdir/tcommit.sh\" <<'JAN_EOF_tcommit_tcommit_sh_b06b88020af1'\n\
#!/bin/bash \n# (c) 2022 Pat Beagan: MIT License\n\ntcommit () \n{ \n\
\ echo \"t\" >> test.txt && git add --all && git commit -am \"test\"\
\n}\n\ntcommit \"$@\"\nJAN_EOF_tcommit_tcommit_sh_b06b88020af1\nchmod\
\ +x \"$tmpdir/tcommit.sh\" 2>/dev/null || true\ncd \"$tmpdir\"\nexec\
\ \"$tmpdir/tcommit.sh\" \"$@\"\n"
passthrough: true
test-libbeagan:
about: A script for automated tasks.
path: ../scripts/source/test-libbeagan
commands:
help:
about: Describe this script.
exec:
argv:
- bash
- -lc
- 'cat <<''EOF''
test-libbeagan
A script for automated tasks.
EOF
'
run:
about: Run the script (inlined); forwards args.
exec:
argv:
- bash
- -lc
- "set -euo pipefail\ntmpdir=\"$(mktemp -d)\"\ntrap 'rm -rf \"$tmpdir\"\
' EXIT\ncat >\"$tmpdir/_test-libbeagan\" <<'JAN_EOF_test_libbeagan__test_libbeagan_3c15ca3a2205'\n\
#compdef test-libbeagan\n\n# Zsh completion for test-libbeagan\n# Generated\
\ automatically - customize as needed\n\n_test-libbeagan() {\n local\
\ context state line\n typeset -A opt_args\n \n _arguments -C\
\ \\\n '(-h --help)'{-h,--help}'[Show help information]' \\\n \
\ '(-v --version)'{-v,--version}'[Show version information]' \\\n\
\ '*::arg:_files'\n}\n\n_test-libbeagan \"$@\"\nJAN_EOF_test_libbeagan__test_libbeagan_3c15ca3a2205\n\
chmod +x \"$tmpdir/_test-libbeagan\" 2>/dev/null || true\ncat >\"$tmpdir/test-libbeagan.sh\"\
\ <<'JAN_EOF_test_libbeagan_test_libbeagan_sh_9f84d1dadbf0'\n#!/usr/bin/env\
\ bash\n# (c) 2022 Pat Beagan: MIT License\n\nset -euo pipefail\n\nscriptname=\"\
$(basename \"$0\")\"\n\n# Test configuration\nTEST_TEMP_DIR=\"/tmp/libbeagan-test-$$\"\
\nTEST_RESULTS_FILE=\"$TEST_TEMP_DIR/results.txt\"\n\nhelp() {\n cat\
\ << EOF\nUsage: $scriptname [options]\n\nTest libbeagan installation\
\ and scripts.\n\nOptions:\n -h, --help Show this help message\n\
\ -v, --verbose Verbose output\n --quick Run only\
\ essential tests\n --full Run all tests including slow\
\ ones\n --fix Attempt to fix common issues\n\nExamples:\n\
\ $scriptname --quick\n $scriptname --full --verbose\nEOF\n}\n\n# Test\
\ utilities\ntest_log() {\n local level=\"$1\"\n shift\n echo\
\ \"[$level] $*\" | tee -a \"$TEST_RESULTS_FILE\"\n}\n\ntest_pass() {\n\
\ test_log \"PASS\" \"$1\"\n}\n\ntest_fail() {\n test_log \"FAIL\"\
\ \"$1\"\n return 1\n}\n\ntest_skip() {\n test_log \"SKIP\" \"$1\"\
\n}\n\n# Test functions\ntest_environment() {\n echo \"Testing environment\
\ setup...\"\n \n if [[ -n \"${LIBBEAGAN_HOME:-}\" ]]; then\n \
\ test_pass \"LIBBEAGAN_HOME is set: $LIBBEAGAN_HOME\"\n else\n\
\ test_fail \"LIBBEAGAN_HOME is not set\"\n fi\n \n if\
\ [[ -d \"${LIBBEAGAN_HOME:-}\" ]]; then\n test_pass \"LIBBEAGAN_HOME\
\ directory exists\"\n else\n test_fail \"LIBBEAGAN_HOME directory\
\ does not exist\"\n fi\n}\n\ntest_script_permissions() {\n echo\
\ \"Testing script permissions...\"\n \n local script_dirs=(\n \
\ \"scripts/android\"\n \"scripts/dev\"\n \"scripts/documentation\"\
\n \"scripts/file_management\"\n \"scripts/image_manipulation\"\
\n \"scripts/math\"\n \"scripts/sysadmin\"\n \"scripts/util\"\
\n \"scripts/vcs\"\n )\n \n for dir in \"${script_dirs[@]}\"\
; do\n if [[ -d \"$LIBBEAGAN_HOME/$dir\" ]]; then\n \
\ local executable_count=0\n local total_count=0\n \
\ \n while IFS= read -r -d '' file; do\n \
\ total_count=$((total_count + 1))\n if [[ -x \"$file\"\
\ ]]; then\n executable_count=$((executable_count +\
\ 1))\n else\n test_log \"WARN\" \"\
Script not executable: $file\"\n fi\n done <\
\ <(find \"$LIBBEAGAN_HOME/$dir\" -type f -executable -print0 2>/dev/null\
\ || true)\n \n if [[ $total_count -gt 0 ]]; then\n\
\ test_pass \"Directory $dir: $executable_count/$total_count\
\ scripts executable\"\n else\n test_skip \"\
Directory $dir: no scripts found\"\n fi\n else\n \
\ test_skip \"Directory $dir: not found\"\n fi\n done\n\
}\n\ntest_essential_scripts() {\n echo \"Testing essential scripts...\"\
\n \n local essential_scripts=(\n \"scripts/util/isMac\"\n\
\ \"scripts/util/isLinux\"\n \"scripts/util/machinetype\"\
\n \"scripts/sysadmin/trackusage\"\n \"scripts/file_management/basename\"\
\n )\n \n for script in \"${essential_scripts[@]}\"; do\n \
\ if [[ -f \"$LIBBEAGAN_HOME/$script\" ]]; then\n if [[\
\ -x \"$LIBBEAGAN_HOME/$script\" ]]; then\n # Test basic\
\ execution\n if timeout 5s \"$LIBBEAGAN_HOME/$script\"\
\ >/dev/null 2>&1; then\n test_pass \"Script $script\
\ executes successfully\"\n else\n test_fail\
\ \"Script $script fails to execute\"\n fi\n \
\ else\n test_fail \"Script $script is not executable\"\
\n fi\n else\n test_fail \"Script $script\
\ not found\"\n fi\n done\n}\n\ntest_dependencies() {\n echo\
\ \"Testing dependencies...\"\n \n # Test if libbeagan_dependencies\
\ function exists\n if command -v libbeagan_dependencies >/dev/null\
\ 2>&1; then\n test_pass \"libbeagan_dependencies function available\"\
\n \n # Run dependency check\n if libbeagan_dependencies\
\ >/dev/null 2>&1; then\n test_pass \"Dependency check completed\"\
\n else\n test_fail \"Dependency check failed\"\n \
\ fi\n else\n test_fail \"libbeagan_dependencies function\
\ not available\"\n fi\n}\n\ntest_aliases() {\n echo \"Testing aliases...\"\
\n \n # Test if alias file can be sourced\n if [[ -f \"$LIBBEAGAN_HOME/alias\"\
\ ]]; then\n if source \"$LIBBEAGAN_HOME/alias\" >/dev/null 2>&1;\
\ then\n test_pass \"Main alias file can be sourced\"\n \
\ else\n test_fail \"Main alias file fails to source\"\n\
\ fi\n else\n test_fail \"Main alias file not found\"\
\n fi\n}\n\ntest_config_files() {\n echo \"Testing configuration\
\ files...\"\n \n local config_files=(\n \"configs/config-zsh.zsh\"\
\n \"configs/config-omzsh.zsh\"\n \"configs/config-golang.zsh\"\
\n \"configs/config-android.zsh\"\n )\n \n for config\
\ in \"${config_files[@]}\"; do\n if [[ -f \"$LIBBEAGAN_HOME/$config\"\
\ ]]; then\n if source \"$LIBBEAGAN_HOME/$config\" >/dev/null\
\ 2>&1; then\n test_pass \"Config file $config can be sourced\"\
\n else\n test_fail \"Config file $config fails\
\ to source\"\n fi\n else\n test_skip \"\
Config file $config not found\"\n fi\n done\n}\n\ntest_path_setup()\
\ {\n echo \"Testing PATH setup...\"\n \n local script_dirs=(\n\
\ \"android\"\n \"dev\"\n \"documentation\"\n \
\ \"file_management\"\n \"image_manipulation\"\n \"\
math\"\n \"sysadmin\"\n \"util\"\n \"vcs\"\n )\n\
\ \n for dir in \"${script_dirs[@]}\"; do\n local script_path=\"\
$LIBBEAGAN_HOME/scripts/$dir\"\n if [[ -d \"$script_path\" ]];\
\ then\n if [[ \":$PATH:\" == *\":$script_path:\"* ]]; then\n\
\ test_pass \"Script directory $dir is in PATH\"\n \
\ else\n test_fail \"Script directory $dir is not\
\ in PATH\"\n fi\n else\n test_skip \"Script\
\ directory $dir not found\"\n fi\n done\n}\n\nrun_quick_tests()\
\ {\n echo \"Running quick tests...\"\n test_environment\n test_essential_scripts\n\
\ test_dependencies\n test_aliases\n}\n\nrun_full_tests() {\n \
\ echo \"Running full test suite...\"\n run_quick_tests\n test_script_permissions\n\
\ test_config_files\n test_path_setup\n}\n\nshow_results() {\n \
\ echo\n echo \"=== Test Results ===\"\n if [[ -f \"$TEST_RESULTS_FILE\"\
\ ]]; then\n local pass_count=$(grep -c \"PASS\" \"$TEST_RESULTS_FILE\"\
\ || echo \"0\")\n local fail_count=$(grep -c \"FAIL\" \"$TEST_RESULTS_FILE\"\
\ || echo \"0\")\n local skip_count=$(grep -c \"SKIP\" \"$TEST_RESULTS_FILE\"\
\ || echo \"0\")\n \n echo \"Passed: $pass_count\"\n \
\ echo \"Failed: $fail_count\"\n echo \"Skipped: $skip_count\"\
\n \n if [[ $fail_count -gt 0 ]]; then\n echo\n\
\ echo \"Failed tests:\"\n grep \"FAIL\" \"$TEST_RESULTS_FILE\"\
\n fi\n \n if [[ $fail_count -eq 0 ]]; then\n \
\ echo \"✅ All tests passed!\"\n else\n echo\
\ \"❌ Some tests failed. Check the output above.\"\n fi\n else\n\
\ echo \"No test results found.\"\n fi\n}\n\ncleanup() {\n \
\ rm -rf \"$TEST_TEMP_DIR\"\n}\n\nmain() {\n # Parse arguments\n\
\ local verbose=false\n local quick=false\n local full=false\n\
\ \n while [[ $# -gt 0 ]]; do\n case $1 in\n -h|--help)\n\
\ help\n exit 0\n ;;\n \
\ -v|--verbose)\n verbose=true\n \
\ shift\n ;;\n --quick)\n quick=true\n\
\ shift\n ;;\n --full)\n \
\ full=true\n shift\n ;;\n \
\ *)\n echo \"Unknown option: $1\"\n \
\ help\n exit 1\n ;;\n esac\n\
\ done\n \n # Setup\n mkdir -p \"$TEST_TEMP_DIR\"\n trap\
\ cleanup EXIT\n \n echo \"Starting libbeagan tests...\"\n echo\
\ \"Results will be saved to: $TEST_RESULTS_FILE\"\n \n # Run tests\n\
\ if [[ \"$full\" == true ]]; then\n run_full_tests\n else\n\
\ run_quick_tests\n fi\n \n # Show results\n show_results\n\
\ \n # Exit with appropriate code\n if grep -q \"FAIL\" \"$TEST_RESULTS_FILE\"\
\ 2>/dev/null; then\n exit 1\n else\n exit 0\n fi\n\
}\n\nmain \"$@\" \nJAN_EOF_test_libbeagan_test_libbeagan_sh_9f84d1dadbf0\n\
chmod +x \"$tmpdir/test-libbeagan.sh\" 2>/dev/null || true\ncd \"$tmpdir\"\
\nexec \"$tmpdir/test-libbeagan.sh\" \"$@\"\n"
passthrough: true
tp:
about: A script for automated tasks.
path: ../scripts/source/tp
commands:
help:
about: Describe this script.
exec:
argv:
- bash
- -lc
- 'cat <<''EOF''
tp
A script for automated tasks.
EOF
'
run:
about: Run the script (inlined); forwards args.
exec:
argv:
- bash
- -lc
- "set -euo pipefail\ntmpdir=\"$(mktemp -d)\"\ntrap 'rm -rf \"$tmpdir\"\
' EXIT\ncat >\"$tmpdir/_tp\" <<'JAN_EOF_tp__tp_40c715995900'\n#compdef\
\ tp\n\n# Zsh completion for tp\n# Generated automatically - customize\
\ as needed\n\n_tp() {\n local context state line\n typeset -A opt_args\n\
\ \n _arguments -C \\\n '(-h --help)'{-h,--help}'[Show help\
\ information]' \\\n '(-v --version)'{-v,--version}'[Show version\
\ information]' \\\n '*::arg:_files'\n}\n\n_tp \"$@\"\nJAN_EOF_tp__tp_40c715995900\n\
chmod +x \"$tmpdir/_tp\" 2>/dev/null || true\ncat >\"$tmpdir/tp.sh\" <<'JAN_EOF_tp_tp_sh_6a186197cc0f'\n\
#!/bin/bash \n# (c) 2022 Pat Beagan: MIT License\n\ntp () \n{ \n PS1='\\\
[\\e]0;\\w\\a\\]\\n\\[\\e[00;33m\\][\\d \\A \\[\\e[01;35m\\]\\w\\[\\e[00;33m\\\
]]\\[\\e[0m\\]$(__git_ps1 \" \\[\\033[1;32m\\](%s)\\[\\033[0m\\]\") $(__awsenv_ps1)\\\
n\\$ '\n}\n\ntp \"$@\"\ntrackusage \"$0\"\nJAN_EOF_tp_tp_sh_6a186197cc0f\n\
chmod +x \"$tmpdir/tp.sh\" 2>/dev/null || true\ncd \"$tmpdir\"\nexec \"\
$tmpdir/tp.sh\" \"$@\"\n"
passthrough: true
trim:
about: A script for automated tasks.
path: ../scripts/source/trim
commands:
help:
about: Describe this script.
exec:
argv:
- bash
- -lc
- 'cat <<''EOF''
trim
A script for automated tasks.
EOF
'
run:
about: Run the script (inlined); forwards args.
exec:
argv:
- bash
- -lc
- "set -euo pipefail\ntmpdir=\"$(mktemp -d)\"\ntrap 'rm -rf \"$tmpdir\"\
' EXIT\ncat >\"$tmpdir/_trim\" <<'JAN_EOF_trim__trim_73a7ce336efc'\n#compdef\
\ trim\n\n# Zsh completion for trim\n# Generated automatically - customize\
\ as needed\n\n_trim() {\n local context state line\n typeset -A\
\ opt_args\n \n _arguments -C \\\n '(-h --help)'{-h,--help}'[Show\
\ help information]' \\\n '(-v --version)'{-v,--version}'[Show\
\ version information]' \\\n '*::arg:_files'\n}\n\n_trim \"$@\"\
\nJAN_EOF_trim__trim_73a7ce336efc\nchmod +x \"$tmpdir/_trim\" 2>/dev/null\
\ || true\ncat >\"$tmpdir/trim.sh\" <<'JAN_EOF_trim_trim_sh_488b8508dd52'\n\
#!/bin/bash \n# (c) 2022 Pat Beagan: MIT License\n\ntrim () \n{ \n \
\ sed 's/^[ \t]*//;s/[ \t]*$//'\n}\n\ntrim \"$@\"\ntrackusage \"$0\"\n\
JAN_EOF_trim_trim_sh_488b8508dd52\nchmod +x \"$tmpdir/trim.sh\" 2>/dev/null\
\ || true\ncd \"$tmpdir\"\nexec \"$tmpdir/trim.sh\" \"$@\"\n"
passthrough: true
variance:
about: A script for automated tasks.
path: ../scripts/source/variance
commands:
help:
about: Describe this script.
exec:
argv:
- bash
- -lc
- 'cat <<''EOF''
variance
A script for automated tasks.
EOF
'
run:
about: Run the script (inlined); forwards args.
exec:
argv:
- bash
- -lc
- "set -euo pipefail\ntmpdir=\"$(mktemp -d)\"\ntrap 'rm -rf \"$tmpdir\"\
' EXIT\ncat >\"$tmpdir/_variance\" <<'JAN_EOF_variance__variance_57651ad54973'\n\
#compdef variance\n\n# Zsh completion for variance\n# Generated automatically\
\ - customize as needed\n\n_variance() {\n local context state line\n\
\ typeset -A opt_args\n \n _arguments -C \\\n '(-h --help)'{-h,--help}'[Show\
\ help information]' \\\n '(-v --version)'{-v,--version}'[Show\
\ version information]' \\\n '*::arg:_files'\n}\n\n_variance \"\
$@\"\nJAN_EOF_variance__variance_57651ad54973\nchmod +x \"$tmpdir/_variance\"\
\ 2>/dev/null || true\ncat >\"$tmpdir/variance.sh\" <<'JAN_EOF_variance_variance_sh_3c051ea37b0c'\n\
#!/bin/bash \n# (c) 2022 Pat Beagan: MIT License\n\nvariance () \n{ \n\
\ math $(sum $(echo $(for i in $(echo \"$1\" | tr ',' ' '); do math\
\ $(math $i-$(mean \"$1\"))^2; done) | tr ' ' ',')) / $(count_list \"\
$1\")\n}\n\nvariance \"$@\"\ntrackusage \"$0\"\nJAN_EOF_variance_variance_sh_3c051ea37b0c\n\
chmod +x \"$tmpdir/variance.sh\" 2>/dev/null || true\ncd \"$tmpdir\"\n\
exec \"$tmpdir/variance.sh\" \"$@\"\n"
passthrough: true
wiki:
about: A script for automated tasks.
path: ../scripts/source/wiki
commands:
help:
about: Describe this script.
exec:
argv:
- bash
- -lc
- 'cat <<''EOF''
wiki
A script for automated tasks.
EOF
'
run:
about: Run the script (inlined); forwards args.
exec:
argv:
- bash
- -lc
- "set -euo pipefail\ntmpdir=\"$(mktemp -d)\"\ntrap 'rm -rf \"$tmpdir\"\
' EXIT\ncat >\"$tmpdir/_wiki\" <<'JAN_EOF_wiki__wiki_00ef9fad2742'\n#compdef\
\ wiki\n\n# Zsh completion for wiki\n# Generated automatically - customize\
\ as needed\n\n_wiki() {\n local context state line\n typeset -A\
\ opt_args\n \n _arguments -C \\\n '(-h --help)'{-h,--help}'[Show\
\ help information]' \\\n '(-v --version)'{-v,--version}'[Show\
\ version information]' \\\n '*::arg:_files'\n}\n\n_wiki \"$@\"\
\nJAN_EOF_wiki__wiki_00ef9fad2742\nchmod +x \"$tmpdir/_wiki\" 2>/dev/null\
\ || true\ncat >\"$tmpdir/wiki.js\" <<'JAN_EOF_wiki_wiki_js_40316d717cf1'\n\
#!/usr/bin/env deno run --allow-net\n\nlet url = 'https://en.wikipedia.org/w/api.php'\n\
\nconst params = {\n action: 'query',\n format: 'json',\n titles: Deno.args.join(\"\
\ \"),\n prop: 'info',\n inprop: 'url|talkid'\n}\n\nurl = url + '?origin=*'\n\
\nObject\n .keys(params)\n .forEach((key) => {\n url += '&' + key\
\ + '=' + params[key]\n })\n\nconst getPageUrlByCurrId = (curid) => {\n\
\ return `http://en.wikipedia.org/?curid=${curid}`\n}\n\nfetch(url)\n\
\ .then((response) => response.json())\n .then((response) => {\n \
\ const pages = Object.values(\n response.query.pages\n )\n \
\ pages.forEach((it) => {\n console.log(`${getPageUrlByCurrId(it.pageid)}`)\n\
\ })\n })\n .catch((error) => console.log(error))\n\n/*\n Sample\
\ response:\n{\n pageid: 736,\n ns: 0,\n title: \"Albert Einstein\"\
,\n contentmodel: \"wikitext\",\n pagelanguage: \"en\",\n pagelanguagehtmlcode:\
\ \"en\",\n pagelanguagedir: \"ltr\",\n touched: \"2022-07-20T02:49:02Z\"\
,\n lastrevid: 1097822042,\n length: 208683,\n talkid: 21091085,\n\
\ fullurl: \"https://en.wikipedia.org/wiki/Albert_Einstein\",\n editurl:\
\ \"https://en.wikipedia.org/w/index.php?title=Albert_Einstein&action=edit\"\
,\n canonicalurl: \"https://en.wikipedia.org/wiki/Albert_Einstein\"\n\
}\n */\nJAN_EOF_wiki_wiki_js_40316d717cf1\nchmod +x \"$tmpdir/wiki.js\"\
\ 2>/dev/null || true\ncd \"$tmpdir\"\nexec \"$tmpdir/wiki.js\" \"$@\"\
\n"
passthrough: true
zettelkasten:
about: A script for automated tasks.
path: ../scripts/source/zettelkasten
commands:
help:
about: Describe this script.
exec:
argv:
- bash
- -lc
- 'cat <<''EOF''
zettelkasten
A script for automated tasks.
EOF
'
run:
about: Run the script (inlined); forwards args.
exec:
argv:
- bash
- -lc
- "set -euo pipefail\ntmpdir=\"$(mktemp -d)\"\ntrap 'rm -rf \"$tmpdir\"\
' EXIT\ncat >\"$tmpdir/_zettelkasten\" <<'JAN_EOF_zettelkasten__zettelkasten_510ff44aee04'\n\
#compdef zettelkasten\n\n# Zsh completion for zettelkasten\n# Generated\
\ automatically - customize as needed\n\n_zettelkasten() {\n local\
\ context state line\n typeset -A opt_args\n \n _arguments -C\
\ \\\n '(-h --help)'{-h,--help}'[Show help information]' \\\n \
\ '(-v --version)'{-v,--version}'[Show version information]' \\\n\
\ '*::arg:_files'\n}\n\n_zettelkasten \"$@\"\nJAN_EOF_zettelkasten__zettelkasten_510ff44aee04\n\
chmod +x \"$tmpdir/_zettelkasten\" 2>/dev/null || true\ncat >\"$tmpdir/zettelkasten.py\"\
\ <<'JAN_EOF_zettelkasten_zettelkasten_py_8bb2c3d4262d'\n#!/usr/bin/env\
\ python3\n# (c) 2022 Pat Beagan: MIT License\n\nimport datetime\nimport\
\ os\nfrom pathlib import Path\nimport sys\n\ncurrent_time = datetime.datetime.utcnow()\n\
dateformat = \"%Y-%m-%d--%H-%M-%S\"\nfolder = f\"{str(Path.home())}/_zettelkasten/\"\
\nfilename = f\"{current_time.strftime(dateformat)}.md\"\n\n\ndef main():\n\
\ if not os.path.isdir(folder):\n os.mkdir(folder)\n with\
\ open(folder + filename, \"a+\") as f:\n line = prepare_section(f)\n\
\ line(\"\".join([\"-\" for i in range(40)]))\n line(f\"\
written: {current_time.strftime(dateformat)}\")\n line(\"\".join([\"\
-\" for i in range(40)]))\n line(\"\")\n if len(sys.argv)\
\ >= 2:\n title = \" \".join(sys.argv[1:])\n line(f\"\
# {title}\\n\")\n else:\n line(f\"# {input('Title: ')}\\\
n\")\n\n line(f\"### Content: \\n{indent('Content: ')}\\n\")\n\
\ line(f\"### References: \\n{indent('References: ')}\")\n\n\n\
def prepare_section(f_in):\n def inner(s):\n f_in.write(f\"\
{s}\\n\")\n\n return inner\n\n\ndef indent(s):\n return \"\\n -\
\ \" + input(s)\n\n\nif __name__ == \"__main__\":\n main()\nJAN_EOF_zettelkasten_zettelkasten_py_8bb2c3d4262d\n\
chmod +x \"$tmpdir/zettelkasten.py\" 2>/dev/null || true\ncd \"$tmpdir\"\
\nexec \"$tmpdir/zettelkasten.py\" \"$@\"\n"
passthrough: true