docker : update function order.

This commit is contained in:
Dmitry Voronin 2023-12-07 05:02:12 +03:00
parent 2f91ebc55b
commit 986781b546
4 changed files with 19 additions and 237 deletions

View file

@ -1,5 +1,5 @@
# Generate a markdown file with all the help info. # Generate a markdown file with all the help info.
# Outputs to ~/.doc/bash.md # Outputs to `~/.doc/bash.md`.
function doc_bash() { function doc_bash() {
local IFS=$'\n' local IFS=$'\n'
local file="${HOME}/.doc/bash.md" local file="${HOME}/.doc/bash.md"

View file

@ -9,6 +9,17 @@ function docker_health() {
docker ps -a | grep Exited docker ps -a | grep Exited
} }
# Find out container's IP address.
# Usage: docker_ip <CONTAINER>
function docker_ip() {
docker inspect -f '\''{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}'\' "${1}" | sed "s/^.//" | sed "s/.$//"
}
# Update all docker images.
function docker_update() {
docker images --format "{{.Repository}}:{{.Tag}}" | xargs -L1 docker pull
}
# Prune everything. # Prune everything.
function docker_prune() { function docker_prune() {
docker system prune --volumes --all docker system prune --volumes --all
@ -75,17 +86,6 @@ function dcul() {
dcu "${@}" && dcl "${@}" dcu "${@}" && dcl "${@}"
} }
# Find out container's IP address.
# Usage: docker_up <CONTAINER>
function docker_ip() {
docker inspect -f '\''{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}'\' "${1}" | sed "s/^.//" | sed "s/.$//"
}
# Update all docker images.
function docker_update() {
docker images --format "{{.Repository}}:{{.Tag}}" | xargs -L1 docker pull
}
# Autocomplete with available services. # Autocomplete with available services.
function _dc_services() { function _dc_services() {
_autocomplete "$(docker compose config --services 2> /dev/null)" _autocomplete "$(docker compose config --services 2> /dev/null)"

View file

@ -40,9 +40,9 @@ function ffmpeg_mux_cover() {
} }
# Generate music metadata from directory structure. # Generate music metadata from directory structure.
# Top dir is the Artist name like this: The_Beatles. # Top dir is the Artist name like this: `The_Beatles`.
# Next are albums like this: 2010_My_love. # Next are albums like this: `2010_My_love`.
# Inside are songs like this: 01_sample.flac. # Inside are songs like this: `01_sample.flac`.
# Usage: ffmpeg_music_meta <FORMAT> # Usage: ffmpeg_music_meta <FORMAT>
function ffmpeg_music_meta() { function ffmpeg_music_meta() {
if [[ "${1}" = "" ]]; then if [[ "${1}" = "" ]]; then

View file

@ -10,16 +10,9 @@ or
$ h <COMMAND> $ h <COMMAND>
``` ```
## Android.
Command|Description Command|Description
---|--- ---|---
emulator [NAME]|Start an Android emulator. Default name is "default". emulator [NAME]|Start an Android emulator. Default name is "default".
## Archive.
Command|Description
---|---
archive [DIRS]|Archive directories. All directories by default. archive [DIRS]|Archive directories. All directories by default.
archive_fast [DIRS]|Archive directories with fast compression. All directories by default. archive_fast [DIRS]|Archive directories with fast compression. All directories by default.
archive_check [FILES]|Check archives integrity. Checks all archives by default. archive_check [FILES]|Check archives integrity. Checks all archives by default.
@ -27,92 +20,34 @@ archive_prune [NAME]|Delete old versions of archives. All archives by default.
unarchive [FILES]|Extract previously created archive with checksum validation. unarchive [FILES]|Extract previously created archive with checksum validation.
archive_name [ARCHIVE] [NAME]|Rename archives. If no name specified, it simplifies archive's name. If no archives specified, apply to all archives. archive_name [ARCHIVE] [NAME]|Rename archives. If no name specified, it simplifies archive's name. If no archives specified, apply to all archives.
archive_convert|Convert old archives to a new format. TODO: remove me after some time when there won't be any old archives. archive_convert|Convert old archives to a new format. TODO: remove me after some time when there won't be any old archives.
## Battery.
Command|Description
---|---
battery_level|Print current battery level. battery_level|Print current battery level.
## Bootstrap.
Command|Description
---|---
bootstrap_rust|Install Cargo/Rust. bootstrap_rust|Install Cargo/Rust.
bootstrap_texlive|Install TeXLive. bootstrap_texlive|Install TeXLive.
bootstrap_grub|Install grub theme. bootstrap_grub|Install grub theme.
bootstrap_ffmpeg|Install ffmpeg. bootstrap_ffmpeg|Install ffmpeg.
## Cd.
Command|Description
---|---
cdd <DIR>|CD (back) to directory. Finds first directory that matches the input (case-insensitive). cdd <DIR>|CD (back) to directory. Finds first directory that matches the input (case-insensitive).
## Checksum.
Command|Description
---|---
checksum_create [FILES]|Save file checksums. For file with a name "file" it will create a new file called ".file.sha1" with hash in it. All files by default. checksum_create [FILES]|Save file checksums. For file with a name "file" it will create a new file called ".file.sha1" with hash in it. All files by default.
checksum_check [FILES]|Check stored values against actual files. All files by default. checksum_check [FILES]|Check stored values against actual files. All files by default.
checksum|Calculate hashes for all files recursively and store in a file called "checksum.sha1". checksum|Calculate hashes for all files recursively and store in a file called "checksum.sha1".
## Chmod.
Command|Description
---|---
x <FILES>|Add executable flag to file. x <FILES>|Add executable flag to file.
## Color.
Command|Description
---|---
color_test|Print all available colors with their names colored in corresponding color. color_test|Print all available colors with their names colored in corresponding color.
## Copypaste.
Command|Description
---|---
copy|Copy stdin to system clipboard. Example: echo hi | copy copy|Copy stdin to system clipboard. Example: echo hi | copy
paste|Paste system clipboard to stdout. Example: paste > file.txt paste|Paste system clipboard to stdout. Example: paste > file.txt
## Cp.
Command|Description
---|---
cp <FROM> <TO>|Replaces default cp with rsync. cp <FROM> <TO>|Replaces default cp with rsync.
cp_merge <FROM> <TO>|Copy and also merge all changes (delete dst files that do not exist in src). cp_merge <FROM> <TO>|Copy and also merge all changes (delete dst files that do not exist in src).
cp_link <FROM> <TO>|Copy by creating hardlinks. Works for directories, too. cp_link <FROM> <TO>|Copy by creating hardlinks. Works for directories, too.
bcp|Default cp, a.k.a builtin cp. When you don't need rsync. bcp|Default cp, a.k.a builtin cp. When you don't need rsync.
cp_test <FROM> <TO>|Print output of cp_merge without writing anything. cp_test <FROM> <TO>|Print output of cp_merge without writing anything.
## Date.
Command|Description
---|---
today|Print today date in yyyyMMdd format. today|Print today date in yyyyMMdd format.
dow|Current day of week number. dow|Current day of week number.
## Dconf.
Command|Description
---|---
dconf_load|Load Gnome settings. dconf_load|Load Gnome settings.
dconf_save [FILE]|Dump Gnome settings into the file. Default name is gnome.dconf. Do this before changing settings and after, an then run diff to find out what to add to main gnome.dconf. dconf_save [FILE]|Dump Gnome settings into the file. Default name is gnome.dconf. Do this before changing settings and after, an then run diff to find out what to add to main gnome.dconf.
## Disk.
Command|Description
---|---
df|Show only physical drives info. df|Show only physical drives info.
du [DIRS]|Show combined size in SI. Current dir by default. du [DIRS]|Show combined size in SI. Current dir by default.
## Docker.
Command|Description
---|---
docker_volumes <CONTAINER>|Show container's volumes. docker_volumes <CONTAINER>|Show container's volumes.
docker_health|Check if any container exited. docker_health|Check if any container exited.
docker_ip <CONTAINER>|Find out container's IP address.
docker_update|Update all docker images.
docker_prune|Prune everything. docker_prune|Prune everything.
dc|Docker compose shortcut. dc|Docker compose shortcut.
dcu [SERVICES]|Docker compose up. dcu [SERVICES]|Docker compose up.
@ -124,48 +59,16 @@ dcs [SERVICES]|Docker compose stop.
dcdu [SERVICES]|Docker compose down & up specified services. dcdu [SERVICES]|Docker compose down & up specified services.
dcpu [SERVICES]|Docker compose pull & up specified services. dcpu [SERVICES]|Docker compose pull & up specified services.
dcul [SERVICES]|Docker compose up & attach to logs for specified services. dcul [SERVICES]|Docker compose up & attach to logs for specified services.
docker_up <CONTAINER>|Find out container's IP address. doc_bash|Generate a markdown file with all the help info. Outputs to `~/.doc/bash.md`.
docker_update|Update all docker images.
## Doc.
Command|Description
---|---
doc_bash|Generate a markdown file with all the help info. Outputs to ~/.doc/bash.md
## Ffmpeg.
Command|Description
---|---
ffmpeg_mux_audio <SOUND> <OUTPUT DIR>|Mux audio into containers. File names in sound and current dirrectories must match. Tmp usage for anime downloads. ffmpeg_mux_audio <SOUND> <OUTPUT DIR>|Mux audio into containers. File names in sound and current dirrectories must match. Tmp usage for anime downloads.
ffmpeg_mux_cover <FORMAT> <COVER>|Mux cover into music file. ffmpeg_mux_cover <FORMAT> <COVER>|Mux cover into music file.
ffmpeg_music_meta <FORMAT>|Generate music metadata from directory structure. Top dir is the Artist name like this: The_Beatles. Next are albums like this: 2010_My_love. Inside are songs like this: 01_sample.flac. ffmpeg_music_meta <FORMAT>|Generate music metadata from directory structure. Top dir is the Artist name like this: `The_Beatles`. Next are albums like this: `2010_My_love`. Inside are songs like this: `01_sample.flac`.
## File.
Command|Description
---|---
o <FILE>|Open file/dir in GUI. o <FILE>|Open file/dir in GUI.
## Find.
Command|Description
---|---
find_ext|Find all file extensions. find_ext|Find all file extensions.
find_module|Find all modules. find_module|Find all modules.
find_function [MODULE]|Find all module functions. Functions from all modules by default. find_function [MODULE]|Find all module functions. Functions from all modules by default.
## Fix.
Command|Description
---|---
fix_ethernet_speed <DEVICE> <SPEED>|Fix when ethernet mistakenly detects 100 Mb instead of 1000 Mb. SPEED is one of 10/100/1000 etc. fix_ethernet_speed <DEVICE> <SPEED>|Fix when ethernet mistakenly detects 100 Mb instead of 1000 Mb. SPEED is one of 10/100/1000 etc.
fix_files_sftp|Fix nautilus after typing wrong sftp password. fix_files_sftp|Fix nautilus after typing wrong sftp password.
## Git.
Command|Description
---|---
gps|Git push. gps|Git push.
gpsf|Git force push. gpsf|Git force push.
gpl|Git pull. gpl|Git pull.
@ -190,29 +93,14 @@ gr [COMMIT COUNT]|Rebase by X commits or from root. When COUNT is 0 - rebase fro
gu [EMAIL]|Specify git user as Dmitry Voronin with provided email. gu [EMAIL]|Specify git user as Dmitry Voronin with provided email.
gg <REPO>|Get my git repo. gg <REPO>|Get my git repo.
gdc <COMMITHASH>|See diff for a specific commit. gdc <COMMITHASH>|See diff for a specific commit.
## Help.
Command|Description
---|---
help <FUNCTION>|Get help about dotfiles bash function. help <FUNCTION>|Get help about dotfiles bash function.
h <FUNCTION>|Short for help. h <FUNCTION>|Short for help.
## Ls.
Command|Description
---|---
l [DIRS]|List files in dirs. Current dir by default. l [DIRS]|List files in dirs. Current dir by default.
ll [DIRS]|List last modified files first. Current dir by default. ll [DIRS]|List last modified files first. Current dir by default.
lll [DEPTH] [DIRS]|List files in tree structure. Current dir by default. Depth can be omitted by passing - (dash). lll [DEPTH] [DIRS]|List files in tree structure. Current dir by default. Depth can be omitted by passing - (dash).
llll [DIRS]|List files recursively. Current dir by default. llll [DIRS]|List files recursively. Current dir by default.
la [DIRS]|List all files in dirs, incl. hidden files. Current dir by default. la [DIRS]|List all files in dirs, incl. hidden files. Current dir by default.
lla [DIRS]|List all files in dirs, incl. hidden files, sorted by mtime. Current dir by default. lla [DIRS]|List all files in dirs, incl. hidden files, sorted by mtime. Current dir by default.
## Name.
Command|Description
---|---
name [FILES]|Rename files to strip all special characters. All files by default. name [FILES]|Rename files to strip all special characters. All files by default.
name_hash [FILES]|Rename all files to their hashes while keeping extensions. All files by default. name_hash [FILES]|Rename all files to their hashes while keeping extensions. All files by default.
name_hash_check [FILES]|Check hashes for previously renamed files. All files by default. name_hash_check [FILES]|Check hashes for previously renamed files. All files by default.
@ -222,89 +110,24 @@ name_ext <EXTENSION> [FILES]|Rename files with new extension. All files by defau
name_prefix <OLD> <NEW> [FILES]|Change file name prefix. All matching files by default. name_prefix <OLD> <NEW> [FILES]|Change file name prefix. All matching files by default.
name_postfix <OLD> <NEW> [FILES]|Change file name postfix. All matching files by default. name_postfix <OLD> <NEW> [FILES]|Change file name postfix. All matching files by default.
name_replace <OLD> <NEW> [FILES]|Replace part of the name. All matching files by default. name_replace <OLD> <NEW> [FILES]|Replace part of the name. All matching files by default.
## Ncdu.
Command|Description
---|---
ncdu [DIRS]|Search only on current filesystem. Current dir by default. ncdu [DIRS]|Search only on current filesystem. Current dir by default.
## Notify.
Command|Description
---|---
notify <MESSAGE>|Send Telegram notification. notify <MESSAGE>|Send Telegram notification.
notify_silent <MESSAGE>|Send silent Telegram notification. notify_silent <MESSAGE>|Send silent Telegram notification.
## Own.
Command|Description
---|---
own [USER] [FILES]|Change file ownership to specified user id and restrict access to him. Root user by default. This directory recursively by default. own [USER] [FILES]|Change file ownership to specified user id and restrict access to him. Root user by default. This directory recursively by default.
## Pack.
Command|Description
---|---
pack <TARGET.ext> [FILES]|Pack files into desired format. All files and directories by default. pack <TARGET.ext> [FILES]|Pack files into desired format. All files and directories by default.
unpack [FILES]|Attempt to unpack. All supported formats by default. unpack [FILES]|Attempt to unpack. All supported formats by default.
## Parse.
Command|Description
---|---
parse_simplify <STRING>|Parse data and output simplified format. parse_simplify <STRING>|Parse data and output simplified format.
parse_camel <STRING>|Parse to CamelCase. parse_camel <STRING>|Parse to CamelCase.
parse_alnum <STRING>|Parse data keeping only alphanumeric characters. parse_alnum <STRING>|Parse data keeping only alphanumeric characters.
## Permissions.
Command|Description
---|---
perm_share|Recursively change permissions to allow read sharing with group and others. perm_share|Recursively change permissions to allow read sharing with group and others.
perm|Recursively change permissions to restrict access for group and others. perm|Recursively change permissions to restrict access for group and others.
## Ps.
Command|Description
---|---
ps <PROCESS>|Find process and filter. ps <PROCESS>|Find process and filter.
## Recursive.
Command|Description
---|---
recursive <COMMAND>|Run something recursively over all directories. recursive <COMMAND>|Run something recursively over all directories.
recursive1 <COMMAND>|Run something recursively over directories of 1 depth (excluding current dir). recursive1 <COMMAND>|Run something recursively over directories of 1 depth (excluding current dir).
## Rust.
Command|Description
---|---
rust_book|Open Rust book. rust_book|Open Rust book.
## Su.
Command|Description
---|---
s [USER]|Su shortcut for lazy me. Root by default. s [USER]|Su shortcut for lazy me. Root by default.
## Terminal.
Command|Description
---|---
tsize|Get terminal size. tsize|Get terminal size.
## Tmp.
Command|Description
---|---
tmp|CD into host's primary tmp dir. tmp|CD into host's primary tmp dir.
## Tmux.
Command|Description
---|---
ta [NAME]|Create/attach to named session. By default uses name "main". ta [NAME]|Create/attach to named session. By default uses name "main".
td|Detach from running session. td|Detach from running session.
tl|List running sessions. tl|List running sessions.
@ -312,58 +135,17 @@ trn [NAME]|Rename current session. Uses current dir name by default.
tn [NAME]|Assign name to window. Uses current dir name by default. tn [NAME]|Assign name to window. Uses current dir name by default.
tk [NAME]|Kill specified session. By default it kills "main" session. tk [NAME]|Kill specified session. By default it kills "main" session.
tka|Kill all sessions. tka|Kill all sessions.
## Todo.
Command|Description
---|---
todo|Open ~/.todo.md file. todo|Open ~/.todo.md file.
## Toolbx.
Command|Description
---|---
tba [NAME]|Attach/create toolbx container with specified name. By default uses "main" name. tba [NAME]|Attach/create toolbx container with specified name. By default uses "main" name.
tbk [NAME]|Remove toolbx container with specified name. By default uses "main" name. tbk [NAME]|Remove toolbx container with specified name. By default uses "main" name.
tb_rpmfusion [NAME]|Install rpm-fusion repository into container with specified name. By default uses "main" name. tb_rpmfusion [NAME]|Install rpm-fusion repository into container with specified name. By default uses "main" name.
tbl|List all available containers. tbl|List all available containers.
## Transcode.
Command|Description
---|---
transcode <FORMAT> [FILES]|Convert between different formats. By default tries to convert all files. transcode <FORMAT> [FILES]|Convert between different formats. By default tries to convert all files.
## Try.
Command|Description
---|---
try <COMMAND>|Retry command every 2 sec until it completes successfully. try <COMMAND>|Retry command every 2 sec until it completes successfully.
## Vdl.
Command|Description
---|---
vdl [LINK]|Download video from URL. When no [LINK] specified, it tries to update previously downloaded link. vdl [LINK]|Download video from URL. When no [LINK] specified, it tries to update previously downloaded link.
vdl_vk <LINK>|Temporary fix for vk downloads. vdl_vk <LINK>|Temporary fix for vk downloads.
vdl_file <FILE>|Download all videos from file with links. vdl_file <FILE>|Download all videos from file with links.
## Vi.
Command|Description
---|---
v|Neovim shortcut. v|Neovim shortcut.
## Wallpaper.
Command|Description
---|---
wallpaper <FILE>|Set specified file as a wallpaper. wallpaper <FILE>|Set specified file as a wallpaper.
## Watch.
Command|Description
---|---
w <COMMAND>|Watch command output with 2 seconds interval. w <COMMAND>|Watch command output with 2 seconds interval.
ww <COMMAND>|Watch command output with minimal interval. ww <COMMAND>|Watch command output with minimal interval.