Compare commits

..

5 Commits

Author SHA1 Message Date
94df267831 Some aliases moved to utils 2025-12-08 17:04:11 +08:00
9ca95f6353 git: include ~/.git_aliases.extra 2025-11-24 19:29:35 +08:00
Антон Аксенов
cf5d7a0877 shell misc 2025-11-14 18:29:06 +08:00
ec03e01dbb fix terminal font for vscode 2025-11-14 10:51:53 +08:00
c6ca5271e8 case tar.xz in extract util 2025-11-14 10:51:22 +08:00
27 changed files with 123 additions and 75 deletions

View File

@@ -22,4 +22,4 @@ Target (`-t`) defaults to the parent of `pwd`, so if you clone this repo not in
* <https://www.gnu.org/software/stow/manual/stow.html>
* <https://tamerlan.dev/how-i-manage-my-dotfiles-using-gnu-stow/>
* <https://gist.github.com/andreibosco/cb8506780d0942a712fc>
* https://github.com/jimeh/git-aware-stow
* <https://github.com/jimeh/git-aware-stow>

View File

@@ -21,5 +21,7 @@
prune = true
[include]
path = ~/.git_aliases
[include]
path = ~/.git_aliases.extra
[include]
path = ~/.gitconfig.extra ; use this file to store other personal settings and aliases

View File

