aboutsummaryrefslogtreecommitdiffstats
path: root/hyperterm/tools
diff options
context:
space:
mode:
authorJesús <heckyel@hyperbola.info>2021-02-10 13:52:52 -0500
committerJesús <heckyel@hyperbola.info>2021-02-10 13:52:52 -0500
commit7e95c3b667a1b353f8275db886203f272bfcce34 (patch)
treeaefe3b7db69ac78b83b79a70cf43401679812d20 /hyperterm/tools
downloadhyperterm-7e95c3b667a1b353f8275db886203f272bfcce34.tar.lz
hyperterm-7e95c3b667a1b353f8275db886203f272bfcce34.tar.xz
hyperterm-7e95c3b667a1b353f8275db886203f272bfcce34.zip
first commit
Diffstat (limited to 'hyperterm/tools')
-rw-r--r--hyperterm/tools/aliases.sh12
-rw-r--r--hyperterm/tools/compress.sh165
-rw-r--r--hyperterm/tools/export.sh6
-rw-r--r--hyperterm/tools/listuser.sh17
-rw-r--r--hyperterm/tools/network.sh11
-rw-r--r--hyperterm/tools/proxy.sh47
-rw-r--r--hyperterm/tools/rar2zip.sh58
-rw-r--r--hyperterm/tools/ruby.sh10
-rw-r--r--hyperterm/tools/ssh-agent.sh105
-rw-r--r--hyperterm/tools/sysinfo.sh36
-rw-r--r--hyperterm/tools/vconverter.sh72
-rw-r--r--hyperterm/tools/virtualenv.sh6
12 files changed, 545 insertions, 0 deletions
diff --git a/hyperterm/tools/aliases.sh b/hyperterm/tools/aliases.sh
new file mode 100644
index 0000000..5493a6f
--- /dev/null
+++ b/hyperterm/tools/aliases.sh
@@ -0,0 +1,12 @@
+#!/bin/bash
+
+alias clean='cat /dev/null > "$HOME/.bash_history" && history -c'
+alias df='df -h' # human-readable sizes
+alias ep='emacs PKGBUILD'
+alias free='free -hm' # show sizes in humans format
+alias grep='grep --color=tty -d skip'
+alias la='ls -la --group-directories-first --time-style=+"%d.%m.%Y %H:%M" --color=auto -F'
+alias ll='ls -l --group-directories-first --time-style=+"%d.%m.%Y %H:%M" --color=auto -F'
+alias ls='ls --group-directories-first --time-style=+"%d.%m.%Y %H:%M" --color=auto -F'
+alias np='nano PKGBUILD'
+alias pastebin='curl -X POST https://bpa.st/curl -F "raw=<-"'
diff --git a/hyperterm/tools/compress.sh b/hyperterm/tools/compress.sh
new file mode 100644
index 0000000..bfb92b0
--- /dev/null
+++ b/hyperterm/tools/compress.sh
@@ -0,0 +1,165 @@
+#!/bin/bash
+# ex - archive extractor
+# usage: ex <file>
+function ex() {
+ if [ -f "$1" ] ; then
+ # shellcheck disable=SC2221,SC2222
+ case "$1" in
+ *.tar.bz2) tar xjf "$1" ;;
+ *.tar.gz) tar xzf "$1" ;;
+ *.tar.xz) tar xf "$1" ;;
+ *.tar.lz) tar xvf "$1" ;;
+ *.lz) lzip -d "$1" ;;
+ *.7z) 7z x "$1" ;;
+ *.bz2) bunzip2 "$1" ;;
+ *.gz) gunzip "$1" ;;
+ *.rar) unar "$1" ;;
+ *.tar) tar xf "$1" ;;
+ *.tbz2) tar xjf "$1" ;;
+ *.tgz) tar xzf "$1" ;;
+ *.xz) unxz "$1" ;;
+ *.Z) uncompress "$1" ;;
+ *.zip) unzip "$1" ;;
+ *) msg_err "No se puede extraer '$1' vía ex()" \
+ "'$1' cannot be extracted via ex()"
+ return 1 ;;
+ esac
+ else
+ msg_err "'$1' no es un archivo válido ¯\_(ツ)_/¯" \
+ "'$1' is not a valid file ¯\_(ツ)_/¯"
+ return 1
+ fi
+}
+
+# Compress files or directories
+function cex() {
+
+ function option_compress_f() {
+ printf '%s\n' "1) 7z"
+ printf '%s\n' "2) bz2"
+ printf '%s\n' "3) gz"
+ printf '%s\n' "4) tar.bz2"
+ printf '%s\n' "5) tar.gz"
+ printf '%s\n' "6) tar.xz"
+ printf '%s\n' "7) tar.lz"
+ printf '%s\n' "8) tar"
+ printf '%s\n' "9) tbz2"
+ printf '%s\n' "10) tgz"
+ printf '%s\n' "11) Z"
+ printf '%s\n' "12) zip"
+ }
+
+ function option_compress_d() {
+ printf '%s\n' "1) 7z"
+ printf '%s\n' "2) tar.bz2"
+ printf '%s\n' "3) tar.gz"
+ printf '%s\n' "4) tar.xz"
+ printf '%s\n' "5) tar.lz"
+ printf '%s\n' "6) tar"
+ printf '%s\n' "7) tbz2"
+ printf '%s\n' "8) tgz"
+ printf '%s\n' "9) zip"
+ }
+
+ function log_compress() {
+ msg "Que tenga un buen día \o/" \
+ "You have a nice day \o/"
+ }
+
+ function invalid_option() {
+ msg "Archivo inválido u Opción no listada ¯\_(ツ)_/¯" \
+ "Invalid file or Option not listed ¯\_(ツ)_/¯"
+ return 1
+ }
+
+ function compress_f() {
+ read -r A
+ case $A in
+ 1) 7z a "${1}.7z" "$1" ;;
+ 2) bzip2 -k "$1" ;;
+ 3) gzip --best --keep "$1" ;;
+ 4) tar -c "$1" | bzip2 > "${1}.tar.bz2" ;;
+ 5) tar -czvf "${1}.tar.gz" "$1" ;;
+ 6) tar cJvf "${1}.tar.xz" "$1" ;;
+ 7) tar -cvf "${1}.tar.lz" --lzip "$1" ;;
+ 8) tar -cvf "${1}.tar" "$1" ;;
+ 9) tar -c "$1" | bzip2 > "${1}.tbz2" ;;
+ 10) tar -czvf "${1}.tgz" "$1" ;;
+ 11) tar -czvf "${1}.z" "$1" ;;
+ 12) zip -r "${1}.zip" "$1" ;;
+ 0) log_compress "$@" ;;
+ *) invalid_option "$@" ;;
+ esac
+ }
+
+ function compress_d() {
+ read -r A
+ case $A in
+ 1) 7z a "${1%/}.7z" "$1" ;;
+ 2) tar -c "$1" | bzip2 > "${1%/}.tar.bz2" ;;
+ 3) tar -czvf "${1%/}.tar.gz" "$1" ;;
+ 4) tar cJvf "${1%/}.tar.xz" "$1" ;;
+ 5) tar -cvf "${1%/}.tar.lz" --lzip "${1}" ;;
+ 6) tar -cvf "${1%/}.tar" "$1" ;;
+ 7) tar -c "$1" | bzip2 > "${1%/}.tbz2" ;;
+ 8) tar -czvf "${1%/}.tgz" "$1" ;;
+ 9) zip -r "${1%/}.zip" "$1" ;;
+ 0) log_compress "$@" ;;
+ *) invalid_option "$@" ;;
+ esac
+ }
+
+ # Run
+ if [[ -f "$1" ]] ; then
+ case ${LANG/_*/} in
+ es)
+ # Print viewport user
+ printf '%s\n' "Elige una acción"
+ option_compress_f "$@"
+ printf '%s\n' "0) salir"
+ printf "Inserta la opción aquí:"
+ compress_f "$@"
+ ;;
+
+ *)
+ # Print viewport user
+ printf '%s\n' "Choose option"
+ option_compress_f "$@"
+ printf '%s\n' "0) exit"
+ printf "Insert the option here:"
+ compress_f "$@"
+ ;;
+ esac
+ elif [[ -d "$1" ]] ; then
+ case ${LANG/_*/} in
+ es)
+ # Print viewport user
+ printf '%s\n' "Elige una acción"
+ option_compress_d "$@"
+ printf '%s\n' "0) salir"
+ printf "Inserta la opción aquí:"
+ compress_d "$@"
+ ;;
+
+ *)
+ # Print viewport user
+ printf '%s\n' "Choose option"
+ option_compress_d "$@"
+ printf '%s\n' "0) exit"
+ printf "Insert the option here:"
+ compress_d "$@"
+ ;;
+ esac
+ else
+ msg_err "'$1' no es un archivo o directorio válido ¯\_(ツ)_/¯" \
+ "'$1' is not a valid file or directory ¯\_(ツ)_/¯"
+ return 1
+ fi
+}
+
+unset -f compress_f
+unset -f compress_d
+unset -f log_compress
+unset -f option_compress_f
+unset -f option_compress_d
+unset -f invalid_option
diff --git a/hyperterm/tools/export.sh b/hyperterm/tools/export.sh
new file mode 100644
index 0000000..0d6f69a
--- /dev/null
+++ b/hyperterm/tools/export.sh
@@ -0,0 +1,6 @@
+#!/bin/bash
+
+export HISTSIZE=10000
+export HISTFILESIZE=${HISTSIZE}
+export HISTCONTROL=ignoreboth
+export JAVA_FONTS=/usr/share/fonts/TTF
diff --git a/hyperterm/tools/listuser.sh b/hyperterm/tools/listuser.sh
new file mode 100644
index 0000000..face1a7
--- /dev/null
+++ b/hyperterm/tools/listuser.sh
@@ -0,0 +1,17 @@
+#!/bin/bash
+
+# List user
+function listuser() {
+ case ${LANG/_*/} in
+ es)
+ printf '%s\n' "Usuario UID Shell "
+ printf '%s\n' "----------- ----- --------"
+ awk -F':' '$3>=1000 && $3<=60000 { printf "%-12s %4d %11s\n", $1, $3, $7 | "sort -r"}' /etc/passwd
+ ;;
+ *)
+ printf '%s\n' "Users UID Shell "
+ printf '%s\n' "----------- ----- --------"
+ awk -F':' '$3>=1000 && $3<=60000 { printf "%-12s %4d %11s\n", $1, $3, $7 | "sort -r"}' /etc/passwd
+ ;;
+ esac
+}
diff --git a/hyperterm/tools/network.sh b/hyperterm/tools/network.sh
new file mode 100644
index 0000000..0bab431
--- /dev/null
+++ b/hyperterm/tools/network.sh
@@ -0,0 +1,11 @@
+#!/bin/bash
+# Network
+function my_ip() {
+ unset MY_IP
+ : "${MY_IP:=$(ip route show table local | awk -F "local" '{print $2}' | uniq)}"
+}
+
+function my_isp() {
+ unset MY_ISP
+ : "${MY_ISP:=$(host myip.opendns.com resolver1.opendns.com | grep "myip.opendns.com has" | awk '{print $4}')}"
+}
diff --git a/hyperterm/tools/proxy.sh b/hyperterm/tools/proxy.sh
new file mode 100644
index 0000000..08b4da1
--- /dev/null
+++ b/hyperterm/tools/proxy.sh
@@ -0,0 +1,47 @@
+#!/bin/bash
+
+function proxy_on() {
+ export no_proxy="localhost,127.0.0.1,localaddress,.localdomain.com"
+
+ if (( $# > 0 )); then
+ valid=$(echo "$@" | sed -n 's/\([0-9]\{1,3\}.\)\{4\}:\([0-9]\+\)/&/p')
+ value=$("$@")
+ if [[ $valid != "$value" ]]; then
+ >&2 echo "Invalid address"
+ return 1
+ fi
+
+ export http_proxy="http://$1/"
+ export https_proxy=$http_proxy
+ export ftp_proxy=$http_proxy
+ export rsync_proxy=$http_proxy
+ echo "Proxy environment variable set."
+ return 0
+ fi
+
+ echo -n "username: "; read -r username
+ if [[ $username != "" ]]; then
+ echo -n "password: "
+ read -esr password
+ local pre="$username:$password@"
+ fi
+
+ echo -n "server: "; read -r server
+ echo -n "port: "; read -r port
+ export http_proxy="http://$pre$server:$port/"
+ export https_proxy=$http_proxy
+ export ftp_proxy=$http_proxy
+ export rsync_proxy=$http_proxy
+ export HTTP_PROXY=$http_proxy
+ export HTTPS_PROXY=$http_proxy
+ export FTP_PROXY=$http_proxy
+ export RSYNC_PROXY=$http_proxy
+}
+
+function proxy_off(){
+ unset http_proxy
+ unset https_proxy
+ unset ftp_proxy
+ unset rsync_proxy
+ echo -e "Proxy environment variable removed."
+}
diff --git a/hyperterm/tools/rar2zip.sh b/hyperterm/tools/rar2zip.sh
new file mode 100644
index 0000000..eb13d80
--- /dev/null
+++ b/hyperterm/tools/rar2zip.sh
@@ -0,0 +1,58 @@
+#!/bin/bash
+#
+# rar2zip conversion script
+#
+# Usage: rar2zip file [file ...]
+# Example: rar2zip file.rar
+
+function rar2zip() {
+
+ echo "Converting RARs to ZIPs"
+
+ # Use RAM disk for temporary files.
+ WORKDIR="/dev/shm/"
+
+ for INFILE in "$@"; do
+ # Absolute path to old file
+ OLDFILE=$(realpath "${INFILE}")
+
+ # Get the file name without the extension
+ BASENAME=$(basename "${OLDFILE%.*}")
+
+ # Path for the file. The ".zip" file will be written there.
+ DIRNAME=$(dirname "$OLDFILE")
+
+ # Name of the .zip file
+ NEWNAME="${DIRNAME}/$BASENAME.zip"
+
+ if [ ! -e "${NEWNAME}" ]; then
+ # Set name for the temp dir. This directory will be created under WORKDIR
+ TEMPDIR=$(mktemp -p "$WORKDIR" -d)
+
+ # Create a temporary folder for unRARed files
+ echo "Extracting $OLDFILE"
+
+ unar "$OLDFILE" -o "${TEMPDIR}/"
+
+ # Zip the files with maximum compression
+ 7z a -tzip -mx=9 "$NEWNAME" "${TEMPDIR}/*"
+ # Alternative. MUCH SLOWER, but better compression
+ # 7z a -mm=Deflate -mfb=258 -mpass=15 -r "$NEWNAME" *
+
+ # Preserve file modification time
+ touch -r "$OLDFILE" "$NEWNAME"
+
+ # Delete the temporary directory
+ rm -r "$TEMPDIR"
+
+ # OPTIONAL. Safe-remove the old file
+ # Restore from "$HOME/.local/share/Trash"
+ gio trash "$OLDFILE"
+ echo "${OLDFILE}: A backup was made on $HOME/.local/share/Trash"
+ else
+ echo "${NEWNAME}: File exists!"
+ fi
+ done
+
+ echo "Conversion Done"
+}
diff --git a/hyperterm/tools/ruby.sh b/hyperterm/tools/ruby.sh
new file mode 100644
index 0000000..d1b255d
--- /dev/null
+++ b/hyperterm/tools/ruby.sh
@@ -0,0 +1,10 @@
+#!/bin/bash
+
+if [ -x /usr/bin/ruby ]; then
+ # Variable de Entorno para Sass
+ # Sass
+ _ruby="$(ruby -r rubygems -e "puts Gem.user_dir")/bin"
+ if [ -s "$_ruby" ]; then
+ export PATH+=:$_ruby
+ fi
+fi
diff --git a/hyperterm/tools/ssh-agent.sh b/hyperterm/tools/ssh-agent.sh
new file mode 100644
index 0000000..4c24ba5
--- /dev/null
+++ b/hyperterm/tools/ssh-agent.sh
@@ -0,0 +1,105 @@
+#!/bin/bash
+
+#------------
+# SSH-AGENT
+#------------
+function sshagent_start {
+
+ # clean previous ssh credentials
+ (rm -rf /tmp/ssh-* > /dev/null)
+
+ SSH_ENV="$HOME/.ssh/environment"
+ printf '\e[1;36m%s\e[m\n' "Initialising new SSH agent..."
+ ssh-agent | sed 's/^echo/#echo/' > "${SSH_ENV}"
+ chmod 600 "${SSH_ENV}"
+ # shellcheck source=/dev/null
+ source "${SSH_ENV}" > /dev/null
+ ssh-add -t 5d
+ printf '\e[1;36m%s\e[m\n' "succeeded"
+}
+
+function sshagent_stop {
+
+ # clean previous ssh credentials
+ (rm -rf /tmp/ssh-* > /dev/null)
+
+ ssh-agent -k > /dev/null
+}
+
+function sshagent_findsockets {
+ find /tmp -uid "$(id -u)" -type s -name agent.\* 2>/dev/null
+}
+
+function sshagent_testsocket {
+ if [ ! -x "$(command -v ssh-add)" ] ; then
+ echo "ssh-add is not available; agent testing aborted"
+ return 1
+ fi
+
+ if [ X"$1" != X ] ; then
+ export SSH_AUTH_SOCK=$1
+ fi
+
+ if [ X"$SSH_AUTH_SOCK" = X ] ; then
+ return 2
+ fi
+
+ if [ -S "$SSH_AUTH_SOCK" ] ; then
+ ssh-add -l > /dev/null
+ if [ $? = 2 ] ; then
+ echo "Socket $SSH_AUTH_SOCK is dead! Deleting!"
+ rm -f "$SSH_AUTH_SOCK"
+ return 4
+ else
+ echo "Found ssh-agent $SSH_AUTH_SOCK"
+ return 0
+ fi
+ else
+ echo "$SSH_AUTH_SOCK is not a socket!"
+ return 3
+ fi
+}
+
+function sshagent_reload {
+ # ssh agent sockets can be attached to a ssh daemon process or an
+ # ssh-agent process.
+
+ AGENTFOUND=0
+
+ # Attempt to find and use the ssh-agent in the current environment
+ if sshagent_testsocket ; then AGENTFOUND=1 ; fi
+
+ # If there is no agent in the environment, search /tmp for
+ # possible agents to reuse before starting a fresh ssh-agent
+ # process.
+ if [ $AGENTFOUND = 0 ] ; then
+ for agentsocket in $(sshagent_findsockets) ; do
+ if [ $AGENTFOUND != 0 ] ; then break ; fi
+ if sshagent_testsocket "$agentsocket" ; then AGENTFOUND=1 ; fi
+ done
+ fi
+
+ # If at this point we still haven't located an agent, it's time to
+ # start a new one
+ if [ $AGENTFOUND = 0 ] ; then
+ eval "$(ssh-agent)"
+ fi
+
+ # Clean up
+ unset AGENTFOUND
+ unset agentsocket
+
+ # Finally, show what keys are currently in the agent
+ ssh-add -l
+}
+
+if [[ -f "$HOME/.ssh/environment" ]]; then
+ sshagent_reload > /dev/null
+fi
+
+# Alias agents
+alias sagent_start="sshagent_start"
+alias sagent_stop="sshagent_stop"
+
+# Clean up not global functions
+unset -f sshagent_findsockets sshagent_testsocket
diff --git a/hyperterm/tools/sysinfo.sh b/hyperterm/tools/sysinfo.sh
new file mode 100644
index 0000000..5a51168
--- /dev/null
+++ b/hyperterm/tools/sysinfo.sh
@@ -0,0 +1,36 @@
+#!/bin/bash
+
+# System information
+function ii() {
+
+ my_ip "$1" &> /dev/null
+
+ case ${LANG/_*/} in
+ es)
+ printf '%s\e[1;36m%s\e[m\n' "Has iniciado sesión en " "$(hostname -f)"
+ printf '\n\e[1;32m%s\e[m\n%s\n' "Información adicional:" "$(uname -a)"
+ printf '\n\e[1;32m%s\e[m\n%s\n' "Usuarios Conectados:" "$(who -u)"
+ printf '\n\e[1;32m%s\e[m\n%s\n' "Fecha actual:" "$(date)"
+ printf '\n\e[1;32m%s\e[m\n%s\n' "Estadísticas de la máquina:" "$(uptime)"
+ printf '\n\e[1;32m%s\e[m\n%s\n' "Estadísticas de la memoria:" "$(free)"
+ printf '\n\e[1;32m%s\e[m\n' "Dirección IP Local:"
+ printf '%s\n' "${MY_IP:-"No conectado"}"
+ my_isp "$1" &> /dev/null
+ printf '\n\e[1;32m%s\e[m\n' "Dirección ISP:"
+ printf '%s\n' "${MY_ISP:-"No conectado"}"
+ ;;
+ *)
+ printf '%s\e[1;36m%s\e[m\n' "You are logged on " "$(hostname -f)"
+ printf '\n\e[1;32m%s\e[m\n%s\n' "Additionnal information:" "$(uname -a)"
+ printf '\n\e[1;32m%s\e[m\n%s\n' "Users logged:" "$(who -u)"
+ printf '\n\e[1;32m%s\e[m\n%s\n' "Current date:" "$(date)"
+ printf '\n\e[1;32m%s\e[m\n%s\n' "Machine stats:" "$(uptime)"
+ printf '\n\e[1;32m%s\e[m\n%s\n' "Memory stats:" "$(free)"
+ printf '\n\e[1;32m%s\e[m\n' "Local IP Address:"
+ printf '%s\n' "${MY_IP:-"Not connected"}"
+ my_isp "$1" &> /dev/null
+ printf '\n\e[1;32m%s\e[m\n' "ISP Address:"
+ printf '%s\n' "${MY_ISP:-"Not connected"}"
+ ;;
+ esac
+}
diff --git a/hyperterm/tools/vconverter.sh b/hyperterm/tools/vconverter.sh
new file mode 100644
index 0000000..f240a06
--- /dev/null
+++ b/hyperterm/tools/vconverter.sh
@@ -0,0 +1,72 @@
+#!/bin/bash
+
+# Converter videos to WebM-VP9
+# ------------------------------
+function vtovp9() {
+
+ if [[ -f "$1" && -x "$(command -v ffmpeg)" ]] ; then
+ case "$1" in
+ *.asf) ffmpeg -i "$1" -c:v libvpx-vp9 -crf 33 -threads 8 -b:v 0 -b:a 128k -c:a libopus -map_metadata -1 "${1%.asf}".webm ;;
+ *.avi) ffmpeg -i "$1" -c:v libvpx-vp9 -crf 33 -threads 8 -b:v 0 -b:a 128k -c:a libopus -map_metadata -1 "${1%.avi}".webm ;;
+ *.flv) ffmpeg -i "$1" -c:v libvpx-vp9 -crf 33 -threads 8 -b:v 0 -b:a 128k -c:a libopus -map_metadata -1 "${1%.flv}".webm ;;
+ *.mkv) ffmpeg -i "$1" -c:v libvpx-vp9 -crf 33 -threads 8 -b:v 0 -b:a 128k -c:a libopus -map_metadata -1 "${1%.mkv}".webm ;;
+ *.mov) ffmpeg -i "$1" -c:v libvpx-vp9 -crf 33 -threads 8 -b:v 0 -b:a 128k -c:a libopus -map_metadata -1 "${1%.mov}".webm ;;
+ *.mp4) ffmpeg -i "$1" -c:v libvpx-vp9 -crf 33 -threads 8 -b:v 0 -b:a 128k -c:a libopus -map_metadata -1 "${1%.mp4}".webm ;;
+ *.mpg) ffmpeg -i "$1" -c:v libvpx-vp9 -crf 33 -threads 8 -b:v 0 -b:a 128k -c:a libopus -map_metadata -1 "${1%.mpg}".webm ;;
+ *.ogv) ffmpeg -i "$1" -c:v libvpx-vp9 -crf 33 -threads 8 -b:v 0 -b:a 128k -c:a libopus -map_metadata -1 "${1%.ogv}".webm ;;
+ *.webm) ffmpeg -i "$1" -c:v libvpx-vp9 -crf 33 -threads 8 -b:v 0 -b:a 128k -c:a libopus -map_metadata -1 "${1%.webm}".webm ;;
+ *.wmv) ffmpeg -i "$1" -c:v libvpx-vp9 -crf 33 -threads 8 -b:v 0 -b:a 128k -c:a libopus -map_metadata -1 "${1%.wmv}".webm ;;
+ *) msg_err "El formato de '$1' no esta listado :(" \
+ "The format of '$1' is not listed :("
+ return 1 ;;
+ esac
+ else
+ msg_err "Error, este no es un archivo de vídeo válido" \
+ "Error, this is not a valid video file"
+ return 1
+ fi
+
+}
+
+# Converter all videos to WebM-VP9
+# --------------------------------
+function alltovp9() {
+
+ if [[ -x "$(command -v rename)" ]]; then
+ # lowercase
+ for j in ASF AVI FLV MKV MOV MP4 MPG M2TS OGV VOB WMV ;
+ do
+ rename ."$j" ."${j,,}" -- *."$j" 2&> /dev/null
+ done
+ fi
+
+ sleep 1
+
+ if [[ -x "$(command -v ffmpeg)" ]]; then
+ for FILE_NAME in *
+ do
+ if [[ -f "$FILE_NAME" ]]; then
+ case "$FILE_NAME" in
+ *.asf) ffmpeg -i "$FILE_NAME" -c:v libvpx-vp9 -crf 33 -threads 8 -b:v 0 -b:a 128k -c:a libopus -map_metadata -1 "${FILE_NAME%.asf}".webm ;;
+ *.avi) ffmpeg -i "$FILE_NAME" -c:v libvpx-vp9 -crf 33 -threads 8 -b:v 0 -b:a 128k -c:a libopus -map_metadata -1 "${FILE_NAME%.avi}".webm ;;
+ *.flv) ffmpeg -i "$FILE_NAME" -c:v libvpx-vp9 -crf 33 -threads 8 -b:v 0 -b:a 128k -c:a libopus -map_metadata -1 "${FILE_NAME%.flv}".webm ;;
+ *.mkv) ffmpeg -i "$FILE_NAME" -c:v libvpx-vp9 -crf 33 -threads 8 -b:v 0 -b:a 128k -c:a libopus -map_metadata -1 "${FILE_NAME%.mkv}".webm ;;
+ *.mov) ffmpeg -i "$FILE_NAME" -c:v libvpx-vp9 -crf 33 -threads 8 -b:v 0 -b:a 128k -c:a libopus -map_metadata -1 "${FILE_NAME%.mov}".webm ;;
+ *.mp4) ffmpeg -i "$FILE_NAME" -c:v libvpx-vp9 -crf 33 -threads 8 -b:v 0 -b:a 128k -c:a libopus -map_metadata -1 "${FILE_NAME%.mp4}".webm ;;
+ *.mpg) ffmpeg -i "$FILE_NAME" -c:v libvpx-vp9 -crf 33 -threads 8 -b:v 0 -b:a 128k -c:a libopus -map_metadata -1 "${FILE_NAME%.mpg}".webm ;;
+ *.m2ts) ffmpeg -i "$FILE_NAME" -c:v libvpx-vp9 -crf 33 -threads 8 -b:v 0 -b:a 128k -c:a libopus -map_metadata -1 "${FILE_NAME%.m2ts}".webm ;;
+ *.ogv) ffmpeg -i "$FILE_NAME" -c:v libvpx-vp9 -crf 33 -threads 8 -b:v 0 -b:a 128k -c:a libopus -map_metadata -1 "${FILE_NAME%.ogv}".webm ;;
+ *.vob) ffmpeg -i "$FILE_NAME" -c:v libvpx-vp9 -crf 33 -threads 8 -b:v 0 -b:a 128k -c:a libopus -map_metadata -1 "${FILE_NAME%.vob}".webm ;;
+ *.wmv) ffmpeg -i "$FILE_NAME" -c:v libvpx-vp9 -crf 33 -threads 8 -b:v 0 -b:a 128k -c:a libopus -map_metadata -1 "${FILE_NAME%.wmv}".webm ;;
+ # Warnnig messages
+ *.webm) printf '\e[1;36m%s\e[m\n' "Saltando '$FILE_NAME', ya está en formato WebM" ;;
+ *) printf '\e[1;36m%s\e[m\n' "El formato de '$FILE_NAME' no esta listado" ;;
+ esac
+ fi
+ done
+ else
+ msg_err "No esta instalado ffmpeg" \
+ "ffmpeg is not installed"
+ return 1
+ fi
+}
diff --git a/hyperterm/tools/virtualenv.sh b/hyperterm/tools/virtualenv.sh
new file mode 100644
index 0000000..c0bb5db
--- /dev/null
+++ b/hyperterm/tools/virtualenv.sh
@@ -0,0 +1,6 @@
+#!/bin/bash
+# shellcheck disable=SC1090
+# Python virtualenv
+function activate() {
+ source "$1/bin/activate"
+}