This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| # Proof of concept to read all keys and values from a RetroArch playlist | |
| # file in JSON format into dedicated variables for instant access. It still | |
| # requires the typical formatting of the playlist and cannot handle arbitrary | |
| # JSON files. But for our use case this should be enough. | |
| default_file="${HOME}/.config/retroarch/playlists/builtin/content_history.lpl" | |
| if [[ "${#}" -eq 0 ]]; then | |
| file="${default_file}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| # Random RetroArch | |
| # Play a random game from a RetroArch playlist. | |
| # | |
| # Requires `jq` and off course `retroarch`. | |
| # | |
| # Examples: | |
| # | |
| # randomretroarch |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| # List Git log messages by tag or commit range. Defaults to HEAD. | |
| # gitlog [from] [to] | |
| # | |
| # from and to can be a tag or commit id: | |
| # gitlog v1.22.2 | |
| # gitlog 281b532 | |
| # gitlog 281b532 b0353a6 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| title="Diff - Compare 2 Texts" | |
| output_size="720x720" | |
| file1="$(mktemp)" | |
| file2="$(mktemp)" | |
| file3="$(mktemp)" | |
| kdialog --title "${title} (input)" --textinputbox "Input Text 1" >> "${file1}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| # Count ROMs | |
| # Simple script to list ROM files by stripping parts of filename starting with | |
| # one of the following characters '_', '(' or '['. Then count remaining | |
| # duplicates and list them with a counter for each name. This is intended to | |
| # count my Romhacks played on emulators, but may work well for any collection. | |
| # | |
| # First argument can be a directory. Defaults to current directory. Files are | |
| # NOT searched recursively. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| # Flatpak list output as JSON format | |
| # Examples with jq: | |
| # flatpak-list-json | jq -r '.[].name' | |
| # flatpak-list-json | jq -r '.[0:2].[].application' | |
| # flatpak-list-json | jq '.[0:2]' | |
| # flatpak-list-json | jq '.[] | select(.description | contains("video"))' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Bash function | |
| # | |
| # usage: treegrep GREPOPTIONS "pattern" | |
| treegrep() { | |
| # grep: | |
| # --recursive like --directories=recurse | |
| # --files-with-match print only names of FILEs with selected lines | |
| # tree: | |
| # --fromfile Reads paths from files (.=stdin) | |
| # -F Appends '/', '=', '*', '@', '|' or '>' as per ls -F. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python3 | |
| import sys | |
| import argparse | |
| long_help = False | |
| for arg in sys.argv: | |
| if arg == "--": | |
| break | |
| if arg == "--long-help": |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| # 1. history and $HISTFILE do not work in scripts. Therefore a direct path to | |
| # the file is needed. | |
| # 2. awk gets the first part of the command line, resulting in the command name. | |
| # 3. List of command names is then sorted and duplicate entries are removed. | |
| # 4. type -P will expand command names to paths, similar to which. But it will | |
| # also expand aliases and remove functions from the list. | |
| # 5. Final output is then sorted again. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| local="${HOME}/.config/retroarch" | |
| repo='https://github.com/libretro/docs' | |
| open='okular' | |
| cd -- "${local}" || exit | |
| if [[ "${1}" == '' ]]; then | |
| mode="$(printf 'open\nupdate' | fzf)" |
NewerOlder