@@ -1,18 +1,20 @@
#!/usr/bin/env bash
# alias bashrc='source ~/.bashrc'
alias aliases='cat ~/.bash_aliases'
alias bashrc='source ~/.bashrc'
alias zshrc='source ~/.zshrc'
# alias aliases='cat ~/.bash_aliases' # use 'alias' instead (without args)
alias realias='source ~/.bash_aliases'
alias stow="stow -v"
alias unstow="stow -D"
alias restow="stow -R"
alias reload='exec ${SHELL} -l'
alias sudo='sudo ' # enable aliases to be sudoed
alias sudo='sudo ' # enable aliases to be sudo'ed
alias g='git'
alias hosts="sudo nano /etc/hosts"
alias shrug="echo '¯\_(ツ)_/¯' | xclip -selection c"
alias up='cd ..'
alias back='cd -'
alias ..='cd ..' # zsh builtin
alias ~='cd ~' # zsh builtin
alias -- -='cd -' # zsh builtin
@@ -34,31 +36,20 @@ alias where='whereis' # zsh builtin
alias ps='ps auxf'
alias psg='ps aux | grep -v grep | grep -i -e VSZ -e'
alias is='type -a'
alias upgrade='sudo apt update && sudo apt upgrade -y && sudo snap refresh'
alias wine='LANG=ru_RU.utf8 wine'
alias wine64='LANG=ru_RU.utf8 wine64'
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 pubkey="more ~/.ssh/id_ed25519.pub | xclip -selection clipboard | echo '=> Public key copied to pasteboard.'"
alias ssh.pub="cat ~/.ssh/*.pub"
alias gpg.new="gpg --full-generate-key"
alias gpg.pub="gpg --armor --export"
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 lite-xl="LITE_SCALE=1 lite-xl"
alias wine='LANG=ru_RU.utf8 wine'
alias docker.prune='docker image prune -f; docker network prune -f; docker container prune -f'
# 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/
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'"
# Download music from Youtube or Youtube Music
# and save as top quality flac file without video
@@ -76,7 +67,6 @@ ytm() {
"$@"
}
docker.ip() {
if [ "$1" ]; then
if [ "$1" = "-a" ]; then
@@ -85,7 +75,7 @@ docker.ip() {
| sed -e 's#^/##' \
| column -t
elif [ "$1" = "-c" ]; then
docker-compose ps -q \
docker compose ps -q \
| xargs -n 1 docker inspect --format '{{.Name}}{{range .NetworkSettings.Networks}} {{.IPAddress}}{{end}}' \
| sed -e 's#^/##' \
| column -t

View File

@@ -16,35 +16,29 @@ fi
### AAA ##########################################
[ -f ~/.bash_aliases ] && source ~/.bash_aliases
[ -f ~/.profile.extra ] && source ~/.profile.extra
export LITE_SCALE=1 # workaround https://github.com/lite-xl/lite-xl/issues/1173
export JAVA_HOME="/usr/bin/"
export PATH="/opt/nvim/bin:$PATH"
export PATH="$HOME/.local/bin/:$PATH"
export PATH="$HOME/.local/share/JetBrains/Toolbox/scripts:$PATH"
export PATH="$(composer config -g home)/vendor/bin:$PATH"
export PATH="$PATH:/opt/nvim/bin/"
export PATH="$PATH:$HOME/.local/bin/"
export PATH="$PATH:$HOME/.local/share/JetBrains/Toolbox/scripts/"
if hash composer >/dev/null; then
composer_home=$(composer config -g home 2>/dev/null)
export PATH="$PATH:$composer_home/vendor/bin"
fi
# phpbrew
# export PHPBREW_SET_PROMPT=1
# export PHPBREW_RC_ENABLE=1
# [ -f ~/.phpbrew/bashrc ] && source ~/.phpbrew/bashrc
# [ -f $HOME/.phpbrew/bashrc ] && source $HOME/.phpbrew/bashrc
# golang
export PATH="/usr/local/go/bin:$PATH"
export PATH="$PATH:/usr/local/go/bin"
export GOPATH="$HOME/.go"
# rust cargo
[ -f ~/.cargo/env ] && source ~/.cargo/env
[ -f "$HOME/.cargo/env" ] && source "$HOME/.cargo/env"
# nvm
# export NVM_DIR="$HOME/.nvm"
# [ -s "$NVM_DIR/nvm.sh" ] && source "$NVM_DIR/nvm.sh" # This loads nvm
# [ -s "$NVM_DIR/bash_completion" ] && source "$NVM_DIR/bash_completion" # This loads nvm bash_completion
# neovim
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
@@ -55,3 +49,5 @@ export NVM_DIR="$HOME/.nvm"
# The next line enables shell command completion for yc.
[ -f "$HOME/yandex-cloud/completion.zsh.inc" ] && source "$HOME/yandex-cloud/completion.zsh.inc"
# misc
[[ -f $HOME/.profile.extra ]] && source $HOME/.profile.extra

View File

@@ -77,7 +77,7 @@ ZSH_THEME="powerlevel10k/powerlevel10k"
# Custom plugins may be added to $ZSH_CUSTOM/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
plugins=(git docker docker-compose composer zsh-autosuggestions zsh-syntax-highlighting)
plugins=(git docker docker-compose composer zsh-autosuggestions zsh-syntax-highlighting laravel)
source $ZSH/oh-my-zsh.sh

View File

@@ -1,6 +1,5 @@
#!/usr/bin/env bash
set -e
set -u
set -eo pipefail
if hash pbcopy 2>/dev/null; then
exec pbcopy

22
utils/.local/bin/curlstat Executable file
View 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

View File

@@ -1,8 +1,11 @@
#!/usr/bin/env bash
set -eo pipefail
if [ -f "$1" ]; then
case "$1" in
*.tar.bz2) tar -jxvf "$1" ;;
*.tar.gz) tar -zxvf "$1" ;;
*.tar.xz) tar -Jxvf "$1" ;;
*.bz2) bunzip2 "$1" ;;
*.dmg) hdiutil mount "$1" ;;
*.gz) gunzip "$1" ;;

View File

@@ -1,6 +1,5 @@
#!/usr/bin/env bash
set -e
set -u
set -euo pipefail
statuses="100 Continue
101 Switching Protocols

4
utils/.local/bin/is Executable file
View File

@@ -0,0 +1,4 @@
#!/usr/bin/env bash
set -eo pipefail
[ -n "$1" ] && command -v "$1" || exit 1

View File

@@ -1,5 +1,4 @@
#!/usr/bin/env bash
set -e
set -u
set -eo pipefail
echo -n "$@" | wc -c | awk '{print $1}'

View File

@@ -1,6 +1,5 @@
#!/usr/bin/env bash
set -e
set -u
set -eo pipefail
lineno="$1"; shift
sed -n "${lineno}p" -- "$@"

