From 18daf8008e5464a07ed723092334783fb89d41cc Mon Sep 17 00:00:00 2001 From: hydrargyrum Date: Sun, 11 Oct 2020 17:22:29 +0200 Subject: [PATCH] add READMEs for ffmcut, flatten-json, qunpak, random-line, tailsleep --- ffmcut/README.md | 17 +++++++++++++ flatten-json/README.md | 57 ++++++++++++++++++++++++++++++++++++++++++ qunpak/README.md | 29 +++++++++++++++++++++ random-line/README.md | 9 +++++++ tailsleep/README.md | 22 ++++++++++++++++ 5 files changed, 134 insertions(+) create mode 100644 ffmcut/README.md create mode 100644 flatten-json/README.md create mode 100644 qunpak/README.md create mode 100644 random-line/README.md create mode 100644 tailsleep/README.md diff --git a/ffmcut/README.md b/ffmcut/README.md new file mode 100644 index 0000000..8286fa9 --- /dev/null +++ b/ffmcut/README.md @@ -0,0 +1,17 @@ +# ffmcut + +Use ffmpeg to cut a video + +# Synopsis + + ffmcut INPUT START END OUTPUT + +# Desciption + +Cut INPUT video file from START timestamp to END timestamp and write OUTPUT file. + +START and END arguments are in seconds but minutes and hours are also supported. Examples: + + 30 + 10:30 + 1:20:00 diff --git a/flatten-json/README.md b/flatten-json/README.md new file mode 100644 index 0000000..4207b3c --- /dev/null +++ b/flatten-json/README.md @@ -0,0 +1,57 @@ +# flatten-json + +Flatten a deep JSON structure in a flat object with path-like keys + +# Synopsis + + flatten-json [--expand [--no-lists]] [--separator CHAR] + +# Example + +Given the following JSON: + +```json +{ + "my_object": [ + { + "id": "foo", + "name": "Foo!", + "description": "blah blah" + }, + { + "id": "bar", + "name": "Bar..." + } + ], + "something": "whatever" +} +``` + +`flatten-json` will output this: + +```json +{ + "my_object/0/id": "foo", + "my_object/0/name": "Foo!", + "my_object/0/description": "blah blah", + "my_object/1/id": "bar", + "my_object/1/name": "Bar...", + "something": "whatever" +} +``` + +A flat JSON with only one level of depth and path-like keys. + +# Options + + --expand + +Do the reverse operation, take a flat JSON with path-like keys and transform in tree JSON + + --no-lists + +(Only applicable if `--expand` is given), when faced with numeric elements in path, do not try to build a list/array, build an object with numeric keys. + + --separator CHAR + +Use CHAR instead of `/` as path separator. Applicable for both `--expand` and `--flatten`. diff --git a/qunpak/README.md b/qunpak/README.md new file mode 100644 index 0000000..b32b4c8 --- /dev/null +++ b/qunpak/README.md @@ -0,0 +1,29 @@ +# qunpak + +Extract and list Quake .pak archive files. + +``` +qunpak PAK0.PAK +``` + +will extract PAK0.PAK. + +It's also possible to simply list its content: + +``` +qunpak -l PAK0.PAK +``` + +Only some files can be extracted by specifying a glob-pattern ("*" will match slashes and dots): + +``` +qunpak PAK0.PAK "*.wav" +``` + +will extract all .wav files from the root content in PAK0.PAK. + +By default, files are extracted in current directory, but another directory can be used: + +``` +qunpak -O /other/dir/where/to/extract PAK0.PAK +``` diff --git a/random-line/README.md b/random-line/README.md new file mode 100644 index 0000000..0673adf --- /dev/null +++ b/random-line/README.md @@ -0,0 +1,9 @@ +# random-line + +Returns a random line from stdin + +# Example + + % seq 10 | random-line + 6 + diff --git a/tailsleep/README.md b/tailsleep/README.md new file mode 100644 index 0000000..67c465f --- /dev/null +++ b/tailsleep/README.md @@ -0,0 +1,22 @@ +# tailsleep # + +tailsleep is a command-line program that reads a file and prints its content to stdout, and if the file is modified externally by appending data, the new data is written to stdout. However, if the file is not modified within a few seconds (5 seconds by default), tailsleep exits. + +It is a bit like the "`tail -f`" command (hence the name) but it writes the full content of the file (not the 10 last lines), and exits when the file is not modified for some time. + +# Sample uses # + +Extract a file that is being downloaded by a web browser: + +``` +tailsleep file-being-downloaded.tar.gz.part | tar -xzf - +``` + +As an extension, download Flash videos loading/loaded in your web browser (doesn't need to be playing them, they can be paused): + +``` +find /proc/*/fd -lname "*FlashXX*" | while read vid +do + tailsleep $vid > "video-`basename $vid`.flv" +done +```