Compare commits

68 Commits

Author SHA1 Message Date
b2e78c43d1 wip4 2026-02-16 17:28:48 +08:00
d13a8a44d1 change-amd-driver added 2026-02-16 17:26:38 +08:00
edac0e49c4 ddns scripts updated 2026-02-16 17:25:18 +08:00
642522a01d frkn removed 2026-02-16 17:24:42 +08:00
daa8df5c77 fix postman icon in desktop file 2026-02-16 17:22:49 +08:00
c7449f4acb tools -> scripts 2025-11-14 10:44:57 +08:00
0493f18b18 Dotfiles moved to another repo: https://git.axenov.dev/anthony/dotfiles 2025-11-14 10:43:47 +08:00
b8ca9a8dad zshrc and xcompose 2025-11-03 21:21:31 +08:00
549b420df2 Добавлен vacuum 2025-10-30 06:00:39 +00:00
edf76874fc misc 2025-10-12 18:25:13 +08:00
95ad6b0c6a rustdesk 1.4.2 2025-10-12 18:24:30 +08:00
ff36975eb7 frkn deprecated 2025-07-10 23:46:19 +08:00
5ae19346d6 wine misc, albert removed 2025-07-09 00:15:25 +08:00
53ee621747 duckdns improved 2025-07-08 23:50:53 +08:00
dd339f2939 duckdns misc 2025-07-05 10:23:59 +08:00
e0fbdf852e duckdns 2025-07-02 13:29:40 +08:00
b5983ed308 sublime text 4200 2025-06-21 22:48:29 +08:00
f39af6d446 makefile 2025-06-18 19:51:07 +08:00
8fe3d112ba Merge branch 'master' of git.axenov.dev:anthony/shell 2025-06-18 19:50:45 +08:00
4c81bcea73 rustdesk flatpak + kde permission 2025-06-18 19:50:28 +08:00
5623d08d85 suld 2025-05-23 00:19:28 +08:00
0a369efe1b Merge branch 'master' of git.axenov.dev:anthony/shell 2025-05-21 20:26:41 +08:00
1640ebfb45 neovim + lazyvim 2025-05-21 20:26:23 +08:00
d2c561fc28 upgraded lite-xl 2025-05-19 00:30:08 +08:00
a920e48422 Revert "telebit misc"
This reverts commit abad965e9a.
2025-05-18 23:54:02 +08:00
0ed07de2d2 php misc 2025-05-18 23:27:42 +08:00
abad965e9a telebit misc 2025-05-18 23:27:19 +08:00
b5b0140e34 vscode repo 2025-05-14 23:42:02 +08:00
5d75b6f79e vivaldi repo + install 2025-05-14 23:41:50 +08:00
87fd722509 albert draft 2025-05-14 19:58:43 +08:00
eaacecd87a ulauncher update 2025-05-14 18:51:18 +08:00
4c57a180ac sublimetext update 2025-05-14 18:49:44 +08:00
96bd945ef2 disable-ipv6 2025-03-29 18:58:45 +08:00
49fd27d3be display-rotate 2025-03-29 18:56:46 +08:00
3c9f1d71cb flameshot build form src 2025-03-24 19:48:25 +08:00
3a226ed5bb git helpers misc 2025-03-24 19:47:30 +08:00
fe83b3eb25 readme update 2025-03-24 19:46:01 +08:00
a34dda20c7 uninstall wine 2025-03-24 17:21:08 +08:00
021db1064e ubuntu tools misc 2025-03-19 19:08:19 +08:00
b70b89433b Merge branch 'master' of git.axenov.dev:anthony/shell 2025-03-18 13:45:33 +08:00
8531543982 make-swapfile 2025-03-18 13:45:29 +08:00
e05b47ae52 ubuntu server scripts misc 2025-02-20 10:22:39 +08:00
e9a6f4ddda docker-volume-snapshot 2025-02-20 10:22:25 +08:00
cbb493b5c4 ClamAV (WIP) 2025-02-10 21:32:52 +08:00
31ddf3a6d2 notification helpers 2025-02-10 21:30:36 +08:00
47827282a9 free-space misc 2025-02-10 21:30:24 +08:00
16075cdd61 new links in readme 2025-02-08 13:25:52 +08:00
29e5c960de docker, network and others 2025-02-08 13:25:41 +08:00
526dade1f8 new help examples 2025-02-08 13:24:30 +08:00
66126167c8 io misc 2025-02-08 13:23:48 +08:00
3696cc06af new traps example 2025-02-08 13:23:32 +08:00
8da2059d1e basic.sh new functions 2025-02-08 13:19:16 +08:00
9da84a69f2 free-space misc 2025-02-08 12:10:23 +08:00
50bd28abe4 io misc 2025-02-05 18:58:42 +08:00
bbbc0de694 arg() снова исправлен вызов tr 2025-01-29 19:50:52 +08:00
9258398be4 Merge branch 'master' of git.axenov.dev:anthony/shell 2025-01-27 15:10:30 +08:00
a60374033c arg() исправлен вызов tr 2025-01-27 15:10:18 +08:00
bcae2fb4cf dotfiles misc 2025-01-21 00:06:37 +08:00
c808cce9cd sublime text dotfiles 2025-01-21 00:05:57 +08:00
bacd71304a Merge branch 'master' of git.axenov.dev:anthony/shell 2025-01-20 16:11:56 +08:00
6fee688968 arg-parser -- fix utf8 2025-01-20 16:11:46 +08:00
ebd30c8a50 youtube-dl misc 2025-01-18 00:46:27 +08:00
c4b2af8073 new shebangs 2025-01-17 19:07:28 +08:00
45499ca5df args-parser refactor 2025-01-17 19:07:08 +08:00
53d5a31a30 many io misc useful updates 2025-01-16 14:23:46 +08:00
1e0d54f5d6 some basic helpers 2025-01-16 14:23:19 +08:00
5d3004c87b docker helpers 2025-01-16 13:39:16 +08:00
14f3f2caf2 arg-parser fixes 2025-01-16 13:39:02 +08:00
172 changed files with 2613 additions and 1786 deletions

View File

@@ -1,4 +1,4 @@
# Autogenerated at 09.01.2025 15:37 using ./gen-makefile
# Autogenerated at 10.07.2025 23:45 using ./gen-makefile
.DEFAULT_GOAL := help
#===============================================
@@ -21,6 +21,10 @@ canon-mg2500:
chrome:
@./install/chrome
##clamav: ClamAV (WIP)
clamav:
@./install/clamav
##composer: Install composer (latest)
composer:
@./install/composer
@@ -45,9 +49,9 @@ droidcam-obs:
flameshot:
@./install/flameshot
##frkn: Install Wireguard + FRKN
frkn:
@./install/frkn
##frkn.deprecated: Install Wireguard + FRKN
frkn.deprecated:
@./install/frkn.deprecated
##git: Install git (latest)
git:
@@ -81,15 +85,11 @@ kde-file-templates:
kde-portal:
@./install/kde-portal
##lazynvim: <no description>
lazynvim:
@./install/lazynvim
##libreoffice: Install libreoffice
libreoffice:
@./install/libreoffice
##lite-xl: Install lite-xl
##lite-xl: Install lite-xl v2.1.7
lite-xl:
@./install/lite-xl
@@ -105,6 +105,10 @@ nodejs:
ntfy:
@./install/ntfy
##nvim: Install nvim + lazyvim
nvim:
@./install/nvim
##obs-studio: Install obs-studio (latest snap)
obs-studio:
@./install/obs-studio
@@ -129,7 +133,7 @@ papirus:
pgsql:
@./install/pgsql
##php: Install php v8.3 + ppa
##php: Install php v8.4
php:
@./install/php
@@ -165,10 +169,14 @@ postman:
qt5:
@./install/qt5
##rustdesk: Install rustdesk client v1.1.9 (deb)
##rustdesk: Install rustdesk client (flatpak)
rustdesk:
@./install/rustdesk
##rustdesk-deb: Install rustdesk client v1.4.0 (deb)
rustdesk-deb:
@./install/rustdesk-deb
##snap: Install bunch of software from snap
snap:
@./install/snap
@@ -181,6 +189,10 @@ sublimemerge:
sublimetext:
@./install/sublimetext
##suld: Samsung Unified Linux Driver repo
suld:
@./install/suld
##syncthing: Install syncthing (latest) + ppa
syncthing:
@./install/syncthing
@@ -205,7 +217,7 @@ vivaldi:
vscode:
@./install/vscode
##wine: Install wine (latest) + ppa (focal)
##wine: Install wine (latest) + ppa
wine:
@./install/wine
@@ -230,9 +242,6 @@ zsh:
# Scripts listed in ./packs
#===============================================
##flameshot: [TODO] [PACK] qt5 + flameshot from source
flameshot: qt5 flameshot-build
##lamp: [PACK] Apache + php + mariadb
lamp: apache phpstack mariadb
@@ -244,8 +253,8 @@ omz: zsh omz-clean omz-fancy
chsh -s /usr/bin/zsh
@exec zsh
##phptools: [PACK] Install only php tooling (composer, phpunit, psalm, phpcs, php-cs-fixer, php-spx, phpmd)
phptools: composer php-psalm php-spx phpcs phpmd phpstan phpunit
##phptools: [PACK] Install only php tooling (composer, phpunit, psalm, phpcs, php-cs-fixer, phpmd)
phptools: composer php-psalm phpcs phpmd phpstan phpunit
##phpstack: [PACK] Install full php stack with tooling
phpstack: php phptools
@@ -310,6 +319,10 @@ phpstack: php phptools
/vivaldi:
@./uninstall/vivaldi
##/wine: Uninstall wine
/wine:
@./uninstall/wine
#===============================================
# Service goals
#===============================================

View File