4
utils/.local/bin/mkcd Executable file
View File

@@ -0,0 +1,4 @@
#!/usr/bin/env bash
mkdir -p "$1"
cd "$1" || exit

View File

@@ -1,7 +1,5 @@
#!/usr/bin/env bash
set -e
set -u
set -o pipefail
set -eo pipefail
if [ ! $# -eq 1 ]; then
echo 'mksh takes one argument' 1>&2

4
utils/.local/bin/myip Executable file
View File

@@ -0,0 +1,4 @@
#!/usr/bin/env bash
curl http://ipecho.net/plain
echo

View File

@@ -1,6 +1,5 @@
#!/usr/bin/env bash
set -e
set -u
set -eo pipefail
if hash pbpaste 2>/dev/null; then
exec pbpaste

View File

@@ -1,6 +1,5 @@
#!/usr/bin/env bash
set -e
set -u
set -eo pipefail
process_list="$(ps -eo 'pid command')"
if [[ $# != 0 ]]; then

View File

@@ -1,7 +1,5 @@
#!/usr/bin/env bash
set -e
set -u
set -o pipefail
set -eo pipefail
file="$(mktemp)"
echo "Editing $file"

View File

@@ -1,7 +1,5 @@
#!/usr/bin/env bash
set -e
set -u
set -o pipefail
set -eo pipefail
port='8888'
if [ $# -eq 1 ]; then

View File

@@ -1,7 +1,5 @@
#!/usr/bin/env bash
set -e
set -u
set -o pipefail
set -eo pipefail
sleep "$1"
notify-send 'Timer complete!' \

View File

@@ -1,6 +1,3 @@
#!/usr/bin/env bash
set -e
set -u
set -o pipefail
gio trash "$@"

30
utils/.local/bin/upgrade Executable file
View 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
}

View File

@@ -1,7 +1,5 @@
#!/usr/bin/env bash
set -e
set -u
set -o pipefail
set -eo pipefail
curl "https://r.jina.ai/$1" \
-sS \

View File

@@ -1,7 +1,5 @@
#!/usr/bin/env bash
set -e
set -u
set -o pipefail
set -eo pipefail
if hash systemd-inhibit 2>/dev/null; then
systemd-inhibit \

14
utils/.local/bin/what Executable file
View 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"

View File

@@ -102,7 +102,7 @@
// terminal
//----------------------------------------------------------------
"terminal.integrated.fontFamily": "Jetbrains Mono, MesloLGS NF, Ubuntu Mono",
"terminal.integrated.fontFamily": "JetBrainsMono Nerd Font, MesloLGS NF, Ubuntu Mono",
"terminal.integrated.fontSize": 13,
"terminal.integrated.cursorStyle": "line",
"terminal.integrated.defaultProfile.linux": "zsh",

View File

@@ -4,7 +4,7 @@ include "%L"
<Multi_key> <Cyrillic_ha> <Cyrillic_ze> : "¯\\_(ツ)_/¯" # хз
<Multi_key> <Cyrillic_sha> <Cyrillic_te> <Cyrillic_o> <Cyrillic_sha> : "¯\\_(ツ)_/¯" # штош
<Multi_key> <Cyrillic_ne> <Cyrillic_u> <Cyrillic_sha> <Cyrillic_te> <Cyrillic_o> <Cyrillic_sha> : "¯\\_(ツ)_/¯" # нуштош
<Multi_key> <Cyrillic_ne> <Cyrillic_u> <space> <Cyrillic_sha> <Cyrillic_te> <Cyrillic_o> <Cyrillic_sha> : "¯\\_(ツ)_/¯" # нуштош
<Multi_key> <Cyrillic_ne> <Cyrillic_u> <space> <Cyrillic_sha> <Cyrillic_te> <Cyrillic_o> <Cyrillic_sha> : "¯\\_(ツ)_/¯" # ну штош
# ударения
<Multi_key> <Cyrillic_A> <Cyrillic_A> : "А́" # CYRILLIC CAPITAL LETTER A plus COMBINING ACUTE --- AAA