Some aliases moved to utils
This commit is contained in:
@@ -13,6 +13,8 @@ alias g='git'
|
|||||||
alias hosts="sudo nano /etc/hosts"
|
alias hosts="sudo nano /etc/hosts"
|
||||||
alias shrug="echo '¯\_(ツ)_/¯' | xclip -selection c"
|
alias shrug="echo '¯\_(ツ)_/¯' | xclip -selection c"
|
||||||
|
|
||||||
|
alias up='cd ..'
|
||||||
|
alias back='cd -'
|
||||||
alias ..='cd ..' # zsh builtin
|
alias ..='cd ..' # zsh builtin
|
||||||
alias ~='cd ~' # zsh builtin
|
alias ~='cd ~' # zsh builtin
|
||||||
alias -- -='cd -' # zsh builtin
|
alias -- -='cd -' # zsh builtin
|
||||||
@@ -34,43 +36,20 @@ alias where='whereis' # zsh builtin
|
|||||||
alias ps='ps auxf'
|
alias ps='ps auxf'
|
||||||
alias psg='ps aux | grep -v grep | grep -i -e VSZ -e'
|
alias psg='ps aux | grep -v grep | grep -i -e VSZ -e'
|
||||||
|
|
||||||
alias is='type -a'
|
alias wine='LANG=ru_RU.utf8 wine'
|
||||||
alias upgrade='sudo apt update && sudo apt upgrade -y && sudo snap refresh'
|
alias wine64='LANG=ru_RU.utf8 wine64'
|
||||||
|
|
||||||
alias untargz='tar -czf'
|
alias untargz='tar -czf'
|
||||||
alias mkcd="mkdir -p $1 && cd $1"
|
|
||||||
alias cl="cd $1 && ll"
|
|
||||||
alias myip='curl http://ipecho.net/plain; echo'
|
|
||||||
alias ports='netstat -tulpan'
|
alias ports='netstat -tulpan'
|
||||||
|
|
||||||
|
# alias pubkey="more ~/.ssh/id_ed25519.pub | xclip -selection clipboard | echo '=> Public key copied to pasteboard.'"
|
||||||
alias ssh.pub="cat ~/.ssh/*.pub"
|
alias ssh.pub="cat ~/.ssh/*.pub"
|
||||||
alias gpg.new="gpg --full-generate-key"
|
alias gpg.new="gpg --full-generate-key"
|
||||||
alias gpg.pub="gpg --armor --export"
|
alias gpg.pub="gpg --armor --export"
|
||||||
alias gpg.list='gpg --list-keys --keyid-format SHORT'
|
alias gpg.list='gpg --list-keys --keyid-format SHORT'
|
||||||
|
|
||||||
# alias pubkey="more ~/.ssh/id_ed25519.pub | xclip -selection clipboard | echo '=> Public key copied to pasteboard.'"
|
|
||||||
|
|
||||||
alias wine='LANG=ru_RU.utf8 wine'
|
|
||||||
alias wine64='LANG=ru_RU.utf8 wine64'
|
|
||||||
|
|
||||||
# Add an "alert" alias for long running commands. Use like so:
|
|
||||||
# sleep 10; alert
|
|
||||||
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'
|
|
||||||
|
|
||||||
# https://obsproject.com/forum/threads/how-to-start-virtual-camera-without-sudo-privileges.139783/
|
# https://obsproject.com/forum/threads/how-to-start-virtual-camera-without-sudo-privileges.139783/
|
||||||
alias obscam="sudo modprobe v4l2loopback video_nr=2 card_label='OBS Virtual Camera'"
|
# alias obscam="sudo modprobe v4l2loopback video_nr=2 card_label='OBS Virtual Camera'"
|
||||||
|
|
||||||
curltime() {
|
|
||||||
curl -w @- -o /dev/null -s "$@" <<'EOF'
|
|
||||||
time_namelookup: %{time_namelookup} sec\n
|
|
||||||
time_connect: %{time_connect} sec\n
|
|
||||||
time_appconnect: %{time_appconnect} sec\n
|
|
||||||
time_pretransfer: %{time_pretransfer} sec\n
|
|
||||||
time_redirect: %{time_redirect} sec\n
|
|
||||||
time_starttransfer: %{time_starttransfer} sec\n
|
|
||||||
---------------\n
|
|
||||||
time_total: %{time_total} sec\n
|
|
||||||
EOF
|
|
||||||
}
|
|
||||||
|
|
||||||
# Download music from Youtube or Youtube Music
|
# Download music from Youtube or Youtube Music
|
||||||
# and save as top quality flac file without video
|
# and save as top quality flac file without video
|
||||||
@@ -88,7 +67,6 @@ ytm() {
|
|||||||
"$@"
|
"$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
docker.ip() {
|
docker.ip() {
|
||||||
if [ "$1" ]; then
|
if [ "$1" ]; then
|
||||||
if [ "$1" = "-a" ]; then
|
if [ "$1" = "-a" ]; then
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -e
|
set -eo pipefail
|
||||||
set -u
|
|
||||||
|
|
||||||
if hash pbcopy 2>/dev/null; then
|
if hash pbcopy 2>/dev/null; then
|
||||||
exec pbcopy
|
exec pbcopy
|
||||||
|
|||||||
22
utils/.local/bin/curlstat
Executable file
22
utils/.local/bin/curlstat
Executable file
@@ -0,0 +1,22 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -eo pipefail
|
||||||
|
|
||||||
|
curl -sLw @- -o /dev/null "$@" <<'EOF'
|
||||||
|
URL:\t\t\t%{url}\n
|
||||||
|
Address:\t\t%{remote_ip}:%{remote_port}\n
|
||||||
|
Response:\t\tHTTP/%{http_version} %{http_code}\n
|
||||||
|
\n
|
||||||
|
Speed:\n
|
||||||
|
* speed_download:\t%{speed_download} b/s\n
|
||||||
|
* speed_upload:\t\t%{speed_upload} b/s\n
|
||||||
|
\n
|
||||||
|
Timings:\n
|
||||||
|
* time_namelookup:\t%{time_namelookup} sec\n
|
||||||
|
* time_connect:\t\t%{time_connect} sec\n
|
||||||
|
* time_appconnect:\t%{time_appconnect} sec\n
|
||||||
|
* time_pretransfer:\t%{time_pretransfer} sec\n
|
||||||
|
* time_redirect:\t%{time_redirect} sec\n
|
||||||
|
* time_starttransfer:\t%{time_starttransfer} sec\n
|
||||||
|
\t\t\t------------\n
|
||||||
|
* time_total:\t\t%{time_total} sec\n
|
||||||
|
EOF
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
set -eo pipefail
|
||||||
|
|
||||||
if [ -f "$1" ]; then
|
if [ -f "$1" ]; then
|
||||||
case "$1" in
|
case "$1" in
|
||||||
*.tar.bz2) tar -jxvf "$1" ;;
|
*.tar.bz2) tar -jxvf "$1" ;;
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -e
|
set -euo pipefail
|
||||||
set -u
|
|
||||||
|
|
||||||
statuses="100 Continue
|
statuses="100 Continue
|
||||||
101 Switching Protocols
|
101 Switching Protocols
|
||||||
|
|||||||
4
utils/.local/bin/is
Executable file
4
utils/.local/bin/is
Executable file
@@ -0,0 +1,4 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -eo pipefail
|
||||||
|
|
||||||
|
[ -n "$1" ] && command -v "$1" || exit 1
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -e
|
set -eo pipefail
|
||||||
set -u
|
|
||||||
|
|
||||||
echo -n "$@" | wc -c | awk '{print $1}'
|
echo -n "$@" | wc -c | awk '{print $1}'
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -e
|
set -eo pipefail
|
||||||
set -u
|
|
||||||
|
|
||||||
lineno="$1"; shift
|
lineno="$1"; shift
|
||||||
sed -n "${lineno}p" -- "$@"
|
sed -n "${lineno}p" -- "$@"
|
||||||
|
|||||||
4
utils/.local/bin/mkcd
Executable file
4
utils/.local/bin/mkcd
Executable file
@@ -0,0 +1,4 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
mkdir -p "$1"
|
||||||
|
cd "$1" || exit
|
||||||
@@ -1,7 +1,5 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -e
|
set -eo pipefail
|
||||||
set -u
|
|
||||||
set -o pipefail
|
|
||||||
|
|
||||||
if [ ! $# -eq 1 ]; then
|
if [ ! $# -eq 1 ]; then
|
||||||
echo 'mksh takes one argument' 1>&2
|
echo 'mksh takes one argument' 1>&2
|
||||||
|
|||||||
4
utils/.local/bin/myip
Executable file
4
utils/.local/bin/myip
Executable file
@@ -0,0 +1,4 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
curl http://ipecho.net/plain
|
||||||
|
echo
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -e
|
set -eo pipefail
|
||||||
set -u
|
|
||||||
|
|
||||||
if hash pbpaste 2>/dev/null; then
|
if hash pbpaste 2>/dev/null; then
|
||||||
exec pbpaste
|
exec pbpaste
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -e
|
set -eo pipefail
|
||||||
set -u
|
|
||||||
|
|
||||||
process_list="$(ps -eo 'pid command')"
|
process_list="$(ps -eo 'pid command')"
|
||||||
if [[ $# != 0 ]]; then
|
if [[ $# != 0 ]]; then
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -e
|
set -eo pipefail
|
||||||
set -u
|
|
||||||
set -o pipefail
|
|
||||||
|
|
||||||
file="$(mktemp)"
|
file="$(mktemp)"
|
||||||
echo "Editing $file"
|
echo "Editing $file"
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -e
|
set -eo pipefail
|
||||||
set -u
|
|
||||||
set -o pipefail
|
|
||||||
|
|
||||||
port='8888'
|
port='8888'
|
||||||
if [ $# -eq 1 ]; then
|
if [ $# -eq 1 ]; then
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -e
|
set -eo pipefail
|
||||||
set -u
|
|
||||||
set -o pipefail
|
|
||||||
|
|
||||||
sleep "$1"
|
sleep "$1"
|
||||||
notify-send 'Timer complete!' \
|
notify-send 'Timer complete!' \
|
||||||
|
|||||||
@@ -1,6 +1,3 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -e
|
|
||||||
set -u
|
|
||||||
set -o pipefail
|
|
||||||
|
|
||||||
gio trash "$@"
|
gio trash "$@"
|
||||||
|
|||||||
30
utils/.local/bin/upgrade
Executable file
30
utils/.local/bin/upgrade
Executable file
@@ -0,0 +1,30 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -eo pipefail
|
||||||
|
|
||||||
|
is apt >/dev/null && {
|
||||||
|
echo
|
||||||
|
echo "==========================="
|
||||||
|
echo "Upgarding apt packages..."
|
||||||
|
echo "==========================="
|
||||||
|
echo
|
||||||
|
sudo apt update
|
||||||
|
sudo apt upgrade -y
|
||||||
|
}
|
||||||
|
|
||||||
|
is snap >/dev/null && {
|
||||||
|
echo
|
||||||
|
echo "==========================="
|
||||||
|
echo "Upgarding snap packages..."
|
||||||
|
echo "==========================="
|
||||||
|
echo
|
||||||
|
sudo snap refresh
|
||||||
|
}
|
||||||
|
|
||||||
|
is flatpak >/dev/null && {
|
||||||
|
echo
|
||||||
|
echo "==========================="
|
||||||
|
echo "Upgarding flatpak packages..."
|
||||||
|
echo "==========================="
|
||||||
|
echo
|
||||||
|
sudo flatpak update -y
|
||||||
|
}
|
||||||
@@ -1,7 +1,5 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -e
|
set -eo pipefail
|
||||||
set -u
|
|
||||||
set -o pipefail
|
|
||||||
|
|
||||||
curl "https://r.jina.ai/$1" \
|
curl "https://r.jina.ai/$1" \
|
||||||
-sS \
|
-sS \
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -e
|
set -eo pipefail
|
||||||
set -u
|
|
||||||
set -o pipefail
|
|
||||||
|
|
||||||
if hash systemd-inhibit 2>/dev/null; then
|
if hash systemd-inhibit 2>/dev/null; then
|
||||||
systemd-inhibit \
|
systemd-inhibit \
|
||||||
|
|||||||
14
utils/.local/bin/what
Executable file
14
utils/.local/bin/what
Executable file
@@ -0,0 +1,14 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -x
|
||||||
|
|
||||||
|
type "$1" 2>/dev/null
|
||||||
|
type -t "$1" 2>/dev/null
|
||||||
|
type -a "$1" 2>/dev/null
|
||||||
|
type -P "$1" 2>/dev/null
|
||||||
|
which -a "$1" 2>/dev/null
|
||||||
|
which "$1" \
|
||||||
|
&& file -b "$(which "$1")" \
|
||||||
|
&& file -L "$(which "$1")"
|
||||||
|
type -a "$1" 2>/dev/null
|
||||||
|
command -v "$1"
|
||||||
|
whereis "$1"
|
||||||
Reference in New Issue
Block a user