Docker Shortcuts (#43)

* Shrink toolbar icons to 28 from 32.

* Add shortcut commands for Docker administration.

* Add more docker commands. General improvements.
This commit is contained in:
Hyperling 2023-07-22 18:27:13 +00:00 committed by GitHub
parent 84844715a6
commit a9d20be8e0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 78 additions and 48 deletions

View File

@ -119,7 +119,7 @@
alias_rm: alias rm='echo "Use mv ~/TRASH/ instead!"' alias_rm: alias rm='echo "Use mv ~/TRASH/ instead!"'
alias_clean_dir: alias clean-dir='mv * ~/TRASH/' alias_clean_dir: alias clean-dir='mv * ~/TRASH/'
alias_clean_trash: alias clean-trash='sh -c "rm -rfv ~/TRASH/*"' alias_clean_trash: alias clean-trash='sh -c "rm -rfv ~/TRASH/*"'
path_additions: export PATH="~/bin:$PATH" export_path_additions: export PATH="~/bin:$PATH"
function_wttr: | function_wttr: |
function weather() { function weather() {
# 20210301 - Someone showed me an awesome weather API! Had to implement it! # 20210301 - Someone showed me an awesome weather API! Had to implement it!
@ -137,9 +137,9 @@
fi fi
curl "https://wttr.in/${1//\ /+}" curl "https://wttr.in/${1//\ /+}"
} }
PS1: export PS1='[\u@\h \w]\$ ' export_PS1: export PS1='[\u@\h \w]\$ '
remount: alias remount='sudo umount /mnt/*; sudo umount /mnt/*/*; sudo mount -a; echo -e "\nRemount completed!"; mount | grep /mnt' alias_remount: alias remount='sudo umount /mnt/*; sudo umount /mnt/*/*; sudo mount -a; echo -e "\nRemount completed!"; mount | grep /mnt'
update: | function_update: |
function update() { function update() {
PROG=$FUNCNAME PROG=$FUNCNAME
usage="Usage: $PROG [-y] usage="Usage: $PROG [-y]
@ -153,11 +153,11 @@
while getopts ":hy" opt; do while getopts ":hy" opt; do
case $opt in case $opt in
h) echo -e "$usage" h) echo -e "$usage"
return 0 ;; return 0 ;;
y) accept="-y" ;; y) accept="-y" ;;
*) echo "ERROR: -$OPTARG is not a recognized option." *) echo "ERROR: -$OPTARG is not a recognized option." >&2
echo -e "$usage" echo -e "$usage"
return 1 ;; return 1 ;;
esac esac
done done
@ -165,30 +165,30 @@
{{ update_flatpak }} {{ update_flatpak }}
return 0 return 0
echo "ERROR: $PROG experienced a problem and has aborted." echo "ERROR: $PROG experienced a problem and has aborted." >&2
return 1 return 1
} }
sync: alias sync='date && echo "Syncing!" && sync && date' alias_sync: alias sync='date && echo "Syncing!" && sync && date'
editor: export EDITOR='vi' export_editor: export EDITOR='vi'
init_aliases: | init_aliases: |
alias init-video='mkdir -v raw; mkdir -v exports; cp ~/Templates/*video* ./' alias init-video='mkdir -v raw; mkdir -v exports; cp ~/Templates/*video* ./'
alias init-vid=init-video alias init-vid=init-video
alias init-program='echo -e "#!/bin/bash\n# `date +%Y-%m-%d` by Hyperling\n# REASON\n\nexit 0\n"' alias init-program='echo -e "#!/bin/bash\n# `date +%Y-%m-%d` by Hyperling\n# REASON\n\nexit 0\n"'
alias init-prog=init-program alias init-prog=init-program
bye: | bye_aliases: |
alias bye="{{ shutdown_command }}" alias bye="{{ shutdown_command }}"
alias goodbye="update -y && bye" alias goodbye="update -y && bye"
metasploit: | metasploit_aliases: |
alias metasploit="msfconsole" alias metasploit="msfconsole"
alias hax="metasploit" alias hax="metasploit"
show_config: | show_config_aliases: |
alias show-config-gen="cat {{ gen_file }}" alias show-config-gen="cat {{ gen_file }}"
alias show-config-wrk="cat {{ wrk_file }}" alias show-config-wrk="cat {{ wrk_file }}"
alias show-config-mnr="cat {{ mnr_file }}" alias show-config-mnr="cat {{ mnr_file }}"
alias show-config-srv="cat {{ srv_file }}" alias show-config-srv="cat {{ srv_file }}"
alias show-config-all="show-config-gen && echo '' && show-config-wrk && echo '' && show-config-mnr && echo '' && show-config-srv" alias show-config-all="show-config-gen && echo '' && show-config-wrk && echo '' && show-config-mnr && echo '' && show-config-srv"
alias show-config="show-config-all" alias show-config="show-config-all"
edit_config: | edit_config_aliases: |
alias edit-config-gen="sudo $EDITOR {{ gen_file }}" alias edit-config-gen="sudo $EDITOR {{ gen_file }}"
alias edit-config-wrk="sudo $EDITOR {{ wrk_file }}" alias edit-config-wrk="sudo $EDITOR {{ wrk_file }}"
alias edit-config-mnr="sudo $EDITOR {{ mnr_file }}" alias edit-config-mnr="sudo $EDITOR {{ mnr_file }}"
@ -200,13 +200,17 @@
unset network unset network
while (( $# > 0 )); do while (( $# > 0 )); do
case $1 in case $1 in
-c | -y | --clean ) clean="Y" ;; -c | -y | --clean )
-n | -net | --network ) network="Y" ;; clean="Y" ;;
* ) echo " -n | -net | --network )
ERROR: Option '$1' with value '$2' not recognized. network="Y" ;;
$PROG [-c|-clean|--clean|-y] [-n|-net|--network] * )
" echo "
return 1 ERROR: Option '$1' with value '$2' not recognized.
$PROG [-c|-clean|--clean|-y] [-n|-net|--network]
" >&2
return 1
;;
esac esac
shift shift
done done
@ -276,37 +280,63 @@
flatpak repair && flatpak repair &&
echo "Finished purging all Flatpak apps. Executable may still need uninstalled." && echo "Finished purging all Flatpak apps. Executable may still need uninstalled." &&
return return
echo "ERROR: Something went wrong while removing Flatpak apps!" echo "ERROR: Something went wrong while removing Flatpak apps!" >&2
} }
alias_vim: alias vi=vim alias_vim: alias vi=vim
alias_here: alias here='ls -lh `pwd`/*' alias_here: alias here='ls -alh `pwd`/*'
alias_docker_reload: alias docker-reload='docker compose down && docker compose build && docker compose up -d'
alias_docker_update: alias docker-update='docker compose down && docker compose pull && docker compose build && docker compose up -d'
function_docker_upgrade: |
# Wrapper for a full-scale upgrade of a container.
function docker-upgrade() {
container=$1
if [[ -z $container ]]; then
echo "ERROR: Container name or ID is required." >&2
return;
fi
if [[ -s $2 ]]; then
echo "ERROR: A second parameter is not expected, aborting." >&2
return;
fi
docker compose down &&
docker compose pull &&
docker compose build &&
docker compose up -d &&
echo "Following log." &&
docker logs -f $container
}
alias_docker_restart: alias docker-reload='docker compose down && docker compose up -d'
- name: General | Account Management | Users | Files | Common Variable - name: General | Account Management | Users | Files | Common Variable
set_fact: set_fact:
rc_common: | rc_common: |
{{ path_additions }} {{ export_path_additions }}
{{ alias_cp }} {{ alias_cp }}
{{ alias_mv }} {{ alias_mv }}
{{ alias_rm }} {{ alias_rm }}
{{ alias_clean_dir }} {{ alias_clean_dir }}
{{ alias_clean_trash }} {{ alias_clean_trash }}
{{ function_wttr }} {{ function_wttr }}
{{ PS1 }} {{ export_PS1 }}
{{ remount }} {{ alias_remount }}
{{ update }} {{ function_update }}
{{ sync }} {{ alias_sync }}
{{ editor }} {{ export_editor }}
{{ init_aliases }} {{ init_aliases }}
{{ bye }} {{ bye_aliases }}
{{ metasploit }} {{ metasploit_aliases }}
{{ show_config }} {{ show_config_aliases }}
{{ edit_config }} {{ edit_config_aliases }}
{{ function_check_trash }} {{ function_check_trash }}
{{ function_clean }} {{ function_clean }}
{{ function_flatpak_usage }} {{ function_flatpak_usage }}
{{ function_flatpak_purge }} {{ function_flatpak_purge }}
{{ alias_vim }} {{ alias_vim }}
{{ alias_here }} {{ alias_here }}
{{ alias_docker_reload }}
{{ alias_docker_update }}
{{ function_docker_upgrade }}
{{ alias_docker_restart }}
- name: General | Account Management | Users | Files | .bashrc - name: General | Account Management | Users | Files | .bashrc
blockinfile: blockinfile:

View File

@ -158,7 +158,7 @@
- name: Workstation | Account Management | GNOME | Dash To Dock | Icon Size - name: Workstation | Account Management | GNOME | Dash To Dock | Icon Size
dconf: dconf:
key: /org/gnome/shell/extensions/dash-to-dock/dash-max-icon-size key: /org/gnome/shell/extensions/dash-to-dock/dash-max-icon-size
value: "32" value: "28"
state: present state: present
become_user: "{{ user }}" become_user: "{{ user }}"