{"id":17748539,"url":"https://github.com/purarue/pura-utils","last_synced_at":"2025-03-18T16:30:25.167Z","repository":{"id":64141286,"uuid":"573285404","full_name":"purarue/pura-utils","owner":"purarue","description":"useful scripts extracted from my dotfiles","archived":false,"fork":false,"pushed_at":"2025-02-25T23:03:10.000Z","size":151,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-16T21:48:23.532Z","etag":null,"topics":["bash","cli","command-line","installer","makefile","perl","python","shell"],"latest_commit_sha":null,"homepage":"https://purarue.xyz/c/?dark","language":"Shell","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/purarue.png","metadata":{"files":{"readme":"README.md","changelog":null,"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}},"created_at":"2022-12-02T05:11:37.000Z","updated_at":"2025-02-25T23:03:14.000Z","dependencies_parsed_at":"2024-11-17T09:21:58.818Z","dependency_job_id":"c9a7bec3-a0dd-42a0-b92d-c03d16c921fc","html_url":"https://github.com/purarue/pura-utils","commit_stats":null,"previous_names":["seanbreckenridge/seanb-utils","purarue/pura-utils"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/purarue%2Fpura-utils","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/purarue%2Fpura-utils/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/purarue%2Fpura-utils/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/purarue%2Fpura-utils/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/purarue","download_url":"https://codeload.github.com/purarue/pura-utils/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244259783,"owners_count":20424615,"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","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":["bash","cli","command-line","installer","makefile","perl","python","shell"],"created_at":"2024-10-26T10:02:14.007Z","updated_at":"2025-03-18T16:30:24.887Z","avatar_url":"https://github.com/purarue.png","language":"Shell","funding_links":[],"categories":["Shell"],"sub_categories":[],"readme":"Scripts extracted from my [dotfiles](https://github.com/purarue/dotfiles), see [index](#script-index)\n\nThis includes:\n\n- Pure utility/wrangling scripts like [`lower`](./shellscripts/lower), [`upper`](./shellscripts/upper), [`chomp`](./shellscripts/chomp), [`rcut`](./shellscripts/rcut), [`tally`](./shellscripts/tally), [`unique`](./shellscripts/unique), [`average`](./shellscripts/average); which help process outputs of other commands, which are commonly used by other shellscripts I put up on other repositories -- hence the reason to make this repo so they're easily installable\n- Some helper/conversion scripts like [`to-png`](./shellscripts/to-png), [`to-jpeg`](./shellscripts/to-jpeg), [`rotate-img`](./shellscripts/rotate-img), [`tq`](./shellscripts/tq) (`jq` for `toml`)\n- Cross-Platform scripts that provide interaction with clipboard/prompting user for input/sending notifications on Mac/Linux/Termux\n\n## Requires\n\nThis _does not install these_ and requires you to have these available (on your `$PATH`) before installing this:\n\n- [GNU coreutils](https://www.gnu.org/software/coreutils/) (or some compatible set of utilities) - e.g., `cut`, `uniq`, `tr`\n- [util-linux](https://en.wikipedia.org/wiki/Util-linux) - e.g., `shuf`, `rev`, `kill`\n- `find`\n- `grep`\n- `curl`\n- `wget`\n- `awk`\n- `sed`\n- `realpath`\n\nOptional/Recommended (some scripts here will fail if these aren't present)\n\n- [`jq`](https://stedolan.github.io/jq/) - command line JSON parser\n- [`fzf`](https://github.com/junegunn/fzf#installation) - fuzzy finder\n- [`fd`](https://github.com/sharkdp/fd#installation) - user-friendly 'find' alternative\n\nNeeded for installing/building core utils used in other scripts here:\n\n- `python3` - \u003chttps://www.python.org/downloads/\u003e\n- `go` - \u003chttps://go.dev/doc/install\u003e (skips installs if `go` not found)\n\n## Install\n\nTo check for dependencies/path issues, run `make`\n\nTo install, run `make install`:\n\n```bash\ngit clone https://github.com/purarue/pura-utils\ncd ./pura-utils\nmake  # check for dependencies\nmake install\n```\n\nOr use [`bpkg`](https://github.com/bpkg/bpkg) to automate the manual `git clone`/`cd`/`make`:\n\n```\nbpkg install -g purarue/pura-utils\n```\n\nTo setup `go` to build packages, add something like this to your `.zshrc`/`.bashrc`:\n\n```bash\n# if not already set\nexport XDG_DATA_HOME=\"${HOME}/.local/share\"\n\n# Go (see 'go help install')\nexport GOPATH=\"${XDG_DATA_HOME}/go\"\nexport GOBIN=\"${GOPATH}/bin\"\n\n# update $PATH\nexport PATH=\"\\\n${HOME}/.local/bin:\\\n${XDG_DATA_HOME}/go/bin:\\\n${PATH}\"\n```\n\nOn [`termux`](https://termux.dev/en/), you need to install the [`termux-api`](https://github.com/termux/termux-api) package (from `F-Droid`)\n\n## Contents\n\nRequires `python 3.8+`/`golang` to install:\n\n### Script Index\n\n`make install` installs:\n\n- a few `go` CLI tools - (See \u003chttps://go.dev/doc/install\u003e for install instructions)\n  - [`newest`](https://github.com/purarue/newest) - print most recently modified file in directory\n  - [`chomp`](https://github.com/purarue/chomp) - remove whitespace/empty lines from command output\n  - [`on_machine`](https://github.com/purarue/on_machine) - detect what operating system/machine you're currently on\n- The `./python-src` package, which includes helper functions, see [python-src/README.md](./python-src/README.md). Also installs required python libraries for any python scripts here\n\n... and shellscripts:\n\n#### shellscripts\n\n##### File/Utility Scripts\n\n- [`havecmd`](./shellscripts/havecmd) - command to check if commands are available\n- [`dir-size`](./shellscripts/dir-size) - prints the total size of a directory\n- [`symlink`](./shellscripts/symlink) - a helper script to make a symlink since I always forget how to\n- [`lastdown`](./shellscripts/lastdown)/[`mvlast`](./shellscripts/mvlast) - prints/moves the latest file in your downloads (`$XDG_DOWNLOAD_DIR` or `~/Downloads`) folder\n- [`get-extension`](./shellscripts/get-extension), [`remove-extension`](./shellscripts/remove-extension), [`replace-extension`](./shellscripts/replace-extension) - helpers to create output filename strings\n- Lots of date shorthands: [`daystamp`](./shellscripts/daystamp), [`daystamp_`](./shellscripts/daystamp_), [`epoch`](./shellscripts/epoch), [`month`](./shellscripts/month), [`weekday`](./shellscripts/weekday), [`year`](./shellscripts/year)\n- [`path`](./shellscripts/path): prints your `$PATH`, separated by newlines\n\n##### File Formats\n\n- [`json-compress`](./shellscripts/json-compress) - compresses JSON (removes extra spaces/newlines), only writes to the file if size of data was changed\n- [`tq`](./shellscripts/tq) - converts a TOML file to JSON, usually piped to [jq](https://github.com/stedolan/jq). e.g.,: `tq \u003cdata.toml | jq '.conf'`\n- [`to-png`](./shellscripts/to-png)/[`to-jpg`](./shellscripts/to-jpg) - converts an image to a png/jpg\n- [`img-download`](./shellscripts/img-download) - downloads an image from your clipboard to your tmpdir, moves it so that the extension is valid\n- [`shebang`](./shellscripts/shebang) - creates a script with the given shebang. If a known language, adds a basic template\n- [`html-head`](./shellscripts/html-head): a script to generate `\u003chead\u003e` tags for generated HTML, I often use this like: `pandoc README.md | html-head -a css-dark-mode -a css-pre-wrap | remsync-html-from-stdin` to convert some local markdown file to a basic dark-mode webpage and publish it onto my website with [`remsync`](https://github.com/purarue/vps/blob/master/remsync)\n\n##### Data Wrangling\n\n- [`lower`](./shellscripts/lower)/[`upper`](./shellscripts/upper) - converts all text from STDIN to lowercase/uppercase\n- [`prefix`](./shellscripts/prefix)/[`suffix`](./shellscripts/suffix)/[`surround`](./shellscripts/surround) - prepends/adds a string to the beginning/end of each line from STDIN\n- [`capitalize`](./shellscripts/capitalize) - 'capitalizes' (first letter of) input, e.g. WORD -\u003e Word; word -\u003e Word\n- [`average`](./shellscripts/average) - finds the mean of numerical data piped from STDIN\n- [`rcut`](./shellscripts/rcut) - `cut`, by indexing from the right instead\n- [`sort-by-last-col`](./shellscripts/sort-by-last-col) - sorts text by last column of text; columns can vary in length\n- [`unique`](./shellscripts/unique) - `uniq`, but doesn't require input to be sorted\n- [`unique-ignore-case`](./shellscripts/unique-ignore-case) - `unique`, but ignores uppercase/lowercase\n- [`tally`](./shellscripts/tally) - shorthand for `sort | uniq -c | sort -n`\n- [`group-and-termgraph`](./shellscripts/group-and-termgraph) - takes lines of data and groups/graphs it using [termgraph](https://github.com/mkaz/termgraph). Sort of like a fancy `sort | uniq -c | sort -n`\n- [`epochdisplay`](./shellscripts/epochdisplay) - given one or more epoch timestamps (`date +\"%s\"`) prints a readable date. If no args are given, reads from STDIN\n- [`epochguess`](./shellscripts/epochguess) - reads anything from STDIN. convert any epoch timestamps that looks like a datetime to local-readable timestamps\n\n##### Cross Platform Helpers\n\nThese use [`on_machine`](https://github.com/purarue/on_machine) to run different commands based on what operating system you're on\n\n- [`openurl`](./shellscripts/openurl)/[`openurls`](./shellscripts/openurls) - URL opener\n- [`clipcopy`](./shellscripts/clipcopy)/[`clippaste`](./shellscripts/clippaste) - save to/read from clipboard\n- [`input-dialog`](./shellscripts/input-dialog) - prompts the user to enter some text with an OS-dialog\n- [`notify`](./shellscripts/notify) - sends a OS notification (`notify-send` on linux/`applescript` on mac)\n- [`picker`](./shellscripts/picker) - prompts user to pick from lines received from STDIN\n\n##### Git\n\n- [`gitopen`](./shellscripts/gitopen) - opens the current git repository/branch in your browser\n- Helpers that return `0` if the condition is met, they're used like: `in-gitdir \u0026\u0026 command_do_something`\n  - [`in-gitdir`](./shellscripts/in-gitdir) - currently in a git directory\n  - [`has-git-remote`](./shellscripts/has-git-remote) - has a `git remote --verbose`\n  - [`git-has-changes`](./shellscripts/git-has-changes) - files have changes or there are untracked files\n  - [`git-list-untracked-files`](./shellscripts/git-list-untracked-files) - prints files that are not tracked by git\n  - [`git-has-untracked-files`](./shellscripts/git-has-untracked-files) - exits with 0 if there are any untracked files\n\n##### Media\n\n- [`image-dimensions`](./shellscripts/image-dimensions) - prints the width/height for images passed as arguments\n- [`gifme`](./shellscripts/gifme) - Creates a gif from a (section of a) video file. Lets you specify start/end times and an fps for the gif to run at\n- [`list-movies`](./shellscripts/list-movies)/[`list-music`](./shellscripts/list-music) - lists any music/movies in the current directory recursively. any additional args are passed onto [`fd`](https://github.com/sharkdp/fd), e.g, with [`mlength`](https://github.com/purarue/mlength)\n  - `list-music -X mlength -o sum` (find length of an album in current directory)\n  - `list-movies -X mlength -d path -o min` (find shortest movie in current directory)\n  - `list-movies -X mlength -d all | sort -n` (sort results by length)\n\n##### Others:\n\n- [`ix`](./shellscripts/ix) - terminal pastebin replacement -- anything piped to STDIN gets uploaded to \u003chttp://ix.io\u003e and a link is copied to your clipboard\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpurarue%2Fpura-utils","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpurarue%2Fpura-utils","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpurarue%2Fpura-utils/lists"}