An open API service indexing awesome lists of open source software.

https://github.com/retifrav/bash-scripts

My Bash scripts
https://github.com/retifrav/bash-scripts

bash

Last synced: 3 months ago
JSON representation

My Bash scripts

Awesome Lists containing this project

README

          

## Bash scripts

My Bash scripts.

- [lorem-ipsum](#lorem-ipsum)
- [download-and-verify-archives](#download-and-verify-archives)
- [temporary-file](#temporary-file)
- [copy-files-with-rclone](#copy-files-with-rclone)
- [generate-dependencies-list-from-vcpkg](#generate-dependencies-list-from-vcpkg)
- [control-raspberry-pi-desktop-with-tv-remote-via-cec](#control-raspberry-pi-desktop-with-tv-remote-via-cec)
- [navicat-reset-trial](#navicat-reset-trial)
- [concat-steam-game-recording](#concat-steam-game-recording)

### lorem-ipsum

Lorem ipsum generator. Prints Lorem ipsum text to `./lorem-ipsum.txt` specified number of times:

``` sh
$ ./lorem-ipsum.sh -n 999
```

### download-and-verify-archives

Downloads archives from links provided in a file using `cURL` and verifies their contents against "blueprints" (*text files with contents expected to be inside each archive*) using `diff`:

``` sh
$ ./download-and-verify-archives.sh -t "ACCESS-TOKEN-HERE"
```

### temporary-file

Based on .

Creates a temporary file, performs some checks and sets a trap for deleting it afterwards:

``` sh
$ ./temporary-file.sh
$ less ./some.log
```

This is supposed to be used as a part of actual scripts for "batched" logging, when several process might be writing to the same log file, so you'd need to ensure that their logs rows are not mixed together.

### copy-files-with-rclone

Copies files with [rclone](https://rclone.org) from a remote server on cron schedule:

``` sh
$ mkdir ~/scripts ~/logs

$ crontab -e
```
``` sh
20 * * * * ~/scripts/copy-files-with-rclone.sh >> ~/logs/copy-files-with-rclone.log 2>&1
```

Don't forget to remove `--dry-run` from `copy` commands.

### generate-dependencies-list-from-vcpkg

Generates a text file with a lazy list of dependencies collected from listings in `vcpkg_installed/vcpkg/info/` folder:

``` sh
ls -L1 /path/to/some/project/build/vcpkg_installed/vcpkg/info/ | head -5
assimp_5.3.1_myvr-arm64-osx.list
brotli_1.1.0_myvr-arm64-osx.list
catch2_3.5.3_myvr-arm64-osx.list
clara_1.1.5_myvr-arm64-osx.list
cpp-base64_2.0.8_myvr-arm64-osx.list

$ ./generate-dependencies-list-from-vcpkg.sh -p /path/to/some/project/build/vcpkg_installed/vcpkg/info/

$ head -5 ./3rd-party.txt
assimp_5.3.1
brotli_1.1.0
catch2_3.5.3
clara_1.1.5
cpp-base64_2.0.8
```

### control-raspberry-pi-desktop-with-tv-remote-via-cec

Controlling Raspberry Pi desktop with TV remote via CEC, more details [here](https://github.com/retifrav/bash-scripts/blob/master/control-raspberry-pi-desktop-with-tv-remote-via-cec/README.md).

### navicat-reset-trial

Resetting [Navicat Premium](https://navicat.com/en/products/navicat-premium) trial (*on Mac OS*), because no one has 800 USD to pay for the license:

``` sh
$ ./navicat-reset-trial.sh
Found Navicat folder, deleting it
Found the preferences file: /Users/USERNAME/Library/Preferences/com.navicat.NavicatPremium.plist
Got the trial key: THE-KEY-VALUE
```

Original author is [1monday](https://appstorrent.ru/802-navicat-premium.html#findcomment158332).

### concat-steam-game-recording

Concatenating Steam game recording fragments into a proper single video file:

``` sh
$ tree /home/deck/.local/share/Steam/userdata/YOUR-ID/gamerecordings/video
├── bg_9361349647978725376_20260103_151654
│ ├── chunk-stream0-00001.m4s
│ ├── chunk-stream0-00002.m4s
│ ├── chunk-stream1-00001.m4s
│ ├── chunk-stream1-00002.m4s
│ ├── init-stream0.m4s
│ ├── init-stream1.m4s
│ └── session.mpd
├── bg_9361349647978725376_20260103_151658
│ ├── chunk-stream0-00001.m4s
│ ├── chunk-stream0-00002.m4s
│ ├── chunk-stream1-00001.m4s
│ ├── chunk-stream1-00002.m4s
│ ├── init-stream0.m4s
│ ├── init-stream1.m4s
│ └── session.mpd
├── bg_9361349647978725376_20260103_151704_0
│ ├── chunk-stream0-00001.m4s
│ ├── chunk-stream1-00001.m4s
│ ├── init-stream0.m4s
│ ├── init-stream1.m4s
│ └── session.mpd
├── bg_9361349647978725376_20260103_151706_0
│ ├── chunk-stream0-00001.m4s
│ ├── chunk-stream1-00001.m4s
│ ├── init-stream0.m4s
│ ├── init-stream1.m4s
│ └── session.mpd
└── bg_9361349647978725376_20260103_151709
├── chunk-stream0-00001.m4s
├── chunk-stream0-00002.m4s
├── chunk-stream0-00003.m4s
├── chunk-stream0-00004.m4s
├── chunk-stream1-00001.m4s
├── chunk-stream1-00002.m4s
├── chunk-stream1-00003.m4s
├── chunk-stream1-00004.m4s
├── init-stream0.m4s
├── init-stream1.m4s
└── session.mpd

$ ./concat-steam-game-recording.sh \
-p /home/deck/.local/share/Steam/userdata/YOUR-ID/gamerecordings/video \
-r bg_9361349647978725376
[DEBUG] Path to recordings: /home/deck/.local/share/Steam/userdata/YOUR-ID/gamerecordings/video
[DEBUG] Recording ID: bg_9361349647978725376
[DEBUG] Path to output: ./out.mp4
[DEBUG] Found FFmpeg: /usr/bin/ffmpeg
[DEBUG] Temporary folder: /tmp/tmp.9VbN8P7Ww6

Processing [/home/deck/.local/share/Steam/userdata/YOUR-ID/gamerecordings/video/bg_9361349647978725376_20260103_151654]...
Processing [/home/deck/.local/share/Steam/userdata/YOUR-ID/gamerecordings/video/bg_9361349647978725376_20260103_151658]...
Processing [/home/deck/.local/share/Steam/userdata/YOUR-ID/gamerecordings/video/bg_9361349647978725376_20260103_151704_0]...
Processing [/home/deck/.local/share/Steam/userdata/YOUR-ID/gamerecordings/video/bg_9361349647978725376_20260103_151706_0]...
Processing [/home/deck/.local/share/Steam/userdata/YOUR-ID/gamerecordings/video/bg_9361349647978725376_20260103_151709]...

Concatenating into the final video file...

$ mpv ./out.mp4
```

Note that you might have several different recordings starting with the same prefix, so you might need to make it more precise (*by including the date/time too*).