{"id":22316909,"url":"https://github.com/somecho/utility-scripts","last_synced_at":"2025-08-09T20:20:38.312Z","repository":{"id":161750457,"uuid":"636401261","full_name":"somecho/utility-scripts","owner":"somecho","description":"A collection of helper scripts for Clojure, Java, Ledger and Taskwarrior. Written in Clojure.","archived":false,"fork":false,"pushed_at":"2023-06-02T13:13:15.000Z","size":57,"stargazers_count":13,"open_issues_count":8,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-05T01:04:03.497Z","etag":null,"topics":["babashka","clojure","deps-edn","java","ledger-cli","ripgrep","taskwarrior"],"latest_commit_sha":null,"homepage":"","language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/somecho.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-05-04T19:09:45.000Z","updated_at":"2023-09-02T04:07:59.000Z","dependencies_parsed_at":null,"dependency_job_id":"89f4b0f9-a5ac-4754-a91e-4f641886b094","html_url":"https://github.com/somecho/utility-scripts","commit_stats":null,"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"purl":"pkg:github/somecho/utility-scripts","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/somecho%2Futility-scripts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/somecho%2Futility-scripts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/somecho%2Futility-scripts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/somecho%2Futility-scripts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/somecho","download_url":"https://codeload.github.com/somecho/utility-scripts/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/somecho%2Futility-scripts/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267686336,"owners_count":24127715,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-29T02:00:12.549Z","response_time":2574,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["babashka","clojure","deps-edn","java","ledger-cli","ripgrep","taskwarrior"],"created_at":"2024-12-03T23:08:14.317Z","updated_at":"2025-07-29T12:30:39.356Z","avatar_url":"https://github.com/somecho.png","language":"Clojure","readme":"# Somē's utility scripts\n\nHere are some utility scripts I wrote for myself. At first I wrote the scripts in a shell scripting language. But then I discovered [Babashka](https://github.com/babashka/babashka) and I love Clojure. I decided to port all the scripts to Clojure instead. You will need [Babashka](https://github.com/babashka/babashka) to run these scripts. These are helper tools for [Clj](https://clojure.org/guides/deps_and_cli), Java, [Ledger](https://github.com/ledger/ledger) and [Taskwarrior](https://github.com/GothenburgBitFactory/taskwarrior).\n\n### [Scripts](#scripts) included:\n1. [accountsof](#accountsof) - outputs the name of all accounts used in a [Ledger](https://github.com/ledger/ledger) journal file\n2. [cljminimal](#cljminimal) - creates an ultra barebones deps.edn [clj](https://clojure.org/guides/deps_and_cli) project for quick hacking\n3. [depo](#depo) - adds dependencies to Clojure projects. Supports `deps.edn`,`project.clj`,`shadow-cljs.edn`.\n4. [jrun](#jrun) - single file Java runner \n5. [keepbooks](#keepbooks) - simple transaction entry helper for [Ledger](https://github.com/ledger/ledger) CLI accounting. Supports interactive entry.\n6. [on-modify-log](#on-modify-log) - a [Taskwarrior](https://github.com/GothenburgBitFactory/taskwarrior) hook to log the latest modified task\n7. [projectsof](#projectsof) - finds directories of certain project types\n8. [resumetask](#resumetask) - resumes latest modified [Taskwarrior](https://github.com/GothenburgBitFactory/taskwarrior) task\n9. [startnewtask](#startnewtask) - creates and starts a new [Taskwarrior](https://github.com/GothenburgBitFactory/taskwarrior) task\n10. [stoptasks](#stoptasks) - stops all active [Taskwarrior](https://github.com/GothenburgBitFactory/taskwarrior) tasks\n11. [taskinfo](#taskinfo) - prints the attribute of a [Taskwarrior](https://github.com/GothenburgBitFactory/taskwarrior) task\n \n## Installation\nYou need to first [install Babashka](https://github.com/babashka/babashka#quickstart). \n ```sh\n git clone https://github.com/somecho/utility-scripts\n cd utility-scripts\n ./install.clj \n ```\n This will copy all the scripts into `~/.local/bin`. Make sure `~/.local/bin` is in your path to call the scripts globally.\n \n### Uninstalling\n To uninstall, simply call `uninstall-some-scripts` and all the scripts will be deleted from `~/.local/bin`.\n \n## [accountsof](./accountsof.clj)\nOutputs the names of all the accounts used in a [Ledger](https://github.com/ledger/ledger) journal file. Example: `accountsof LEDGERFILE`.\n\n## [cljminimal](./cljminimal.clj)\nA script to create an ultraminimal clj project with an empty deps.edn and a singular hello world main function. To use, simply call `cljminimal my-minimal-clj-project` and a project called `my-minimal-clj-project` will be created for you. Mainly used for quick hacking and throwaway prototyping.\n\n## [depo](./depo.clj)\nAdds dependencies to Clojure projects. To use, run the script at the root of a project containing a `deps.edn`, `project.clj` or `shadow-cljs.edn` file. If multiple config files are present, the first config file in the order of `deps`,`project`,`shadow-cljs` will be selected. \n### Usage\n```sh\ndepo add reagent\n# Added [reagent \"1.2.0\"]\n```\nIf multiple config files are present, you can use `-f` to specify which file to add a dependency to.\n```sh\ndepo add reagent -f deps.edn\n# Added {reagent/reagent {:mvn/version 1.2.0}}\n```\nYou can also specify a version.\n```sh\ndepo add reagent 1.1.0\n# Added [reagent \"1.1.0\"]\n```\nDepo can currently only search for dependencies from Clojars. For a more powerful alternative, checkout [neil](https://github.com/babashka/neil).\n\n## [jrun](./jrun.clj)\nCompiles and runs a single java file. Mainly used for quick iteration of ideas. For example, you can run it in Vim with `:!jrun App.java` and see the output in a Vim buffer without leaving your current buffer.\n### Usage\n```sh\njrun JAVAFILE\n```\nThe `JAVAFILE` argument is glob-searched, so you can use `App.java` or `App` and it will still run.\n\n## [keepbooks](./keepbooks.clj)\nA helper script to enter a simple transaction into a [Ledger](https://github.com/ledger/ledger) file. \n\n### Single entry mode\nThe script has the following format in single entry mode:\n```sh\nkeepbooks -f LEDGERFILE -d DATE PAYEE? ACCOUNT_TO_DEBIT ACCOUNT_TO_CREDIT AMOUNT CURRENCY\n```\nThe `-d DATE` field is optional. If this flag is ommitted, the current date will be used. The `PAYEE` field is also optional. If the `PAYEE` is ommitted, no payee will be entered in the transaction. The other fields `ACCOUNT_TO_DEBIT`, `ACCOUNT_TO_CREDIT`, `AMOUNT` and `CURRENCY` are required fields. The ordering is strict. Upon entering a successful command, the ledger entry will be written into the ledger file provided and also printed out in the commandline.\n```sh\nkeepbooks -f 2023.ledger -d 2023/07/20 Sushi Bar Expenses:Restaurant Assets:Bank 30.00 EUR\n# prints out:\n# 2023/07/20 Sushi Bar\n#   Expenses:Restaurant                       30.00 EUR\n#   Assets:Bank\n```\n\n### Interactive mode\n`keepbooks` also supports interactive entry. Simply call `keepbooks -f LEDGERFILE` without any arguments and you will be prompted to enter your transaction.\n\n## [on-modify-log](./on-modify-log.clj)\nA [Taskwarrior](https://github.com/GothenburgBitFactory/taskwarrior) hook to log latest modified task. This script is _not_ installed in `~/.local/bin`. Instead, it requires you to copy it to your Taskwarrior's hooks folder. This is usually `~/.task/hooks`. Every time a task is modified, it writed the UUID of the task in a file called `last-modified.data` in your Taskwarrior's `data.location`. **This hook is required for the [resumetask](#resumetask) script to work.**\n\n## [projectsof](./projectsof.clj)\nSearches the current working directory for project directories of a certain type. For example, calling `projectsof java` will return all the directories which are java projects. **Requires [`rg`](https://github.com/BurntSushi/ripgrep) to run.**\n\n### Flags\n- `-n` - displays numbered rows\n- `-i NUMBER` - outputs directory with line number `-i`\n\n### Currently supported project types\n1. Clojure/Clj\n2. Java\n\n## [resumetask](./resumetask.clj)\nEver wanted to just restart the [Taskwarrior](https://github.com/GothenburgBitFactory/taskwarrior) task you stopped right before a break? With this script, you can just pick up where you left off by calling `resumetask`. No more trying to figure what ID your task has! **This script requires the [on-modify-log](#on-modify-log) hook to work and the [taskinfo](#taskinfo) script to work.**\n\n### Why use hooks?\nSome people suggest having a shell alias that starts a task and exports it as an environment variable. But since I use [Syncthing](https://github.com/syncthing/syncthing) to sync my tasks across devices, this will not work if I stopped a task on one device and want to resume it on another. By saving the last modified task's UUID in Taskwarrior's `data.location`, I can have the UUID synced as well.\n\n## [startnewtask](./startnewtask.clj)\nCreates and immediately starts a [Taskwarrior](https://github.com/GothenburgBitFactory/taskwarrior) task. Use this as you would `task add`.\n```sh\ntask add +admin +bookkeeping track finance # adds a task to Taskwarrior\nstartnewtask +admin +bookkeeping track finance # adds and starts task\n```\n## [stoptasks](./stoptasks.clj)\nStops all active [Taskwarrior](https://github.com/GothenburgBitFactory/taskwarrior) tasks. Every tried `task stop` and gotten an error? Yeah, me too. Now you can stop all active tasks with a single `stoptasks`.\n## [taskinfo](./taskinfo.clj)\nPrints the attribute of a [Taskwarrior](https://github.com/GothenburgBitFactory/taskwarrior) task. Commands follow this format:\n```sh\ntaskinfo TASKID TASKATTRIBUTE\n# example: taskinfo 40 description\n```\nThe [resumetask](#resumetask) script depends on this script.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsomecho%2Futility-scripts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsomecho%2Futility-scripts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsomecho%2Futility-scripts/lists"}