@@ -16,13 +16,13 @@ If some dependecies are missed for some of these scripts it is enougth to run `.
```shell
# with git
git clone git@git.axenov.dev:anthony/my-env.git --depth=1 --single-branch
git clone git@git.axenov.dev:anthony/shell.git --depth=1 --single-branch
# without git
wget -qO - https://git.axenov.dev/anthony/my-env/archive/master.tar.gz | tar -zxf -
wget -qO - https://git.axenov.dev/anthony/shell/archive/master.tar.gz | tar -zxf -
# get full list of `make` goals
cd my-env && make
cd shell && make
```
## How to add my script?
@@ -30,7 +30,7 @@ cd my-env && make
1. Create a new shell script in `./install`, `./upgrade` or `./uninstall` directory.
At the beggining of a file you must write these two lines:
```shell
#!/bin/bash
#!/usr/bin/env bash
##makedesc: Your description for Makefile
```
2. Make this script executable, e.g.:
@@ -85,6 +85,9 @@ where:
* https://lug.fh-swf.de/vim/vim-bash/StyleGuideShell.en.pdf
* https://www.thegeekstuff.com/2010/06/bash-array-tutorial/
* https://www.distributednetworks.com/linux-network-admin/module4/ephemeral-reserved-portNumbers.php
* https://github.com/community-scripts/ProxmoxVE/tree/main/install
* https://github.com/community-scripts/ProxmoxVE/tree/main/misc
* https://faculty.cs.niu.edu/~hutchins/csci480/signals.htm
## License

View File

@@ -1,158 +0,0 @@
#!/bin/bash
# alias bashrc='source ~/.bashrc'
alias zshrc='source ~/.zshrc'
alias realias='source ~/.bash_aliases'
alias reload='exec ${SHELL} -l'
alias sudo='sudo ' # enable aliases to be sudoed
alias g='git'
alias hosts="sudo nano /etc/hosts"
alias shrug="echo '¯\_(ツ)_/¯' | xclip -selection c"
alias ..='cd ..' # zsh builtin
alias ~='cd ~' # zsh builtin
alias -- -='cd -' # zsh builtin
alias chmod='chmod --preserve-root'
alias chown='chown --preserve-root'
alias free='free -h'
alias duh='du -ha --max-depth=1'
alias sduh='sudo du -ha --max-depth=1'
alias l='ls -pCFh --color=auto'
alias la='ls -pAFh --color=auto'
alias ll='ls -palFh --color=auto'
alias mkdir='mkdir -pv'
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 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 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 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'"
# Download music from Youtube or Youtube Music
# and save as top quality flac file without video
# Playlist and video/track URLs are supported
# Usage: $ ytm https://www.youtube.com/watch\?v=dQw4w9WgXcQ
# More info: https://github.com/ytdl-org/youtube-dl
ytm() {
youtube-dl \
--extract-audio \
--audio-format flac \
--audio-quality 0 \
--format bestaudio \
--write-info-json \
--output "${HOME}/Музыка/ytm/%(playlist_title)s/%(channel)s - %(title)s.%(ext)s" \
$@
}
docker.ip() {
if [ "$1" ]; then
if [ "$1" = "-a" ]; then
docker ps -aq \
| xargs -n 1 docker inspect --format '{{.Name}}{{range .NetworkSettings.Networks}} {{.IPAddress}}{{end}}' \
| sed -e 's#^/##' \
| column -t
elif [ "$1" = "-c" ]; then
docker-compose ps -q \
| xargs -n 1 docker inspect --format '{{.Name}}{{range .NetworkSettings.Networks}} {{.IPAddress}}{{end}}' \
| sed -e 's#^/##' \
| column -t
else
docker inspect --format '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' "$1"
docker port "$1"
fi
else
docker ps -q \
| xargs -n 1 docker inspect --format '{{.Name}}{{range .NetworkSettings.Networks}} {{.IPAddress}}{{end}}' \
| sed -e 's#^/##' \
| column -t
fi
}
#################################################################################
# $1 -- file/dir path
# $2 -- permissions (0644, 0755, etc)
# own() { #TODO refactor
# [ "$1" ] && PATH="${1/#\~/$HOME}" || {
# echo "Error (1): path not provided"
# }
# echo $PATH
# [ "$2" ] && PERM="$2" || {
# if [ -d $PATH ]; then
# PERM="0755"
# elif [ -f $PATH ]; then
# PERM="0644"
# else
# echo "Error (2): path not exists"
# fi;
# }
# echo $PERM
# sudo chmod $PERM -R --preserve-root $PATH
# sudo chown $USER. -R --preserve-root $PATH
# }
# function extract {
# if [ -z "$1" ]; then
# # display usage if no parameters given
# echo "Usage: extract <path/file_name>.<zip|rar|bz2|gz|tar|tbz2|tgz|Z|7z|xz|ex|tar.bz2|tar.gz|tar.xz>"
# echo " extract <path/file_name_1.ext> [path/file_name_2.ext] [path/file_name_3.ext]"
# return 1
# else
# for n in $@
# do
# if [ -f "$n" ] ; then
# case "${n%,}" in
# *.tar.bz2|*.tar.gz|*.tar.xz|*.tbz2|*.tgz|*.txz|*.tar)
# tar xvf "$n" ;;
# *.lzma) unlzma ./"$n" ;;
# *.bz2) bunzip2 ./"$n" ;;
# *.rar) unrar x -ad ./"$n" ;;
# *.gz) gunzip ./"$n" ;;
# *.zip) unzip ./"$n" ;;
# *.z) uncompress ./"$n" ;;
# *.7z|*.arj|*.cab|*.chm|*.deb|*.dmg|*.iso|*.lzh|*.msi|*.rpm|*.udf|*.wim|*.xar)
# 7z x ./"$n" ;;
# *.xz) unxz ./"$n" ;;
# *.exe) cabextract ./"$n" ;;
# *)
# echo "extract: '$n' - unknown archive method"
# return 1
# ;;
# esac
# else
# echo "'$n' - file does not exist"
# return 1
# fi
# done
# fi
# }

View File

@@ -1,108 +0,0 @@
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
# don't put duplicate lines or lines starting with space in the history.
# See bash(1) for more options
HISTCONTROL=ignoreboth
# append to the history file, don't overwrite it
shopt -s histappend
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
HISTSIZE=1000
HISTFILESIZE=2000
# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize
# If set, the pattern "**" used in a pathname expansion context will
# match all files and zero or more directories and subdirectories.
#shopt -s globstar
# make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
debian_chroot=$(cat /etc/debian_chroot)
fi
# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
xterm-color|*-256color) color_prompt=yes;;
esac
# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt
#force_color_prompt=yes
if [ -n "$force_color_prompt" ]; then
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
# We have color support; assume it's compliant with Ecma-48
# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
# a case would tend to support setf rather than setaf.)
color_prompt=yes
else
color_prompt=
fi
fi
if [ "$color_prompt" = yes ]; then
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
else
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi
unset color_prompt force_color_prompt
# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
;;
*)
;;
esac
# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
alias ls='ls --color=auto'
#alias dir='dir --color=auto'
#alias vdir='vdir --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
fi
# colored GCC warnings and errors
#export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
# Alias definitions.
# You may want to put all your additions into a separate file like
# ~/.bash_aliases, instead of adding them here directly.
# See /usr/share/doc/bash-doc/examples in the bash-doc package.
if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi
# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if ! shopt -oq posix; then
if [ -f /usr/share/bash-completion/bash_completion ]; then
. /usr/share/bash-completion/bash_completion
elif [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
fi

View File

@@ -1,15 +0,0 @@
root = true
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 4
trim_trailing_whitespace = true
[*.md]
trim_trailing_whitespace = false
[*.{yml,yaml}]
indent_size = 2

View File

@@ -1,151 +0,0 @@
[alias]
a = "add"
aa = "add --all" # add all unstaged into index
aliases = "config --get-regexp '^alias'" # show all aliases
amend = "commit --amend --all --no-edit" # add new changes into last commit
amendm = "commit --amend --all --message" # amend + edit commit message
b = "branch" #
bm = "branch --merged" # branches whose tips are reachable from commit or HEAD
bnm = "branch --no-merged" # branches whose tips are NOT reachable from commit or HEAD
branches = "branch -a"
; branches = "bvv"
brd = "branch -D" # force delete unmerged branch
brod = "!git branch -D "$1"; git push origin :"$1";" # brd + remove it from origin
bv = "branch -v" # show branch list with those last commits
bvv = "branch -vv" # bv + remote branches tracked by them
c = "commit"
ca = "commit --all" # stage all changes and make a commit (interative)
cam = "commit --all --message" # ca + cm (non-interactive)
cf = "!f() { TARGET=$(git rev-parse \"$1\"); git commit --fixup=$TARGET && GIT_EDITOR=true git rebase --interactive --autosquash $TARGET~; }; f" # https://words.filippo.io/git-fixup-amending-an-older-commit/
cleaner = "clean -dff"
cleanest = "clean -dffx"
cleanout = "!git clean -df && git checkout -- ."
cloner = "clone --recursive" # clone with submodules
cm = "commit --message" # make a commit with message given (non-interactive)
co = "checkout"
cob = "checkout -b" # create new branch with name given
contributors = "shortlog --summary --numbered --no-merges" # users participating in development
cp = "cherry-pick"
cpa = "cherry-pick --abort" # abort cherry-picking
cpc = "cherry-pick --continue" # continue cherry-picking
cpn = "cherry-pick --no-commit" # cherry-pick without commit
; cpnx = "cherry-pick --no-commit -x"
current-branch = "branch --show-current" #rev-parse --abbrev-ref HEAD
d = "diff"
dc = "diff --cached" # show diff of staged files
default-branch = "config init.defaultBranch" # get default branch name
dehead = "!BR=$(git branch --show-current); if [ -n "$BR" ]; then echo $BR; else git describe --contains --all HEAD; fi;"
dev = "!git checkout dev && git pull" # quick switch on dev branch and update it
develop = "!git checkout develop && git pull" # quick switch on develop branch and update it
discard = "checkout --" # удаляет изменения в файле
dw = "diff --word-diff" # show word diff in unstaged files
dwc = "diff --word-diff --cached" # dc + dw
exec = "!exec"
f = "fetch"
fa = "fetch --all" # fetch branches from all remotes
fuck = "!git checkout $(git default-branch) && git fetch origin --prune && git reset --hard origin/$(git default-branch) && git clean -ffd"
guser = "config --global --get-regexp '^user'" # show global user settings
gzip = !"f() { top=$(rev-parse --show-toplevel); cd $top; tar cvzf $top.tar.gz $top ; }; f" # make repo .tar.gz
head = "log -1 HEAD" # показать последний коммит в текущей ветке
heads = "log --graph --decorate --simplify-by-decoration --oneline" # show last commit of each branch as tree graph
inbound = "!git remote update --prune; git log ..@{upstream}" # get
init = "init -q"
l = "log"
; last-tag = "describe --tags --abbrev=0"
; last-tagged = "!git describe --tags $(git rev-list --tags --max-count=1)"
lo = "log --oneline"
log-all = "log --graph --decorate --all"
log-my = "!git log --author $(git config user.email)"
log-small = "log --graph --decorate --all --pretty=format:'%C(bold red)%h%C(reset) %C(bold blue)%an%C(reset) %C(green)%cr%C(reset) [%aD]%d%n%B'"
m = "merge"
ma = "merge --abort" # abort merging
main = "!git checkout main && git pull" # quick switch on main branch and update it
master = "!git checkout master && git pull" # quick switch on master branch and update it
mc = "merge --continue" # continue merging
merged = "bm"
mn = "merge --no-commit" # merge without commit
optimizer = "!git pruner; git repacker; git prune-packed"
orphans = "fsck --full"
outbound = "log @{upstream}.."
p = "pull"
pf = "pull --force" # получить ветку принудительно
pft = "pull --force --tags" # получить теги
; ploh = "pull origin HEAD" # получить текущую ветку из origin
; pr = "!git fetch origin pull/$1/head:pr/$1 && git checkout pr/$1" # github: встать на PR с указанным id
prs = "pull --recurse-submodules" # pull with submodules
pruner = "!git prune --expire=now; git reflog expire --expire-unreachable=now --rewrite --all"
pullf = "pull --force"
pullft = "pull --force --tags"
pullt = "pull --tags" # получить теги
pushf = "!git push --force" # отправить ветку принудительно
; pushf = "!git push --force --set-upstream origin $(git current-branch)" # отправить ветку принудительно
pushft = "!git push --tags --force" # отправить теги принудительно
; pushft = "!git push --tags --force --set-upstream origin $(git current-branch)" # отправить теги принудительно
pusht = "!git push --tags" # отправить теги
; pusht = "!git push --tags --set-upstream origin $(git current-branch)" # отправить теги
r = "reset"
rb = "rebase"
rba = "rebase --abort"
rbc = "rebase --continue"
rbi = "rebase --interactive"
rbs = "rebase --skip"
re = "remote"
rea = "remote add"
remotes = "remote -v" # показать список удалённых репозиториев
rep = "remote prune"
repacker = "repack -adf --depth=300 --window=300 --window-memory=1g"
repd = "remote prune --dry-run"
repo = "rpo"
repod = "rpod"
repush = "!git push origin :$1 && git push origin $1'" # замена push --force
res = "remote show"
reso = "remote show origin"
reu = "remote update"
rev = "remote -v"
rh = "reset --hard" # откат коммита с удалением всех изменений на указанный коммит
rhh = "reset --hard HEAD" # откат коммита с удалением всех изменений на последний коммит
rpo = "remote prune origin" # удалить все мёртвые ссылки на bare-ветки origin
rpod = "rpo --dry-run" # удалить все мёртвые ссылки на bare-ветки origin
rs = "reset --soft" # откат коммита с сохранением всех изменений на указанный коммит
rsh = "reset --soft HEAD" # откат коммита с сохранением всех изменений
rso = "remote show origin" # показать состояние локальных веток относительно удалённых на origin bare
rv = "revert"
rvn = "revert --no-commit"
s = "status"
sb = "show-branch"
start = "!git init -q && git commit --allow-empty -m 'Initial commit'"
stashes = "stash list" # show stashed changes
sub = "submodule"
; sa = "submodule add"
; sdi = "submodule deinit -f"
; si = "submodule init"
; ss = "submodule summary"
; sst = "submodule status"
; sup = "submodule update"
; sy = "remote update origin --prune"
tags = "tag -n1 --list" # shot tag names and commit message
trim = "!DEFAULT=$(git default-branch); git branch --merged ${1-$DEFAULT} | grep -v " ${1-$DEFAULT}$" | xargs git branch -d; git remote prune origin;"
uncommit = "rs HEAD~1"
unstage = "reset HEAD" # staged file => unstaged
;unwip = "reset --mixed HEAD~"
upstream-branch = "!git for-each-ref --format='%(upstream:short)' $(git symbolic-ref -q HEAD)"
user = "config --local --get-regexp '^user'" # show local user settings (in current repo)
wip = "!git add . && git commit -am 'WIP'"
wipa = "!git add . && git commit --amend -am 'WIP'"

View File

@@ -1,28 +0,0 @@
[core]
editor = nano
autocrlf = input
[user]
# ...
# signingkey = <key>
# git config user.signingkey ... -- установить ключ
# https://help.github.com/articles/signing-commits-using-gpg/
[commit]
gpgSign = true
[tag]
gpgSign = true
[init]
defaultBranch = master
[push]
default = current
followTags = true
[pull]
default = current
rebase = false
[diff "bin"]
textconv = hexdump -v -C
[help]
autocorrect = 1
[remote "origin"]
prune = true
[include]
path = ~/.git_aliases

4
dotfiles/.gitignore vendored
View File

@@ -1,4 +0,0 @@
.DS_Store
Desktop.ini
._*
Thumbs.db

View File

@@ -1,53 +0,0 @@
# ~/.profile: executed by the command interpreter for login shells.
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
# exists.
# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package.
# the default umask is set in /etc/profile; for setting the umask
# for ssh logins, install and configure the libpam-umask package.
#umask 022
# if running bash
if [ -n "$BASH_VERSION" ]; then
# include .bashrc if it exists
if [ -f "$HOME/.bashrc" ]; then
. "$HOME/.bashrc"
fi
fi
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
PATH="$HOME/bin:$PATH"
fi
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/.local/bin" ] ; then
PATH="$HOME/.local/bin:$PATH"
fi
### AAA ##########################################
if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi
export LD_LIBRARY_PATH="/opt/oci"
# export NLS_LANG='RUSSIAN_RUSSIA.AL32UTF8'
# export NLS_DATE_FORMAT='DD.MM.YYYY'
# export NLS_CURRENCY='р.'
# export NLS_DUAL_CURRENCY='р.'
# export NLS_CALENDAR='GREGORIAN'
# export NLS_ISO_CURRENCY='RUSSIA'
export JAVA_HOME="/usr/bin/"
export ANDROID_SDK_ROOT="$HOME/android/sdk"
export LITE_SCALE=1 # workaround https://github.com/lite-xl/lite-xl/issues/1173
export PATH="$HOME/.local/share/JetBrains/Toolbox/scripts:$HOME/.config/composer/vendor/bin:$PATH"
# The next line updates PATH for Yandex Cloud CLI.
if [ -f "$HOME/yandex-cloud/path.bash.inc" ]; then source "$HOME/yandex-cloud/path.bash.inc"; fi
# The next line enables shell command completion for yc.
if [ -f "$HOME/yandex-cloud/completion.zsh.inc" ]; then source "$HOME/yandex-cloud/completion.zsh.inc"; fi

View File

@@ -1,114 +0,0 @@
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
# Initialization code that may require console input (password prompts, [y/n]
# confirmations, etc.) must go above this block; everything else may go below.
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH="$HOME/.oh-my-zsh"
# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
ZSH_THEME="powerlevel10k/powerlevel10k"
# Set list of themes to pick from when loading at random
# Setting this variable when ZSH_THEME=random will cause zsh to load
# a theme from this variable instead of looking in $ZSH/themes/
# If set to an empty array, this variable will have no effect.
# ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" )
# Uncomment the following line to use case-sensitive completion.
# CASE_SENSITIVE="true"
# Uncomment the following line to use hyphen-insensitive completion.
# Case-sensitive completion must be off. _ and - will be interchangeable.
# HYPHEN_INSENSITIVE="true"
# Uncomment one of the following lines to change the auto-update behavior
# zstyle ':omz:update' mode disabled # disable automatic updates
# zstyle ':omz:update' mode auto # update automatically without asking
# zstyle ':omz:update' mode reminder # just remind me to update when it's time
# Uncomment the following line to change how often to auto-update (in days).
# zstyle ':omz:update' frequency 13
# Uncomment the following line if pasting URLs and other text is messed up.
# DISABLE_MAGIC_FUNCTIONS="true"
# Uncomment the following line to disable colors in ls.
# DISABLE_LS_COLORS="true"
# Uncomment the following line to disable auto-setting terminal title.
# DISABLE_AUTO_TITLE="true"
# Uncomment the following line to enable command auto-correction.
# ENABLE_CORRECTION="true"
# Uncomment the following line to display red dots whilst waiting for completion.
# You can also set it to another string to have that shown instead of the default red dots.
# e.g. COMPLETION_WAITING_DOTS="%F{yellow}waiting...%f"
# Caution: this setting can cause issues with multiline prompts in zsh < 5.7.1 (see #5765)
# COMPLETION_WAITING_DOTS="true"
# Uncomment the following line if you want to disable marking untracked files
# under VCS as dirty. This makes repository status check for large repositories
# much, much faster.
# DISABLE_UNTRACKED_FILES_DIRTY="true"
# Uncomment the following line if you want to change the command execution time
# stamp shown in the history command output.
# You can set one of the optional three formats:
# "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
# or set a custom format using the strftime function format specifications,
# see 'man strftime' for details.
# HIST_STAMPS="mm/dd/yyyy"
# Would you like to use another custom folder than $ZSH/custom?
# ZSH_CUSTOM=/path/to/new-custom-folder
# Which plugins would you like to load?
# Standard plugins can be found in $ZSH/plugins/
# 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 zsh-autosuggestions zsh-syntax-highlighting)
source $ZSH/oh-my-zsh.sh
# User configuration
# export MANPATH="/usr/local/man:$MANPATH"
# You may need to manually set your language environment
# export LANG=en_US.UTF-8
# Preferred editor for local and remote sessions
# if [[ -n $SSH_CONNECTION ]]; then
# export EDITOR='vim'
# else
# export EDITOR='mvim'
# fi
# Compilation flags
# export ARCHFLAGS="-arch x86_64"
# Set personal aliases, overriding those provided by oh-my-zsh libs,
# plugins, and themes. Aliases can be placed here, though oh-my-zsh
# users are encouraged to define aliases within the ZSH_CUSTOM folder.
# For a full list of active aliases, run `alias`.
#
# Example aliases
# alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
[[ -f ~/.profile ]] && source ~/.profile

View File

@@ -1,2 +0,0 @@
This directory contains files whose names start with a dot.
Make sure your file manager displays them here.

View File

@@ -1,15 +0,0 @@
{
"registry-mirrors": [
"https://dockerhub.timeweb.cloud",
"https://dh-mirror.gitverse.ru",
"https://mirror.gcr.io",
"https://daocloud.io",
"https://c.163.com/",
"https://registry.docker-cn.com",
"https://huecker.io",
"https://public.ecr.aws",
"https://quay.io",
"https://registry.access.redhat.com",
"https://registry.redhat.io"
]
}

View File

@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
[ -f Makefile ] && mv Makefile Makefile.bak
CHR_UPGRADE='^'
CHR_UNINSTALL='/'
@@ -18,7 +18,7 @@ for file in ./install/*; do
name=${name%.sh}
desc=$(grep -m 1 -oP "(?<=^##makedesc:\s).*$" ${file})
[ -z "$desc" ] && desc='<no description>'
echo -e "##${name}: ${desc}\n${name}:\n\t@${file}\n" >> Makefile
echo -e "##${name}: ${desc}\n${name}:\n\t@${file} install\n" >> Makefile
done;
cat << EOF >> Makefile
@@ -47,7 +47,7 @@ for file in ./upgrade/*; do
name=${name%.sh}
desc=$(grep -m 1 -oP "(?<=^##makedesc:\s).*$" ${file})
[ -z "$desc" ] && desc='<no description>'
echo -e "##${CHR_UPGRADE}${name}: ${desc}\n${CHR_UPGRADE}${name}:\n\t@${file}\n" >> Makefile
echo -e "##${CHR_UPGRADE}${name}: ${desc}\n${CHR_UPGRADE}${name}:\n\t@${file} upgrade\n" >> Makefile
done;
cat << EOF >> Makefile
@@ -62,7 +62,7 @@ for file in ./uninstall/*; do
name=${name%.sh}
desc=$(grep -m 1 -oP "(?<=^##makedesc:\s).*$" ${file})
[ -z "$desc" ] && desc='<no description>'
echo -e "##${CHR_UNINSTALL}${name}: ${desc}\n${CHR_UNINSTALL}${name}:\n\t@${file}\n" >> Makefile
echo -e "##${CHR_UNINSTALL}${name}: ${desc}\n${CHR_UNINSTALL}${name}:\n\t@${file} remove\n" >> Makefile
done;
cat << EOF >> Makefile

View File

@@ -1,8 +1,9 @@
#!/bin/bash
#!/usr/bin/env bash
set -oe pipefail
__root__=$( dirname $(readlink -e -- "${BASH_SOURCE}"))
source $__root__/helpers/io.sh || exit 255
source $__root__/helpers/git.sh || exit 255
source $__root__/helpers/basic.sh || exit 255
source $__root__/helpers/debug.sh || exit 255
source $__root__/helpers/packages.sh || exit 255

View File

@@ -1,29 +0,0 @@
# Argument parser for bash scripts
More info:
* 🇷🇺 [axenov.dev/bash-args](https://axenov.dev/bash-args/)
* 🇺🇸 [axenov.dev/en/bash-processing-arguments-in-a-script-when-called-from-the-shell/](https://axenov.dev/en/bash-processing-arguments-in-a-script-when-called-from-the-shell)
Tested in Ubuntu 20.04.2 LTS in:
```
bash 5.0.17(1)-release (x86_64-pc-linux-gnu)
zsh 5.8 (x86_64-ubuntu-linux-gnu)
```
## Version history
```
v1.0 - initial
v1.1 - arg(): improved skipping uninteresting args
- arg(): check next arg to be valid value
v1.2 - removed all 'return' statements
- arg(): error message corrected
- new examples
v1.3 - argl(): improved flag check
- some text corrections
v1.4 - new function argn()
- some text corrections
v1.5 - arg(), grep_match(): fixed searching for -e argument
- grep_match(): redirect output into /dev/null
```

View File

@@ -1,268 +0,0 @@
#!/bin/bash
#########################################################################
# #
# Argument parser for bash scripts #
# #
# Author: Anthony Axenov (Антон Аксенов) #
# Version: 1.5 #
# License: MIT #
# #
#########################################################################
# #
# With 'getopt' you cannot combine different #
# arguments for different nested functions. #
# #
# 'getopts' does not support long arguments with #
# values (like '--foo=bar'). #
# #
# These functions supports different arguments and #
# their combinations: #
# -a -b -c #
# -a avalue -b bvalue -c cvalue #
# -cab bvalue #
# --arg #
# --arg=value -ab -c cvalue --foo #
# #
# Tested in Ubuntu 20.04.2 LTS in: #
# bash 5.0.17(1)-release (x86_64-pc-linux-gnu) #
# zsh 5.8 (x86_64-ubuntu-linux-gnu) #
# #
#########################################################################
#purpose Little helper to check if string matches PCRE
#argument $1 - some string
#argument $2 - regex
#exitcode 0 - string valid
#exitcode 1 - string is not valid
grep_match() {
printf "%s" "$1" | grep -qP "$2" >/dev/null
}
#purpose Find short argument or its value
#argument $1 - (string) argument (without leading dashes; only first letter will be processed)
#argument $2 - (number) is it flag? 1 if is, otherwise 0 or nothing
#argument $3 - (string) variable to return value into
# (if not specified then it will be echo'ed in stdout)
#returns (string) 1 (if $2 == 1), value (if correct and if $2 != 1) or nothing
#usage To get value into var: arg v 0 myvar or myvalue=$(arg 'v')
#usage To find flag into var: arg f 1 myvar or flag=$(arg 'f')
#usage To echo value: arg v
#usage To echo 1 if flag exists: arg f
arg() {
local need=${1:0:1} # argument to find (only first letter)
[ $need ] || {
echo "Argument is not specified!" >&2
exit 1
}
local isflag=$2 || 0 # should we find the value or just the presence of the $need?
local retvar=$3 || 0 # var to return value into (if 0 then value will be echo'ed in stdout)
local args=(${__MAIN_ARGS[0]}) # args we need are stored in 1st element of __MAIN_ARGS
for ((idx=0; idx<${#args[@]}; ++idx)) do # going through args
local arg=${args[$idx]} # current argument
# skip $arg if it starts with '--', letter or digit
grep_match "$arg" "^(\w{1}|-{2})" && continue
# clear $arg from special and duplicate characters
# e.g. 'fas-)dfs' will become 'fasd'
local chars="$(printf "%s" "${arg}" | tr -s [${arg}] | tr -d "[:punct:][:blank:]")"
# now we can check if $need is one of $chars
if grep_match "-$need" "^-[$chars]$"; then # if it is
if [[ $isflag = 1 ]]; then # and we expect it as a flag
# then return '1' back into $3 (if exists) or echo in stdout
[ $retvar ] && eval "$retvar='1'" || echo "1"
else # but if $arg is not a flag
# then get next argument as value of current one
local value="${args[$idx+1]}"
# check if it is valid value
if grep_match "$value" "^\w+$"; then
# and return it back back into $3 (if exists) or echo in stdout
[ $retvar ] && eval "$retvar='$value'" || echo "$value"
break
else # otherwise throw error message into stderr (just in case)
echo "Argument '$arg' must have a correct value!" >&2
break
fi
fi
fi
done
}
#purpose Find long argument or its value
#argument $1 - argument (without leading dashes)
#argument $2 - is it flag? 1 if is, otherwise 0 or nothing
#argument $3 - variable to return value into
# (if not specified then it will be echo'ed in stdout)
#returns (string) 1 (if $2 == 1), value (if correct and if $2 != 1) or nothing
#usage To get value into var: arg v 0 myvar or myvalue=$(arg 'v')
#usage To find flag into var: arg f 1 myvar or flag=$(arg 'f')
#usage To echo value: arg v
#usage To echo 1 if flag exists: arg f
argl() {
local need=$1 # argument to find
[ $need ] || {
echo "Argument is not specified!" >&2
exit 1
}
local isflag=$2 || 0 # should we find the value or just the presence of the $need?
local retvar=$3 || 0 # var to return value into (if 0 then value will be echo'ed in stdout)
local args=(${__MAIN_ARGS[0]}) # args we need are stored in 1st element of __MAIN_ARGS
for ((idx=0; idx<${#args[@]}; ++idx)) do
local arg=${args[$idx]} # current argument
# if we expect $arg as a flag
if [[ $isflag = 1 ]]; then
# and if $arg has correct format (like '--flag')
if grep_match "$arg" "^--$need"; then
# then return '1' back into $3 (if exists) or echo in stdout
[ ! $retvar = 0 ] && eval "$retvar=1" || echo "1"
break
fi
else # but if $arg is not a flag
# check if $arg has correct format (like '--foo=bar')
if grep_match "$arg" "^--$need=.+$"; then # if it is
# then return part from '=' to arg's end as value back into $3 (if exists) or echo in stdout
[ ! $retvar = 0 ] && eval "$retvar=${arg#*=}" || echo "${arg#*=}"
break
fi
fi
done
}
#purpose Get argument by its index
#argument $1 - (number) arg index
#argument $2 - (string) variable to return arg's name into
# (if not specified then it will be echo'ed in stdout)
#returns (string) arg name or nothing
#usage To get arg into var: argn 1 myvar or arg=$(argn 1)
#usage To echo in stdout: argn 1
argn() {
local idx=$1 # argument index
[ $idx ] || {
error "Argument index is not specified!"
exit 1
}
local retvar=$2 || 0 # var to return value into (if 0 then value will be echo'ed in stdout)
local args=(${__MAIN_ARGS[0]}) # args we need are stored in 1st element of __MAIN_ARGS
local arg=${args[$idx]} # current argument
if [ $arg ]; then
[ ! $retvar = 0 ] && eval "$retvar=$arg" || echo "$arg"
fi
}
# Keep in mind:
# 1. Short arguments can be specified contiguously or separately
# and their order does not matter, but before each of them
# (or the first of them) one leading dash must be specified.
# Valid combinations: '-a -b -c', '-cba', '-b -ac'
# 2. Short arguments can have values and if are - value must go
# next to argument itself.
# Valid combinations: '-ab avalue', '-ba avalue', '-a avalue -b'
# 3. Long arguments cannot be combined like short ones and each
# of them must be specified separately with two leading dashes.
# Valid combinations: '--foo --bar', '--bar --foo'
# 4. Long arguments can have a value which must be specified after '='.
# Valid combinations: '--foo=value --bar', '--bar --foo=value'
# 5. Values cannot contain spaces even in quotes both for short and
# long args, otherwise first word will return as value.
# 6. You can use arg() or argl() to check presence of any arg, no matter
# if it has value or not.
### USAGE ###
# This is simple examples which you can play around with.
# first we must save the original arguments passed
# to the script when it was called:
__MAIN_ARGS=$@
echo -e "\n1. Short args (vars):"
arg a 1 a # -a
arg v 0 v # -v v_value
arg c 1 c # -c
arg z 1 z # -z (not exists)
echo "1.1 a=$a"
echo "1.2 v=$v"
echo "1.3 c=$c"
echo "1.4 z=$z"
echo -e "\n2. Short args (echo):"
echo "2.1 a=$(arg a 1)"
echo "2.2 v=$(arg v 0)"
echo "2.3 c=$(arg c 1)"
echo "2.4 z=$(arg z 1)"
echo -e "\n3. Long args (vars):"
argl flag 1 flag # --flag
argl param1 0 param1 # --param1=test
argl param2 0 param2 # --param2=password
argl bar 1 bar # --bar (not exists)
echo "3.1 flag=$flag"
echo "3.2 param1=$param1"
echo "3.3 param2=$param2"
echo "3.4 bar=$bar"
echo -e "\n4. Long args (echo):"
echo "4.1 flag=$(argl flag 1)"
echo "4.2 param1=$(argl param1 0)"
echo "4.3 param2=$(argl param2 0)"
echo "4.4 bar=$(argl bar 1)"
echo -e "\n5. Args by index:"
argn 1 first
echo "5.1 arg[1]=$first"
echo "5.2 arg[3]=$(argn 3)"
# Well, now we will try to get global args inside different functions
food() {
echo -e "\n=== food() ==="
arg f 0 food
argl 'food' 0 food
[ $food ] && echo "Om nom nom! $food is very tasty" || echo "Uh oh" >&2
}
hello() {
echo -e "\n=== hello() ==="
arg n 0 name
argl name 0 name
[ $name ] && echo "Hi, $name! How u r doin?" || echo "Hello, stranger..." >&2
}
hello
food
### OUTPUT ###
# Command to run:
# bash args.sh -va asdf --flag --param1=paramvalue1 -c --param2="somevalue2 sdf" --name="John" -f Seafood
# 1. Short args (vars):
# 1.1 a=1
# 1.2 v=v_value
# 1.3 c=1
# 1.4 z=
#
# 2. Short args (echo):
# 2.1 a=1
# 2.2 v=v_value
# 2.3 c=1
# 2.4 z=
#
# 3. Long args (vars):
# 3.1 longflag=1
# 3.2 param1=test
# 3.3 param2=password
# 3.4 barflag=
#
# 4. Long args (echo):
# 4.1 longflag=1
# 4.2 param1=test
# 4.3 param2=password
# 4.4 barflag=
#
# 5. Args by index:
# 5.1 arg[1]=asdf
# 5.2 arg[3]=--param1=paramvalue1
#
# === hello() ===
# Hi, John! How u r doin?
#
# === food() ===
# Om nom nom! Seafood is very tasty

View File

@@ -1,26 +0,0 @@
#!/bin/bash
source $( dirname $(readlink -e -- "${BASH_SOURCE}"))/io.sh || exit 255
########################################################
# Functions to debug scripts
########################################################
var_dump() {
debug "$1 = ${!1}"
}
print_stacktrace() {
STACK=""
local i
local stack_size=${#FUNCNAME[@]}
debug "Callstack:"
# for (( i=$stack_size-1; i>=1; i-- )); do
for (( i=1; i<$stack_size; i++ )); do
local func="${FUNCNAME[$i]}"
[ x$func = x ] && func=MAIN
local linen="${BASH_LINENO[$(( i - 1 ))]}"
local src="${BASH_SOURCE[$i]}"
[ x"$src" = x ] && src=non_file_source
debug " at $func $src:$linen"
done
}

View File

@@ -1,112 +0,0 @@
#!/bin/bash
########################################################
# Simple and fancy input & output
########################################################
IINFO="( i )"
INOTE="( * )"
IWARN="( # )"
IERROR="( ! )"
IFATAL="( @ )"
ISUCCESS="( ! )"
IASK="( ? )"
IDEBUG="(DBG)"
IVRB="( + )"
BOLD="\e[1m"
DIM="\e[2m"
NOTBOLD="\e[22m" # sometimes \e[21m
NOTDIM="\e[22m"
NORMAL="\e[20m"
RESET="\e[0m"
FRESET="\e[39m"
FBLACK="\e[30m"
FWHITE="\e[97m"
FRED="\e[31m"
FGREEN="\e[32m"
FYELLOW="\e[33m"
FBLUE="\e[34m"
FLRED="\e[91m"
FLGREEN="\e[92m"
FLYELLOW="\e[93m"
FLBLUE="\e[94m"
BRESET="\e[49m"
BBLACK="\e[40m"
BWHITE="\e[107m"
BRED="\e[41m"
BGREEN="\e[42m"
BYELLOW="\e[43m"
BBLUE="\e[44m"
BLRED="\e[101m"
BLGREEN="\e[102m"
BLYELLOW="\e[103m"
BLBLUE="\e[104m"
dt() {
echo "[$(date +'%H:%M:%S')] "
}
ask() {
IFS= read -rp "$(print ${BOLD}${BBLUE}${FWHITE}${IASK}${BRESET}\ ${BOLD}$1 ): " $2
}
print() {
echo -e "$*${RESET}"
}
debug() {
if [ "$2" ]; then
print "${DIM}${BOLD}${RESET}${DIM}$(dt)${IDEBUG} ${FUNCNAME[1]:-?}():${BASH_LINENO:-?}\t$1 " >&2
else
print "${DIM}${BOLD}${RESET}${DIM}$(dt)${IDEBUG} $1 " >&2
fi
}
verbose() {
print "${BOLD}$(dt)${IVRB}${RESET}${FYELLOW} $1 "
}
info() {
print "${BOLD}$(dt)${FWHITE}${BLBLUE}${IINFO}${RESET}${FWHITE} $1 "
}
note() {
print "${BOLD}$(dt)${DIM}${FWHITE}${INOTE}${RESET} $1 "
}
success() {
print "${BOLD}$(dt)${BGREEN}${FWHITE}${ISUCCESS}${BRESET}$FGREEN $1 "
}
warn() {
print "${BOLD}$(dt)${BYELLOW}${FBLACK}${IWARN}${BRESET}${FYELLOW} Warning:${RESET} $1 "
}
error() {
print "${BOLD}$(dt)${BLRED}${FWHITE}${IERROR} Error: ${BRESET}${FLRED} $1 " >&2
}
fatal() {
print "${BOLD}$(dt)${BRED}${FWHITE}${IFATAL} FATAL: $1 " >&2
print_stacktrace
}
die() {
error "${1:-halted}"
exit ${2:-255}
}
# var='test var_dump'
# var_dump var
# debug 'test debug'
# verbose 'test verbose'
# info 'test info'
# note 'test note'
# success 'test success'
# warn 'test warn'
# error 'test error'
# fatal 'test fatal'
# die 'test die'

View File

@@ -1,66 +0,0 @@
#!/bin/bash
########################################################
# Misc
########################################################
# https://askubuntu.com/a/30414
is_full_screen() {
local WINDOW=$(echo $(xwininfo -id $(xdotool getactivewindow) -stats | \
egrep '(Width|Height):' | \
awk '{print $NF}') | \
sed -e 's/ /x/')
local SCREEN=$(xdpyinfo | grep -m1 dimensions | awk '{print $2}')
if [ "$WINDOW" = "$SCREEN" ]; then
return 0
fi
return 1
}
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
}
ytm() {
youtube-dl \
--extract-audio \
--audio-format flac \
--audio-quality 0 \
--format bestaudio \
--write-info-json \
--output "$HOME/Downloads/ytm/%(playlist_title)s/%(channel)s - %(title)s.%(ext)s" \
$*
}
docker.ip() { # not finished
if [ "$1" ]; then
if [ "$1" = "-a" ]; then
docker ps -aq \
| xargs -n 1 docker inspect --format '{{.Name}}{{range .NetworkSettings.Networks}} {{.IPAddress}}{{end}}' \
| sed -e 's#^/##' \
| column -t
elif [ "$1" = "-c" ]; then
docker-compose ps -q \
| xargs -n 1 docker inspect --format '{{.Name}}{{range .NetworkSettings.Networks}} {{.IPAddress}}{{end}}' \
| sed -e 's#^/##' \
| column -t
else
docker inspect --format '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' "$1"
docker port "$1"
fi
else
docker ps -q \
| xargs -n 1 docker inspect --format '{{.Name}}{{range .NetworkSettings.Networks}} {{.IPAddress}}{{end}}' \
| sed -e 's#^/##' \
| column -t
fi
}

46
install/_example Normal file
View File

@@ -0,0 +1,46 @@
#!/usr/bin/env bash
##makedesc: Example script
set -eo pipefail
install() {
echo
echo "==============================================="
echo "Installing example"
echo "==============================================="
echo
sleep 3
echo
echo "Finish! example v1.2.3"
echo
}
upgrade() {
echo
echo "==============================================="
echo "Upgrading example"
echo "==============================================="
echo
sleep 3
echo
echo "Finish! example v1.2.3"
echo
}
remove() {
echo
echo "==============================================="
echo "Removing example"
echo "==============================================="
echo
sleep 3
echo
echo "Finish!"
echo
}
case "$1" in
u|upgrade|update) upgrade ;;
r|remove|d|delete|p|purge) remove ;;
*) install ;;
esac

46
install/anytype Executable file
View File

@@ -0,0 +1,46 @@
#!/usr/bin/env bash
##makedesc: Manage anytype (deb)
set -eo pipefail
installDir="$HOME/install/anytype"
install() {
release="$(curl -s 'https://api.github.com/repos/anyproto/anytype-ts/releases/latest')"
tag="$(echo "$release" | jq -r '.tag_name')"
asset="$(echo "$release" | jq -r '.assets.[] | select(.name | test("amd64.deb$"))')"
url="$(echo "$asset" | jq -r '.browser_download_url')"
echo -e "$tag $url"
echo
echo "==============================================="
echo "Installing anytype $tag"
echo "==============================================="
echo
mkdir -p "$installDir"
filepath="$installDir/anytype_${tag}_amd46.deb"
wget "$url" -O "$filepath"
sudo dpkg -i "$filepath"
echo
echo "Finish! $tag"
echo
}
remove() {
echo
echo "==============================================="
echo "Removing anytype"
echo "==============================================="
echo
sudo apt purge -y anytype*
echo
echo "Finish!"
echo
}
case "$1" in
r|remove|d|delete|p|purge) remove ;;
*) install ;;
esac

View File

@@ -1,11 +1,46 @@
#!/bin/bash
##makedesc: Install apache2 (latest)
source "$( dirname $(readlink -e -- "${BASH_SOURCE}"))/../helpers.sh" || exit 255
#!/usr/bin/env bash
##makedesc: Manage apache2 (apt)
title
install() {
echo
echo "==============================================="
echo "Installing apache2"
echo "==============================================="
echo
sudo apt install -y apache2
sudo systemctl restart apache2
echo
echo "Finish! $(apache2 -v)"
echo
}
apt_install apache2
sudo systemctl restart apache2
upgrade() {
echo
echo "==============================================="
echo "Upgrading apache2"
echo "==============================================="
echo
sudo apt upgrade -y apache2 apache2-data apache2-utils
sudo systemctl restart apache2
echo
echo "Finish! $(apache2 -v)"
echo
}
success "apache2 installed!"
apache2 -v
remove() {
echo
echo "==============================================="
echo "Removing apache2"
echo "==============================================="
echo
sudo apt purge -y apache2*
echo
echo "Finish!"
echo
}
case "$1" in
u|upgrade|update) upgrade ;;
r|remove|d|delete|p|purge) remove ;;
*) install ;;
esac

View File

@@ -1,5 +1,5 @@
#!/bin/bash
##makedesc: Install software from apt
#!/usr/bin/env bash
##makedesc: Install basic software from apt
sudo apt update && \
sudo apt upgrade -y --autoremove && \
@@ -34,17 +34,17 @@ sudo apt update && \
p7zip-full \
easyeffects \
software-properties-common \
terminator \
ubuntu-restricted-extras \
unzip \
vlc \
ffmpeg \
xclip \
inotify-tools \
notify-osd \
fonts-open-sans \
libnotify-bin \
tree \
earlyoom
# terminator
# xclip
# sqlitebrowser
# etckeeper

View File

@@ -1,13 +1,52 @@
#!/bin/bash
##makedesc: Install Canon Pixma MG2500 + ppa
source "$( dirname $(readlink -e -- "${BASH_SOURCE}"))/../helpers.sh" || exit 255
#!/usr/bin/env bash
##makedesc: Canon Pixma MG2500 + ppa
title
install() {
echo
echo "==============================================="
echo "Installing Canon Pixma MG2500 + ppa"
echo "==============================================="
echo
sudo add-apt-repository -y ppa:thierry-f/fork-michael-gruz
sudo apt install -y cnijfilter-mg2500series scangearmp-mg2500series
echo
echo "Finish!"
echo "Drivers for Canon Pixma MG2500 installed!"
echo "Now you must reboot PC and connect your printer."
echo
}
apt_ppa_add ppa:thierry-f/fork-michael-gruz
upgrade() {
echo
echo "==============================================="
echo "Upgrading Canon Pixma MG2500 + ppa"
echo "==============================================="
echo
sudo apt upgrade -y cnijfilter-mg2500series scangearmp-mg2500series
echo
echo "Finish! Canon Pixma MG2500 + ppa"
echo
}
apt_install cnijfilter-mg2500series
apt_install scangearmp-mg2500series
remove() {
echo
echo "==============================================="
echo "Removing Canon Pixma MG2500 + ppa"
echo "==============================================="
echo
# sudo apt purge -y cnijfilter-mg2500series scangearmp-mg2500series
sudp dpkg -r cnijfilter-mg2500series
sudp dpkg -r cnijfilter-common
sudp dpkg -r scangearmp-mg2500series
sudp dpkg -r scangearmp-common
sudo add-apt-repository -ry ppa:thierry-f/fork-michael-gruz
echo
echo "Finish!"
echo
}
success "Drivers for Canon Pixma MG2500 installed!"
info "Now you must reboot PC and connect your printer."
case "$1" in
u|upgrade|update) upgrade ;;
r|remove|d|delete|p|purge) remove ;;
*) install ;;
esac

View File

@@ -1,17 +1,56 @@
#!/bin/bash
##makedesc: Install google chrome (latest)
source "$( dirname $(readlink -e -- "${BASH_SOURCE}"))/../helpers.sh" || exit 255
#!/usr/bin/env bash
##makedesc: Google Chrome (latest)
set -eo pipefail
# https://t.me/axenov_blog/251
title
dest="$HOME/install/deb"
deb="$dest/google-chrome.deb"
url="https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb"
mkdir -p "$HOME/install/deb"
install() {
echo
echo "==============================================="
echo "Installing Google Chrome"
echo "==============================================="
echo
mkdir -p "$dest"
wget "$url" -O "$deb"
sudo dpkg -i "$deb"
echo
echo "Finish! $(google-chrome --version)"
echo
}
download "https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb" \
"$HOME/install/deb/google-chrome.deb"
upgrade() {
echo
echo "==============================================="
echo "Upgrading Google Chrome"
echo "==============================================="
echo
mkdir -p "$dest"
wget "$url" -O "$deb"
sudo dpkg -i "$deb"
echo
echo "Finish! $(google-chrome --version)"
echo
}
dpkg_install "$HOME/install/deb/google-chrome.deb"
remove() {
echo
echo "==============================================="
echo "Removing Google Chrome"
echo "==============================================="
echo
sudo dpkg -r google-chrome
echo
echo "Finish!"
echo
}
success "Google Chrome installed!"
google-chrome --version
case "$1" in
u|upgrade|update) upgrade ;;
r|remove|d|delete|p|purge) remove ;;
*) install ;;
esac

56
install/clamav Executable file
View File

@@ -0,0 +1,56 @@
#!/usr/bin/env bash
##makedesc: ClamAV
set -eo pipefail
install() {
echo
echo "==============================================="
echo "Installing clamav"
echo "==============================================="
echo
sudo apt install -y clamav
echo "DatabaseMirror packages.microsoft.com/clamav" \
| sudo tee -a /etc/clamav/freshclam.conf
sudo freshclam
echo
echo "Finish!"
echo
}
upgrade() {
echo
echo "==============================================="
echo "Upgrading clamav"
echo "==============================================="
echo
sudo apt upgrade -y clamav
sudo freshclam
echo
echo "Finish!"
echo
}
remove() {
echo
echo "==============================================="
echo "Removing clamav"
echo "==============================================="
echo
sudo apt purge -y clamav*
echo
echo "Finish!"
echo
}
case "$1" in
u|upgrade|update) upgrade ;;
r|remove|d|delete|p|purge) remove ;;
*) install ;;
esac

View File

@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
##makedesc: Install composer (latest)
here=$( dirname $(readlink -e -- "${BASH_SOURCE}"))
source "$here/../helpers.sh" || exit 255
@@ -25,10 +25,10 @@ php "$HOME/install/other/composer-setup.php" \
--filename="composer"
COMPOSER_GLOBAL_HOME="$($HOME/.local/bin/composer config -g home)"
NEWPATH="export PATH=\"$COMPOSER_GLOBAL_HOME/vendor/bin:\${PATH}\""
NEWPATH="PATH=\"$COMPOSER_GLOBAL_HOME/vendor/bin:\${PATH}\""
cat "$HOME/.profile" | grep -qoh "$NEWPATH" || {
$NEWPATH
echo "$NEWPATH" >> "$HOME/.profile"
export "$NEWPATH"
echo "export $NEWPATH" >> "$HOME/.profile"
}
source "$HOME/.profile"

View File

@@ -1,39 +1,78 @@
#!/bin/bash
##makedesc: Install docker (latest) + ppa
source "$( dirname $(readlink -e -- "${BASH_SOURCE}"))/../helpers.sh" || exit 255
#!/usr/bin/env bash
##makedesc: Docker + ppa
# https://docs.docker.com/engine/install/ubuntu/
# https://docs.docker.com/engine/install/linux-postinstall/#manage-docker-as-a-non-root-user
title
set -eo pipefail
for pkg in docker.io docker-doc docker-compose docker-compose-v2 podman-docker containerd runc; do
apt_remove $pkg
done
doRemove() {
sudo apt purge -y docker* podman-docker containerd runc
}
require ca-certificates lsb-release
source /etc/os-release
key="/etc/apt/keyrings/docker.asc"
sudo install -m 0755 -d /etc/apt/keyrings
sudo cdownload https://download.docker.com/linux/ubuntu/gpg $key
sudo chmod a+r $key
echo "deb [arch=$(dpkg_arch) signed-by=$key] https://download.docker.com/linux/ubuntu $VERSION_CODENAME stable" \
install_() {
echo
echo "==============================================="
echo "Installing Docker"
echo "==============================================="
echo
doRemove
sudo apt install -y ca-certificates lsb-release
source /etc/os-release
codename="$VERSION_CODENAME"
key="/etc/apt/keyrings/docker.asc"
arch=$(dpkg --print-architecture)
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL "https://download.docker.com/linux/ubuntu/gpg" -o "$key"
sudo chmod a+r $key
echo "deb [arch=$arch signed-by=$key] https://download.docker.com/linux/ubuntu $codename stable" \
| sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
apt_update
apt_install \
sudo apt update
sudo apt install -y \
docker-ce \
docker-ce-cli \
containerd.io \
docker-buildx-plugin \
docker-compose-plugin
sudo usermod -aG docker "$(whoami)"
newgrp docker
echo
echo "Finish! $(docker --version)"
echo "Probably, you need to relogin to apply 'docker' group permanently."
echo
}
sudo usermod -aG docker $(whoami)
newgrp docker
upgrade() {
echo
echo "==============================================="
echo "Upgrading Docker"
echo "==============================================="
echo
sudo apt upgrade -y \
docker-ce \
docker-ce-cli \
containerd.io \
docker-buildx-plugin \
docker-compose-plugin
echo
echo "Finish!"
echo
}
success "Docker installed!"
docker --version
info "Probably, you need to relogin to apply 'docker' group permanently."
remove() {
echo
echo "==============================================="
echo "Removing Docker"
echo "==============================================="
echo
doRemove
echo
echo "Finish!"
echo
}
case "$1" in
u|upgrade|update) upgrade ;;
r|remove|d|delete|p|purge) remove ;;
*) install ;;
esac

View File

@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
##makedesc: Install dotfiles
source "$( dirname $(readlink -e -- "${BASH_SOURCE}"))/../helpers.sh" || exit 255

View File

@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
##makedesc: Install droidcam v1.9.0
source "$( dirname $(readlink -e -- "${BASH_SOURCE}"))/../helpers.sh" || exit 255

View File

@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
##makedesc: Install droidcam-obs plugin v1.5.1
#TODO

View File

@@ -1,15 +1,54 @@
#!/bin/bash
#!/usr/bin/env bash
##makedesc: Install flameshot (latest)
source "$( dirname $(readlink -e -- "${BASH_SOURCE}"))/../helpers.sh" || exit 255
title
sudo apt install -y --autoremove flameshot && \
sudo systemctl restart flameshot
# https://github.com/flameshot-org/flameshot?tab=readme-ov-file#compilation
# sudo apt install -y --autoremove flameshot && \
# sudo systemctl restart flameshot
dir="$HOME/install"
clone_dir="$dir/flameshot"
mkdir -p "$dir"
sudo apt install -y \
g++ \
cmake \
build-essential \
qtbase5-dev \
qttools5-dev-tools \
libqt5svg5-dev \
qttools5-dev \
libqt5dbus5 \
libqt5network5 \
libqt5core5a \
libqt5widgets5 \
libqt5gui5 \
libqt5svg5
if [ ! -d "$clone_dir" ]; then
git clone --depth=1 --single-branch https://github.com/flameshot-org/flameshot.git "$clone_dir"
fi
# Directory where build files will be placed, may be relative
export BUILD_DIR=build
# Directory prefix where flameshot will be installed. If you are just building and don't want to
# install, comment this environment variable.
# This excludes the bin/flameshot part of the install,
# e.g. in /opt/flameshot/bin/flameshot, the CMAKE_INSTALL_PREFIX is /opt/flameshot
# This must be an absolute path. Requires CMAKE 3.29.
export CMAKE_INSTALL_PREFIX=/opt/flameshot
cd "$clone_dir" && \
git pull && \
cmake -S . -B "$BUILD_DIR" && \
cmake --build "$BUILD_DIR"
[ $? = 0 ] && {
echo
success "flameshot installed!"
flameshot -v
# /opt/flameshot/flameshot -v
echo
}

View File

@@ -1,53 +0,0 @@
#!/bin/bash
##makedesc: Install Wireguard + FRKN
source "$( dirname $(readlink -e -- "${BASH_SOURCE}"))/../helpers.sh" || exit 255
# https://frkn.org/ru/installation
title
mkdir -p "$HOME/install/frkn"
cd "$HOME/install/frkn"
apt_install wireguard jq
countries=(uk ru nl nl2 ch)
for idx in ${!countries[@]}; do
country=${countries[idx]}
info "Downloading config for $country ($(expr $idx + 1)/${#countries[@]})"
json=$(curl -s "https://api.frkn.org/peer?location=$country" | jq)
iface_address=$(echo $json | jq -r .iface.address)
iface_privkey=$(echo $json | jq -r .iface.key)
iface_dns=$(echo $json | jq -r .iface.dns)
peer_pubkey=$(echo $json | jq -r .peer.pubkey)
peer_psk=$(echo $json | jq -r .peer.psk)
peer_allowed_ips=$(echo $json | jq -r .peer.allowed_ips)
peer_endpoint=$(echo $json | jq -r .peer.endpoint)
cat << EOF > "frkn-$country.conf"
[Interface]
Address = $iface_address
DNS = $iface_dns
PrivateKey = $iface_privkey
[Peer]
PublicKey = $peer_pubkey
PresharedKey = $peer_psk
AllowedIPs = $peer_allowed_ips
Endpoint = $peer_endpoint
PersistentKeepalive = 25
EOF
done
sudo cp frkn-*.conf /etc/wireguard/
[ $? = 0 ] && {
echo
success "Wireguard + FRKN installed!"
wg --version
info "Use 'wg-quick (up|down) frkn-($(implode '|' ${countries[@]}))' to control connections"
info "Use 'sudo wg show' to see connection status"
}

View File

@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
##makedesc: Install git (latest)
source "$( dirname $(readlink -e -- "${BASH_SOURCE}"))/../helpers.sh" || exit 255

View File

@@ -1,28 +1,57 @@
#!/bin/bash
##makedesc: Install golang v1.21.0
source "$( dirname $(readlink -e -- "${BASH_SOURCE}"))/../helpers.sh" || exit 255
#!/usr/bin/env bash
##makedesc: Install golang
# https://go.dev/dl/
# https://golang.org/doc/install
# https://www.vultr.com/docs/install-the-latest-version-of-golang-on-ubuntu
# https://github.com/udhos/update-golang/blob/master/update-golang.sh
[ $1 ] && VERSION="$1" || VERSION="1.23.0"
title "Installing golang v$VERSION..."
set -eo pipefail
FILE="go$VERSION.linux-amd64.tar.gz"
sudo rm -rf /usr/local/go && \
download "https://golang.org/dl/$FILE" "/tmp/$FILE" && \
sudo tar -xzf "/tmp/$FILE" -C /usr/local && \
rm -rf "/tmp/$FILE" && \
sudo chown $USER: -R /usr/local/go && \
echo 'export PATH="/usr/local/go/bin:$PATH"' >> "$HOME/.profile" && \
echo "export GOPATH=\"\$HOME/.go\"" >> "$HOME/.profile" && \
source ~/.profile
doRemove() {
[ -d "/usr/local/go" ] && sudo rm -rf "/usr/local/go"
}
[ $? = 0 ] && {
install() {
dlUrl="https://go.dev/dl"
json=$(curl -sSL "$dlUrl/?mode=json")
version=$(echo "$json" | jq -r '.[0].version')
echo
echo "==============================================="
echo "Installing golang v$version"
echo "==============================================="
echo
latestJson=$(echo "$json" | jq -r '.[0].files.[] | select (.kind == "archive" and .os == "linux" and .arch == "amd64")')
fileName=$(echo "$latestJson" | jq -r '.filename')
fileUrl="$dlUrl/$fileName"
downloadPath="$HOME/install"
archivePath="$downloadPath/$fileName"
doRemove
[ -f "$archivePath" ] || wget "$fileUrl" -O "$archivePath"
[ -f "$archivePath" ] && sudo tar -xzf "$archivePath" -C /usr/local
sudo chown "$USER": -R /usr/local/go
echo 'export PATH="/usr/local/go/bin:$PATH"' >> "$HOME/.profile"
echo "export GOPATH=\"\$HOME/.go\"" >> "$HOME/.profile"
echo
success "golang installed!"
info "NOTE: now run 'source ~/.profile' to apply new env vars"
go version
go install github.com/go-delve/delve/cmd/dlv@latest
go install
echo "Finish!"
}
remove() {
echo
echo "==============================================="
echo "Removing golang"
echo "==============================================="
echo
doRemove
echo
echo "Finish!"
echo
}
case "$1" in
r|remove|d|delete|p|purge) remove ;;
*) install ;;
esac

View File

@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
##makedesc: Install grub-customizer (latest + ppa)
source "$( dirname $(readlink -e -- "${BASH_SOURCE}"))/../helpers.sh" || exit 255

View File

@@ -1,20 +0,0 @@
#!/bin/bash
##makedesc: Install JetBrains Mono fonts
source "$( dirname $(readlink -e -- "${BASH_SOURCE}"))/../helpers.sh" || exit 255
# https://www.jetbrains.com/lp/mono/#how-to-install
title
require unzip
mkdir -p "$HOME/install/jbmono" "$HOME/.local/share/fonts/"
download "https://download.jetbrains.com/fonts/JetBrainsMono-2.304.zip" "$HOME/install/jbmono.zip" && \
unzip -oj "$HOME/install/jbmono.zip" "fonts/ttf/*.ttf" -d "$HOME/.local/share/fonts/" && \
fc-cache -vf "$HOME/.local/share/fonts/"
[ $? = 0 ] && {
echo
success "JetBrains Mono fonts installed!"
echo
}

View File

@@ -1,4 +1,4 @@
#!/bin/bash (latest)
#!/usr/bin/env bash (latest)
##makedesc: Install KDE Window AppMenu Applet
echo

View File

@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
##makedesc: Install KDE Backports
source "$( dirname $(readlink -e -- "${BASH_SOURCE}"))/../helpers.sh" || exit 255

View File

@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
##makedesc: Install file templates (KDE)
echo
@@ -48,7 +48,7 @@ EOF
echo "- Shell" ####################################################
cat <<EOF > "$TPL_SRC/template.sh"
#!/bin/bash
#!/usr/bin/env bash
EOF
cat << EOF > "$TPL_DIR/sh.desktop"

View File

@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
##makedesc: Install KDE portal
echo

View File

@@ -1,64 +0,0 @@
#!/bin/bash
# https://www.devas.life/effective-neovim-setup-for-web-development-towards-2024/
set -eo pipefail
trap ontrap SIGINT SIGTERM SIGSTOP
ontrap() {
echo
echo "[!] Interrupted"
exit
}
[ -z "$1" ] && version=0.10.1 || version="$1"
filedir="$HOME/install/neovim-$version"
filename="nvim-linux64.tar.gz"
filepath="$filedir/$filename"
configdir="$HOME/.config/nvim"
localdir="$HOME/.local"
echo "[*] Installing neovim v$version"
if [ -d $configdir ]; then
mv $configdir "$configdir.bak-$(date +'%Y%m%d_%H%M%S')"
fi
mkdir -p $filedir $configdir $localdir/{bin,lib,share}
if [ ! -f $filepath ]; then
echo "[*] Downloading to $filepath..."
wget -q https://github.com/neovim/neovim/releases/download/v$version/nvim-linux64.tar.gz \
-O $filepath \
--show-progress
fi
echo "[*] Unpacking: $filepath..."
tar -zxf $filepath -C $filedir
cp -rf $filedir/nvim-linux64/bin/nvim $localdir/bin/
cp -rf $filedir/nvim-linux64/lib/nvim $localdir/lib/
cp -rf $filedir/nvim-linux64/share $localdir/share
rm -rf $filedir/nvim-linux64
echo "[*] Reinit git repo..."
git clone https://github.com/LazyVim/starter \
$configdir \
--depth=1 \
--single-branch
cd $configdir
rm -rf .git
git init -q

View File

@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
##makedesc: Install libreoffice
echo

View File

@@ -1,43 +1,45 @@
#!/bin/bash
##makedesc: Install lite-xl
#!/usr/bin/env bash
##makedesc: Install lite-xl v2.1.7
# https://github.com/lite-xl/lite-xl/releases
# https://lite-xl.com/en/documentation/build
# https://lite-xl.com/setup/getting-started/
echo
echo "==============================================="
echo "Installing lite-xl v2.1.0..."
echo "Installing lite-xl v2.1.7..."
echo "==============================================="
echo
tar_url="https://github.com/lite-xl/lite-xl/releases/download/v2.1.0/lite-xl-v2.1.0-addons-linux-x86_64-portable.tar.gz"
tar_filepath="/tmp/lite-xl.tar.gz"
tar_url="https://github.com/lite-xl/lite-xl/releases/download/v2.1.7/lite-xl-v2.1.7-addons-linux-x86_64-portable.tar.gz"
lpm_url="https://github.com/lite-xl/lite-xl-plugin-manager/releases/download/latest/lpm.x86_64-linux"
tar_filepath="$HOME/install/lite-xl-v2.1.7.tar.gz"
untar_dir="$HOME/install"
untar_subdir="$untar_dir/lite-xl"
dest_bin_dir="$HOME/.local/bin"
dest_config_dir="$HOME/.config/lite-xl"
dest_share_dir="$HOME/.local/share"
dest_share_subdir="$dest_share_dir/lite-xl"
wget "$tar_url" -O "$tar_filepath"
rm -rf \
"$HOME/.local/bin/lpm" \
"$HOME/install/lite-xl" \
"$HOME/.local/bin/lite-xl" \
"$HOME/.local/share/lite-xl"
mkdir -vp \
"$untar_dir" \
#"$dest_config" \
"$dest_bin_dir" \
"$dest_share_dir"
"$HOME/.local/bin" \
"$HOME/.local/share/lite-xl"
tar -xzf "$tar_filepath" -C "$untar_dir"
mv -fv "$untar_subdir/lite-xl" "$dest_bin_dir/lite-xl"
mv -fvT "$untar_subdir/data" "$dest_share_subdir"
rm -fr "$tar_file" "$untar_subdir"
wget "$tar_url" -O "$tar_filepath" && \
wget "$lpm_url" -O "$HOME/.local/bin/lpm" && \
chmod +x "$HOME/.local/bin/lpm" && \
tar -xzf "$tar_filepath" -C "$untar_dir" && \
cp -vf "$untar_dir/lite-xl/lite-xl" "$HOME/.local/bin/" && \
cp -vfr "$untar_dir"/lite-xl/data/* "$HOME/.local/share/lite-xl/"
# echo -e "\nexport LITE_SCALE=1 # https://github.com/lite-xl/lite-xl/issues/1173\n" >> $HOME/.profile
cat << EOF > "$dest_share_dir/applications/org.lite_xl.lite_xl.desktop"
cat << EOF > "$HOME/.local/share/applications/org.lite_xl.lite_xl.desktop"
[Desktop Entry]
Type=Application
Name=Lite XL
Comment=A lightweight text editor written in Lua
Exec=env LITE_SCALE=1 ${dest_bin_dir}/lite-xl %F
Exec=$HOME/.local/bin/lite-xl %F
Icon=lite-xl
Terminal=false
StartupWMClass=lite-xl
@@ -48,53 +50,6 @@ EOF
sudo update-desktop-database && \
xdg-desktop-menu forceupdate
echo
echo "==============================================="
echo "Installing lite-xl plugins..."
echo "https://github.com/lite-xl/lite-xl-plugins"
echo "==============================================="
echo
download_plugin() {
echo "- $1"
curl -s "https://raw.githubusercontent.com/lite-xl/lite-xl-plugins/master/plugins/$1.lua" \
> "$dest_share_subdir/plugins/$1.lua"
}
download_plugin "align_carets"
download_plugin "autosaveonfocuslost"
download_plugin "bracketmatch"
download_plugin "copyfilelocation"
download_plugin "dragdropselected"
download_plugin "fontconfig"
download_plugin "force_syntax"
download_plugin "lfautoinsert"
download_plugin "markers"
download_plugin "memoryusage"
download_plugin "minimap"
download_plugin "navigate"
download_plugin "openselected"
download_plugin "restoretabs"
download_plugin "smoothcaret"
# echo "- eofnewline-xl"
# curl -s "https://raw.githubusercontent.com/bokunodev/lite_modules/master/plugins/eofnewline-xl.lua" \
# > "$dest_share_subdir/plugins/eofnewline-xl.lua"
echo "- language_env"
curl -s "https://raw.githubusercontent.com/anthonyaxenov/lite-xl-env-syntax/master/language_env.lua" \
> "$dest_share_subdir/plugins/language_env.lua"
echo "- language_ignore"
curl -s "https://raw.githubusercontent.com/anthonyaxenov/lite-xl-ignore-syntax/master/language_ignore.lua" \
> "$dest_share_subdir/plugins/language_ignore.lua"
# echo "- language-containerfile"
# git clone -q "https://github.com/FilBot3/lite-xl-language-containerfile.git" \
# "$dest_share_subdir/plugins/language_containerfile"
echo
echo "Finish!"
echo "- $dest_bin_dir/lite-xl"
echo "- $dest_share_subdir"
echo

View File

@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
##makedesc: Install mariadb (latest) and php-mysql + phpMyAdmin (if php is installed)
echo

66
install/nerd-fonts Executable file
View File

@@ -0,0 +1,66 @@
#!/usr/bin/env bash
##makedesc: Install nerd-fonts
set -eo pipefail
#TODO nokia-sans
downloadPath="$HOME/install/nerd-fonts"
installPath="$HOME/.local/share/fonts/"
url="https://github.com/ryanoasis/nerd-fonts/releases/latest/download"
fonts=(
FiraCode
FiraMono
JetBrainsMono
Meslo
Noto
RobotoMono
Ubuntu
UbuntuMono
UbuntuSans
)
install() {
echo
echo "==============================================="
echo "Installing nerd-fonts"
echo "==============================================="
echo
[[ -d "$downloadPath" ]] || mkdir -p "$downloadPath"
for fontname in "${fonts[@]}"; do
fontdir="$installPath/Nerd-$fontname"
wget "$url/$fontname.tar.xz" -O "$downloadPath/$fontname.tar.xz"
[[ -d "$installPath/$fontname" ]] || mkdir -p "$fontdir"
tar -xJf "$downloadPath/$fontname.tar.xz" -C "$fontdir"
done
fc-cache -vf "$installPath"
echo
echo "Finish!"
echo
}
remove() {
echo
echo "==============================================="
echo "Removing nerd-fonts"
echo "==============================================="
echo
find "$installPath" -type d -name "Nerd-*" -exec rm -rf {} +
fc-cache -vf "$installPath"
echo
echo "Finish!"
echo
}
case "$1" in
r|remove|d|delete|p|purge) remove ;;
*) install ;;
esac

View File

@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
##makedesc: Install nodejs + npm via nvm
echo

View File

@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
##makedesc: Install ntfy (latest) + ppa
echo

80
install/nvim Executable file
View File

@@ -0,0 +1,80 @@
#!/usr/bin/env bash
##makedesc: Install nvim + lazyvim
set -eo pipefail
# https://www.lazyvim.org/installation
# https://www.devas.life/effective-neovim-setup-for-web-development-towards-2024/
# TODO https://github.com/rockerBOO/awesome-neovim
# TODO https://docs.astronvim.com
url="https://github.com/neovim/neovim/releases/latest/download/nvim-linux-x86_64.tar.gz"
downloadPath="$HOME/install"
downloadTarGz="$downloadPath/nvim.tar.gz"
installPath="/opt/nvim"
cfgPath="$HOME/.config/nvim"
nvimDataPaths=(
"$cfgPath"
"$HOME"/.local/share/nvim
"$HOME"/.local/state/nvim
"$HOME"/.cache/nvim
)
backup() {
echo "Backup configuration files..."
t=$(date +'%s')
for path in "${nvimDataPaths[@]}"; do
[[ -d "$path" ]] && cp -v "$path" "$path-$t.bak"
done
echo "Done"
}
install() {
echo
echo "==============================================="
echo "Installing neovim"
echo "==============================================="
echo
backup
wget "$url" -O "$downloadTarGz"
tar -xzf "$downloadTarGz" -C "$downloadPath"
sudo rm -rf "$installPath"
sudo mv "$downloadPath/nvim-linux-x86_64" "$installPath"
git clone --depth=1 --single-branch https://github.com/LazyVim/starter "$cfgPath"
rm -rf "$cfgPath/.git"
sudo update-desktop-database
xdg-desktop-menu forceupdate
echo
echo "Finish!"
nvim -v
echo
}
remove() {
echo
echo "==============================================="
echo "Removing nerd-fonts"
echo "==============================================="
echo
find "$downloadPath" -type d -name "Nerd-*" -exec rm -rf {} +
fc-cache -vf "$downloadPath"
echo
echo "Finish!"
echo
}
case "$1" in
b|backup) backup ;;
r|remove|d|delete|p|purge) remove ;;
*) install ;;
esac
# export PATH="$PATH:/opt/nvim-linux-x86_64/bin"

View File

@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
##makedesc: Install obs-studio (latest snap)
echo

View File

@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
##makedesc: Install omz (latest)
echo

View File

@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
##makedesc: Install omz fancy (powerline10k + MesloLGS font)
# https://gist.github.com/anthonyaxenov/b8460935d06b9f0da72def03d0f26515

View File

@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
##makedesc: Install openvpn v2.6.3 (src)
source "$( dirname $(readlink -e -- "${BASH_SOURCE}"))/../helpers.sh" || exit 255

View File

@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
##makedesc: Install papirus-icon-theme (latest)
source "$( dirname $(readlink -e -- "${BASH_SOURCE}"))/../helpers.sh" || exit 255

View File

@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
##makedesc: Install postgresql (latest) and php-pgsql (if php is installed)
source "$( dirname $(readlink -e -- "${BASH_SOURCE}"))/../helpers.sh" || exit 255

View File

@@ -1,16 +1,16 @@
#!/bin/bash
##makedesc: Install php v8.3 + ppa
#!/usr/bin/env bash
##makedesc: Install php v8.4
[ $1 ] && PHPVER="$1" || PHPVER="8.3"
[ "$1" ] && PHPVER="$1" || PHPVER="8.4"
echo
echo "==============================================="
echo "Installing php${PHPVER}..."
echo "==============================================="
echo
sudo LC_ALL=C.UTF-8 add-apt-repository -y ppa:ondrej/php
sudo apt install -y --autoremove \
php${PHPVER} \
php${PHPVER}-fpm \
php${PHPVER}-dev \
php${PHPVER}-apcu \
php${PHPVER}-bcmath \
php${PHPVER}-cli \
@@ -24,6 +24,7 @@ sudo apt install -y --autoremove \
php${PHPVER}-mysql \
php${PHPVER}-opcache \
php${PHPVER}-pgsql \
php${PHPVER}-simplexml \
php${PHPVER}-soap \
php${PHPVER}-sqlite3 \
php${PHPVER}-xdebug \

View File

@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
##makedesc: Install psalm
echo

View File

@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
##makedesc: Install php-spx
echo

View File

@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
##makedesc: Install phpcs + php-cs-fixer
echo

View File

@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
##makedesc: Install phpmd
echo

View File

@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
##makedesc: Install phpstan
echo

View File

@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
##makedesc: Install phpunit
echo

View File

@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
##makedesc: Install postman (latest)
source "$( dirname $(readlink -e -- "${BASH_SOURCE}"))/../helpers.sh" || exit 255
@@ -19,7 +19,7 @@ download "https://dl.pstmn.io/download/latest/linux64" "$HOME/install/postman.ta
[Desktop Entry]
Name=Postman
Exec=$HOME/.local/bin/postman %U
Icon=$HOME/install/Postman/app/icons/icon_128x128.png
Icon=$HOME/install/Postman/app/resources/app/assets/icon.png
Categories=Development,Network
Terminal=false
Type=Application

View File

@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
##makedesc: Install qt5
echo

View File

@@ -1,7 +1,7 @@
#!/bin/bash
##makedesc: Install rustdesk client v1.1.9 (deb)
#!/usr/bin/env bash
##makedesc: Install rustdesk client v1.4.2 (deb)
[ $1 ] && RDVER="$1" || RDVER="1.1.9"
[ "$1" ] && RDVER="$1" || RDVER="1.4.2"
echo
echo "==============================================="
echo "Installing rustdesk v$RDVER..."
@@ -12,9 +12,13 @@ echo
deb_path="$HOME/install"
deb_name="rustdesk-$RDVER.deb"
mkdir -p $deb_path
mkdir -p "$deb_path"
deb="$deb_path/$deb_name"
sudo apt install -y libxdo3 python3-pip && \
wget "https://github.com/rustdesk/rustdesk/releases/download/$RDVER/$deb_name" -O $deb && \
sudo dpkg -i $deb
sudo apt install -y libxdo3 python3-pip
wget "https://github.com/rustdesk/rustdesk/releases/download/$RDVER/$deb_name" -O "$deb"
sudo dpkg -i "$deb"
# flatpak install -y com.rustdesk.RustDesk
# https://develop.kde.org/docs/administration/portal-permissions/
# flatpak permission-set kde-authorized remote-desktop com.rustdesk.RustDesk yes

View File

@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
##makedesc: Install bunch of software from snap
echo

View File

@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
##makedesc: Install Sublime Merge
source "$( dirname $(readlink -e -- "${BASH_SOURCE}"))/../helpers.sh" || exit 255

View File

@@ -1,31 +1,34 @@
#!/bin/bash
#!/usr/bin/env bash
##makedesc: Install Sublime Text
source "$( dirname $(readlink -e -- "${BASH_SOURCE}"))/../helpers.sh" || exit 255
# https://www.sublimetext.com/download
# https://gist.github.com/skoqaq/3f3e8f28e23c881143cef9cf49d821ff
# https://gist.axenov.dev/anthony/sublime
# https://gist.axenov.dev/anthony/sublime2
# https://gist.github.com/lugrus2000/1fc55158b87f94d799392a6dd1ac0ce2
# https://gist.github.com/maboloshi/feaa63c35f4c2baab24c9aaf9b3f4e47
[ "$1" ] && STVER="$1" || STVER='4189'
[ "$1" ] && STVER="$1" || STVER='4200'
title
mkdir -p "$HOME/install"
DEB_PATH="$HOME/install/sublime-text_build-${SMVER}_amd64.deb"
DEB_PATH="$HOME/install/sublime-text_build-${STVER}_amd64.deb"
BIN_PATH="/opt/sublime_text/sublime_text"
if [[ ! -f "$DEB_PATH" ]]; then
download https://download.sublimetext.com/sublime-text_build-${STVER}_amd64.deb "$DEB_PATH"
download "https://download.sublimetext.com/sublime-text_build-${STVER}_amd64.deb" "$DEB_PATH"
fi
sudo dpkg -i "$DEB_PATH"
sudo cp -f $BIN_PATH $BIN_PATH.old
sudo cp -f "$BIN_PATH" "$BIN_PATH.old"
if [[ $STVER = 4169 ]]; then
echo "00489f39: c640 0501 4885 c9" | sudo xxd -r - $BIN_PATH
echo "00489f39: c640 0501 4885 c9" | sudo xxd -r - "$BIN_PATH"
elif [[ $STVER = 4200 ]]; then
sudo sed -i 's#\x0F\xB6\x51\x05\x83\xF2\x01#\xC6\x41\x05\x01\xB2\x00\x90#' "$BIN_PATH"
else
sudo sed -i 's#\x80\x79\x05\x00\x0F\x94\xC2#\xC6\x41\x05\x01\xB2\x00\x90#' $BIN_PATH
sudo sed -i 's#\x80\x79\x05\x00\x0F\x94\xC2#\xC6\x41\x05\x01\xB2\x00\x90#' "$BIN_PATH"
fi
echo

20
install/suld Executable file
View File

@@ -0,0 +1,20 @@
#!/usr/bin/env bash
##makedesc: Samsung Unified Linux Driver repo
source "$( dirname $(readlink -e -- "${BASH_SOURCE}"))/../helpers.sh" || exit 255
# https://www.bchemnet.com/suldr/
# https://www.bchemnet.com/suldr/supported.html
title
mkdir -vp "$HOME/install"
sudo bash -c 'echo "deb https://www.bchemnet.com/suldr/ debian extra" >> /etc/apt/sources.list.d/samsung.list'
download \
https://www.bchemnet.com/suldr/pool/debian/extra/su/suldr-keyring_3_all.deb \
"$HOME/install/suldr-keyring_3_all.deb"
sudo dpkg -i "$HOME/install/suldr-keyring_3_all.deb"
apt_install suld-driver2-1.00.39
success "Samsung Unified Linux Driver installed!"
info "Don't forget to connect your Samsung printer"
info "See more info here: https://www.bchemnet.com/suldr/"

View File

@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
##makedesc: Install syncthing (latest) + ppa
echo

View File

@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
##makedesc: Install telebit (latest)
echo

View File

@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
##makedesc: Install telegram (latest)
echo

33
install/tilt Executable file
View File

@@ -0,0 +1,33 @@
#!/bin/bash
mkdir -p ~/install/tilt ~/.local/bin
cd ~/install/tilt
KUBECTL_VERSION=$(curl -L -s https://dl.k8s.io/release/stable.txt)
curl -LO "https://dl.k8s.io/release/$KUBECTL_VERSION/bin/linux/amd64/kubectl"
curl -LO "https://dl.k8s.io/release/$KUBECTL_VERSION/bin/linux/amd64/kubectl.sha256"
echo "$(cat kubectl.sha256) kubectl" | sha256sum --check
chmod +x kubectl
cp ./kubectl ~/.local/bin/kubectl
################################################################################
CTLPTL_URL=$(curl -s "https://api.github.com/repos/tilt-dev/ctlptl/releases/latest" \
| jq -r '.assets.[] | select(.name | test("linux.x86_64.tar.gz")).browser_download_url')
curl -fsSL "$CTLPTL_URL" | tar -xz -C ~/.local/bin ctlptl
# chmod +x ~/.local/bin/ctlptl
################################################################################
TILT_URL=$(curl -s "https://api.github.com/repos/tilt-dev/tilt/releases/latest" \
| jq -r '.assets.[] | select(.name | test("linux.x86_64.tar.gz")).browser_download_url')
curl -fsSL "$TILT_URL" | tar -xz -C ~/.local/bin tilt
# chmod +x ~/.local/bin/tilt
cd -
echo "Version of ctlptl = $(ctlptl version)"
echo "Version of tilt = $(tilt version)"
echo "Version of kubectl:"
kubectl version

View File

@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
##makedesc: Install ulauncher (latest) + ppa
echo
@@ -7,5 +7,7 @@ echo "Installing ulauncher (latest) + ppa..."
echo "==============================================="
echo
sudo add-apt-repository -y ppa:agornostal/ulauncher
sudo apt install -y --autoremove ulauncher
sudo add-apt-repository universe -y
sudo add-apt-repository ppa:agornostal/ulauncher -y
sudo apt update
sudo apt install ulauncher

View File

@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
##makedesc: Install Vivaldi + ppa
# https://repo.vivaldi.com
@@ -11,11 +11,9 @@ echo "Installing Vivaldi + ppa..."
echo "==============================================="
echo
wget -qO- https://repo.vivaldi.com/archive/linux_signing_key.pub \
| gpg --dearmor \
| sudo dd of=/usr/share/keyrings/vivaldi-browser.gpg
echo "deb [signed-by=/usr/share/keyrings/vivaldi-browser.gpg arch=$(dpkg --print-architecture)] https://repo.vivaldi.com/archive/deb/ stable main" \
| sudo dd of=/etc/apt/sources.list.d/vivaldi-archive.list
wget -qO- https://repo.vivaldi.com/archive/linux_signing_key.pub | gpg --dearmor > packages.vivaldi.gpg
sudo install -o root -g root -m 644 packages.vivaldi.gpg /etc/apt/trusted.gpg.d
sudo sh -c 'echo "deb [arch=amd64,armhf signed-by=/etc/apt/trusted.gpg.d/packages.vivaldi.gpg] https://repo.vivaldi.com/archive/deb stable main" > /etc/apt/sources.list.d/vivaldi.list'
rm -f packages.vivaldi.gpg
sudo apt update && sudo apt install vivaldi-stable

View File

@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
##makedesc: VSCode deb-package
source "$( dirname $(readlink -e -- "${BASH_SOURCE}"))/../helpers.sh" || exit 255

View File

@@ -1,5 +1,5 @@
#!/bin/bash
##makedesc: Install wine (latest) + ppa (focal)
#!/usr/bin/env bash
##makedesc: Install wine (latest) + ppa
echo
echo "==============================================="
@@ -9,6 +9,6 @@ echo
sudo dpkg --add-architecture i386
wget -qO- https://dl.winehq.org/wine-builds/winehq.key | sudo apt-key add -
sudo add-apt-repository -y 'deb https://dl.winehq.org/wine-builds/ubuntu/ focal main'
sudo add-apt-repository -y "deb https://dl.winehq.org/wine-builds/ubuntu/ $(lsb_release -cs 2>/dev/null) main"
sudo apt install -y --autoremove winehq-stable
wine --version

View File

@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
##makedesc: Install youtube-dl (src)
# https://github.com/ytdl-org/youtube-dl#installation
@@ -23,7 +23,12 @@ installed() {
mkdir -p "$HOME/install/youtube-dl" "$HOME/.local/bin"
if installed git; then
if [[ -d "$HOME/install/youtube-dl" ]]; then
cd "$HOME/install/youtube-dl"
git pull
else
git clone https://github.com/ytdl-org/youtube-dl.git "$HOME/install/youtube-dl" --depth=1 --single-branch
fi
else
! installed wget && sudo apt install -y wget
wget https://github.com/ytdl-org/youtube-dl/archive/refs/heads/master.zip -O "$HOME/install/youtube-dl.zip" && \

View File

@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
##makedesc: Install ytdlcue
# https://gist.github.com/anthonyaxenov/8e11f18493c8419ee7abc94a8ea0cfaf

View File

@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
##makedesc: Install zint (latest)
echo

View File

@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
##makedesc: Install vanilla zsh
echo

View File

@@ -1,2 +0,0 @@
##flameshot: [TODO] [PACK] qt5 + flameshot from source
flameshot: qt5 flameshot-build

View File

@@ -1,2 +1,2 @@
##phptools: [PACK] Install only php tooling (composer, phpunit, psalm, phpcs, php-cs-fixer, php-spx, phpmd)
phptools: composer php-psalm php-spx phpcs phpmd phpstan phpunit
##phptools: [PACK] Install only php tooling (composer, phpunit, psalm, phpcs, php-cs-fixer, phpmd)
phptools: composer php-psalm phpcs phpmd phpstan phpunit

View File

@@ -1,19 +1,6 @@
# Shell scripts
## Russian
# Shell-скрипты
Эти скрипты я писал в разное время для решения разных задач.
Чтобы они не растерялись по репозиториям и носителям, я решил собрать их здесь в одну кучу.
Я всегда использую Ubuntu в качестве своих настольных и серверных ОС, поэтому все эти скрипты писались и использовались в этих средах с версий 18.*.
Многие скрипты зависимы от [io.sh](/io.sh).
## English
These scripts were written at different times to solve different my own problems.
I decided to collect them here in a heap so that they are not lost in repositories and media.
I always use Ubuntu as my desktop and server OS, so all these scripts has been written and used in these environments since version 18.*.
Many scripts depending on [io.sh](/io.sh).

1
scripts/ddns/afraid/.env Executable file
View File

@@ -0,0 +1 @@
AFRAID_TOKEN=6qfkK3VmHf7t4PwvTUJtxNEQ

25
scripts/ddns/afraid/update.sh Executable file
View File

@@ -0,0 +1,25 @@
#!/bin/bash
# shellcheck disable=SC1091
thisdir="$( dirname "$(readlink -e -- "${BASH_SOURCE[0]}")")"
log() {
timestamp="$(date +'%Y-%m-%d %H:%M:%S')"
datestamp="$(date +'%Y-%m-%d')"
[ ! -d "$thisdir/log" ] && mkdir "$thisdir/log"
echo "[$timestamp] $*" >> "$thisdir/log/$datestamp.log"
}
[ ! -f "$thisdir/.env" ] && {
log "ERROR: .env not exists"
exit 1
}
source "$thisdir/.env"
[ -z "$AFRAID_TOKEN" ] && {
log "ERROR: env var AFRAID_TOKEN not specified"
exit 1
}
result=$(curl -s "http://sync.afraid.org/u/${AFRAID_TOKEN}/")
log "$result"

View File

@@ -0,0 +1,3 @@
DUCK_TOKEN=
DUCK_DOMAINS=
DUCK_IP=

2
scripts/ddns/duckdns/.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
.env
*.log

View File

@@ -0,0 +1,9 @@
#!/bin/bash
thisdir="$( dirname "$(readlink -e -- "${BASH_SOURCE[0]}")")"
# https://www.duckdns.org/install.jsp
croncmd="$thisdir/update.sh"
cronjob="*/30 * * * * $croncmd" # every 30 min
( crontab -l | grep -v -F "$croncmd" ; echo "$cronjob" ) | crontab -
cp -f "$thisdir/.env.example" "$thisdir/.env"

View File

@@ -0,0 +1,3 @@
#!/bin/bash
( crontab -l | grep -v -F "duckdns" ) | crontab -

30
scripts/ddns/duckdns/update.sh Executable file
View File

@@ -0,0 +1,30 @@
#!/bin/bash
# shellcheck disable=SC1091
thisdir="$( dirname "$(readlink -e -- "${BASH_SOURCE[0]}")")"
log() {
timestamp="$(date +'%Y-%m-%d %H:%M:%S')"
datestamp="$(date +'%Y-%m-%d')"
[ ! -d "$thisdir/log" ] && mkdir "$thisdir/log"
echo "[$timestamp] $*" >> "$thisdir/log/$datestamp.log"
}
[ ! -f "$thisdir/.env" ] && {
log "ERROR: .env not exists"
exit 1
}
source "$thisdir/.env"
[ -z "$DUCK_TOKEN" ] && {
log "ERROR: env var DUCK_TOKEN not specified"
exit 1
}
[ -z "$DUCK_DOMAINS" ] && {
log "ERROR: env var DUCK_DOMAINS not specified"
exit 1
}
result=$(curl -s "https://www.duckdns.org/update?domains=${DUCK_DOMAINS}&token=${DUCK_TOKEN}&ip=${DUCK_IP}")
log "$result"

5
scripts/disable-ipv6.sh Executable file
View File

@@ -0,0 +1,5 @@
#!/usr/bin/env bash
sudo sysctl -w net.ipv6.conf.all.disable_ipv6="$1"
sudo sysctl -w net.ipv6.conf.default.disable_ipv6="$1"
sudo sysctl -w net.ipv6.conf.lo.disable_ipv6="$1"

View File

@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# https://gist.github.com/anthonyaxenov/c16e1181d4b8a8644c57ec8a1f6cf21c
#########################################################################
# #

11
scripts/display-rotate.sh Executable file
View File

@@ -0,0 +1,11 @@
#!/usr/bin/env bash
# X11:
# xrandr --listactivemonitors
# xrandr --output $OUTPUT --rotate (left|right|normal|...)
# Wayland KDE: https://www.reddit.com/r/kde/comments/11vrbwc/how_do_i_rotate_the_screen_on_kde_with_wayland/
# kscreen-doctor --outputs
OUTPUT='HDMI-A-1'
[ "$1" ] && DIRECTION="$1" || DIRECTION="normal" # (left|right|normal|inverted)
kscreen-doctor "output.$OUTPUT.rotation.$DIRECTION"

View File

@@ -0,0 +1,47 @@
#!/usr/bin/env bash
# Original filename: docker-volume-snapshot
# Author: Juned Khatri
# License: MIT
# Repo: https://github.com/junedkhatri31/docker-volume-snapshot
set -e -o pipefail
programname=`basename "$0"`
display_usage() {
echo "usage: $programname (create|restore) source destination"
echo " create create snapshot file from docker volume"
echo " restore restore snapshot file to docker volume"
echo " source source path"
echo " destination destination path"
echo
echo "Tip: Supports tar's compression algorithms automatically"
echo " based on the file extention, for example .tar.gz"
echo
echo "Examples:"
echo "docker-volume-snapshot create xyz_volume xyz_volume.tar"
echo "docker-volume-snapshot create xyz_volume xyz_volume.tar.gz"
echo "docker-volume-snapshot restore xyz_volume.tar xyz_volume"
echo "docker-volume-snapshot restore xyz_volume.tar.gz xyz_volume"
}
case "$1" in
"create")
if [[ -z "$2" || -z "$3" ]]; then display_usage; exit 1; fi
directory=`dirname "$3"`
if [ "$directory" == "." ]; then directory=$(pwd); fi
filename=`basename "$3"`
docker run --rm -v "$2:/source" -v "$directory:/dest" busybox tar cvaf "/dest/$filename" -C /source .
;;
"restore")
if [[ -z "$2" || -z "$3" ]]; then display_usage; exit 1; fi
directory=`dirname "$2"`
if [ "$directory" == "." ]; then directory=$(pwd); fi
filename=`basename "$2"`
docker run --rm -v "$3:/dest" -v "$directory:/source" busybox tar xvf "/source/$filename" -C /dest
;;
*)
display_usage
exit 1 # Command to come out of the program with status 1
;;
esac

View File

@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# https://obsproject.com/kb/virtual-camera-troubleshooting
# https://obsproject.com/forum/threads/how-to-start-virtual-camera-without-sudo-privileges.139783/

11
scripts/fix-repo-vivaldi.sh Executable file
View File

@@ -0,0 +1,11 @@
#!/usr/bin/env bash
# https://gist.github.com/pkorpine/16fcdbe070222cf1d99e67cf542e60c2
sudo rm -rf /etc/apt/sources.list.d/vivaldi*
cd /tmp
wget -qO- https://repo.vivaldi.com/archive/linux_signing_key.pub | gpg --dearmor > packages.vivaldi.gpg
sudo install -o root -g root -m 644 packages.vivaldi.gpg /etc/apt/trusted.gpg.d
sudo sh -c 'echo "deb [arch=amd64,armhf signed-by=/etc/apt/trusted.gpg.d/packages.vivaldi.gpg] https://repo.vivaldi.com/archive/deb stable main" > /etc/apt/sources.list.d/vivaldi.list'
rm -f packages.vivaldi.gpg
sudo apt update

12
scripts/fix-repo-vscode.sh Executable file
View File

@@ -0,0 +1,12 @@
#!/usr/bin/env bash
# https://code.visualstudio.com/docs/setup/linux
sudo rm -rf /etc/apt/sources.list.d/vscode*
cd /tmp
sudo apt install wget gpg apt-transport-https
wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > packages.microsoft.gpg
sudo install -D -o root -g root -m 644 packages.microsoft.gpg /etc/apt/keyrings/packages.microsoft.gpg
echo "deb [arch=amd64,arm64,armhf signed-by=/etc/apt/keyrings/packages.microsoft.gpg] https://packages.microsoft.com/repos/code stable main" |sudo tee /etc/apt/sources.list.d/vscode.list > /dev/null
rm -f packages.microsoft.gpg
sudo apt update

View File

@@ -1,48 +1,57 @@
#!/bin/bash
#!/usr/bin/env bash
# Очистка места на диске
# https://gist.github.com/anthonyaxenov/02c00c965be4eb5bb163a153abdf4c2b
# https://itsfoss.com/free-up-space-ubuntu-linux/
df -h
echo ""
echo
echo
df -hx tmpfs
echo
echo
echo "[1/5] Removing apt caches and unused packages"
echo ""
echo
sudo apt autoremove --purge
sudo apt autoclean
sudo apt clean
echo ""
echo "[2/5] Removing old journalctl logs"
echo ""
echo
echo "[2/5] Removing old system logs"
echo
sudo journalctl --vacuum-time=1d
sudo rm -rf /var/log/journal/user-*@*
sudo rm -rf /var/log/journal/system*@*
sudo rm /var/log/{syslog,dmesg,btmp}.*
sudo rm /var/log/{auth,dpkg,kern,alternatives,dmesg}.log.*
echo ""
echo
echo "[3/5] Cleaning user trash and thumbnails"
echo ""
echo
rm -rf ~/.local/share/Trash/files/*
rm -rf ~/.cache/thumbnails/*
echo ""
echo
echo "[4/5] Cleaning out dangling docker objects"
echo ""
echo
docker system prune -f
# docker system prune -af
echo ""
echo
echo "[5/5] Removing disabled unused snaps"
echo ""
echo
sudo snap list --all | awk '/disabled/{print $1, $3}' |
while read snapname revision; do
sudo snap list --all \
| awk '/disabled/{print $1, $3}' \
| while read snapname revision; do
sudo snap remove "$snapname" --revision="$revision"
done
echo ""
echo ""
df -h
echo
echo
df -hx tmpfs
echo
echo

View File

@@ -0,0 +1,111 @@
# Argument parser for bash scripts v1.6
## Usage
```shell
# 1. add these lines after shebang:
__RAW_ARGS__=("$@")
source args.sh
# 2. read arguments as flags:
arg a 1 flag_a
echo "Flag -a has value '$flag_a'"
echo "Flag -a has value '$(arg a 1)'"
arg b 1 flag_b
echo "Flag -b has value '$flag_b'"
echo "Flag -b has value '$(arg b 1)'"
arg c 1 flag_c
echo "Flag -c has value '$flag_c'"
echo "Flag -c has value '$(arg c 1)'"
arg d 1 flag_d
echo "Flag -d has value '$flag_d'"
echo "Flag -d has value '$(arg d 1)'"
argl flag1 1 flag_1
echo "Flag --flag1 has value '$flag_1'"
echo "Flag --flag1 has value '$(argl flag1 1)'"
argl flag2 1 flag_2
echo "Flag --flag2 has value '$flag_2'"
echo "Flag --flag2 has value '$(argl flag2 1)'"
# 3. and/or read arguments' values:
arg a 0 arg_a
echo "Arg -a has value '$arg_a'"
echo "Arg -a has value '$(arg a 0)'"
arg b 0 arg_b
echo "Arg -b has value '$arg_b'"
echo "Arg -b has value '$(arg b 0)'"
argl arg1 0 arg_1
echo "Arg --arg1 has value '$arg_1'"
echo "Arg --arg1 has value '$(argl arg1 0)'"
argl arg2 0 arg_2
echo "Arg --arg2 has value '$arg_2'"
echo "Arg --arg2 has value '$(argl arg2 0)'"
```
## How it works
1. Short arguments can be specified contiguously or separately
and their order does not matter, but before each of them
(or the first of them) one leading dash must be specified.
> Valid combinations: `-a -b -c`, `-cba`, `-b -azc "value of z"`
2. Short arguments can have values and if are - value must go
next to argument itself.
> Valid combinations: `-ab avalue`, `-ba avalue`, `-a avalue -b`
3. Long arguments cannot be combined like short ones and each
of them must be specified separately with two leading dashes.
> Valid combinations: `--foo --bar`, `--bar --foo`
4. Long arguments can have a value which must be specified after `=`.
> Valid combinations: `--foo value --bar`, `--bar --foo=value`
5. If arg value may contain space then value must be "double-quoted".
6. You can use arg() or argl() to check presence of any arg, no matter
if it has value or not.
More info:
* 🇷🇺 [axenov.dev/bash-args](https://axenov.dev/bash-args/)
* 🇺🇸 [axenov.dev/en/bash-processing-arguments-in-a-script-when-called-from-the-shell/](https://axenov.dev/en/bash-processing-arguments-in-a-script-when-called-from-the-shell)
Tested in Ubuntu 20.04.2 LTS in:
```
bash 5.0.17(1)-release (x86_64-pc-linux-gnu) and later
zsh 5.8 (x86_64-ubuntu-linux-gnu) and later
```
## Version history
```
v1.0 - initial
v1.1 - arg(): improved skipping uninteresting args
- arg(): check next arg to be valid value
v1.2 - removed all 'return' statements
- arg(): error message corrected
- new examples
v1.3 - argl(): improved flag check
- some text corrections
v1.4 - new function argn()
- some text corrections
v1.5 - arg(), grep_match(): fixed searching for -e argument
- grep_match(): redirect output into /dev/null
v1.6 - removed useless argn()
- arg() and argl() refactored and now support values with whitespaces
```

Some files were not shown because too many files have changed in this diff Show More