Compare commits

35 Commits

Author SHA1 Message Date
7ddcc73454 KDE Backports 2022-09-28 22:16:12 +08:00
a60d66a84d Dotfiles examples 2022-09-28 22:11:55 +08:00
0f118e015e inotifywait-cp 2022-09-28 07:41:07 +08:00
af93865525 add-apt-repository -y 2022-09-28 07:40:55 +08:00
8ffc2dfe32 Makefile generation improved 2022-08-26 08:25:55 +08:00
c1150af922 Descriptions parsing improved 2022-08-25 22:33:02 +08:00
7185a3cf7f Small generator improvements, 'make test' as an alias for ./gen-makefile 2022-08-25 12:40:36 +08:00
c48971a858 Docker (un)install scripts 2022-08-25 12:40:21 +08:00
aaf88521b3 Default make target 2022-08-19 21:32:23 +08:00
355953dc35 File templates (KDE) 2022-08-19 21:25:46 +08:00
43f6c8c9e9 New types of make rules + omz refactorings 2022-08-19 20:58:15 +08:00
2c9af9b1c5 editorconfig 2022-08-19 20:57:45 +08:00
4b677a9ab8 ntfy 2022-07-21 22:04:08 +08:00
af2a7f3c80 php + canon ppa 2022-07-15 22:59:45 +08:00
d3263e6da5 php + composer pack and fixes 2022-07-12 23:20:11 +08:00
bdcd8e6bec Scripts -> tools + fresh backup script 2022-07-10 14:42:40 +08:00
a6e0696e31 Fixed postman 2022-07-05 20:50:48 +08:00
f61f09b83f Git updated 2022-07-05 17:05:34 +08:00
6bb9442c43 Small updates 2022-07-05 10:53:41 +08:00
c54e71d28c Rustdesk updated 2022-07-05 10:52:27 +08:00
8d64efba39 Postman fixed and updated 2022-07-05 10:51:43 +08:00
cc2ab13310 Lamp pack updated 2022-07-05 10:51:32 +08:00
113c1df71b New qt5, flameshot pack draft 2022-07-05 10:51:17 +08:00
24f30e8eff New papirus 2022-07-05 10:50:54 +08:00
bcb1111a0a Zsh and omz as pack (updated) 2022-07-05 10:50:35 +08:00
3fa1a4d09d New libreoffice script 2022-07-05 10:50:07 +08:00
6c11b5d76d Removed libreoffice and shit from apt 2022-07-05 10:49:39 +08:00
82559869fc Small fixes + WTFPLv2 2022-07-04 23:53:39 +08:00
4677b84a29 Initial docker sandbox 2022-07-04 23:25:31 +08:00
7008ec36b7 Apache fix 2022-07-04 23:24:43 +08:00
f2d41885af Composer cleanup 2022-07-04 23:24:27 +08:00
9972fc6d9d Updated chrome 2022-07-04 22:23:44 +08:00
f7ef85aad9 Updated apache2 2022-07-04 22:22:57 +08:00
3043a41365 Sort in apt 2022-07-04 22:22:37 +08:00
47c1e6d40b Fixed gen-makefile 2022-07-04 22:22:05 +08:00
57 changed files with 1425 additions and 592 deletions

4
.dockerignore Normal file
View File

@@ -0,0 +1,4 @@
.git
.gitignore
.dockerignore
README.md

13
.editorconfig Normal file
View File

@@ -0,0 +1,13 @@
root = true
[*]
end_of_line = lf
insert_final_newline = true
[{install/*, uninstall/*, upgrade/*}]
indent_style = space
indent_size = 4
[{packs/*, Makefile*}]
indent_style = tab
indent_size = 4

1
.gitignore vendored
View File

@@ -1 +1,2 @@
*.bak
*.log

27
Dockerfile Normal file
View File

@@ -0,0 +1,27 @@
FROM ubuntu:22.04
RUN apt update && \
apt -y install \
apt-transport-https \
apt-utils \
bsdmainutils \
curl \
dialog \
grep \
make \
man \
sudo \
wget
RUN adduser ivan \
--quiet \
--home=/home/ivan \
--ingroup=sudo \
--disabled-password \
--disabled-login
COPY ./ /home/ivan/my-env
RUN echo "ivan ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
USER ivan
WORKDIR /home/ivan/my-env

13
LICENSE Normal file
View File

@@ -0,0 +1,13 @@
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2022 Антон Аксенов <anthonyaxenov@gmail.com>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. You just DO WHAT THE FUCK YOU WANT TO.

211
Makefile
View File

@@ -1,114 +1,201 @@
# Autogenerated at 04.07.2022 22:11 using ./gen-makefile.sh
# Autogenerated at 28.09.2022 22:15 using ./gen-makefile
.DEFAULT_GOAL := help
##lamp: Apache + php + mariadb
#===============================================
# Scripts listed in ./packs
#===============================================
# [PACK] php + composer
composer: php composer-clean
# [TODO] [PACK] qt5 + flameshot from source
flameshot: qt5 flameshot-build
# [PACK] Apache + php + mariadb
lamp: apache php mariadb
##apache: Install apache2 (latest)
# [PACK] zsh + omz + powerline10k + MesloLGS font
omz: zsh omz-clean omz-fancy
chsh -s /usr/bin/zsh
@exec zsh
#===============================================
# Scripts listed in ./install
#===============================================
# Install apache2 (latest)
apache:
./install/apache
@./install/apache
##apt: Install bunch of software from apt
# Install bunch of software from apt
apt:
./install/apt
@./install/apt
##chrome: Install google chrome (latest)
# Install Canon Pixma MG2500 + ppa
canon-mg2500:
@./install/canon-mg2500
# Install google chrome (latest)
chrome:
./install/chrome
@./install/chrome
##composer: Install composer (latest)
composer:
./install/composer
# Install composer (latest)
composer-clean:
@./install/composer-clean
##docker: Install docker (latest) + docker-compose (latest) + ppa
# Install docker (latest) + docker-compose (latest) + ppa
docker:
./install/docker
@./install/docker
##droidcam: Install droidcam v1.8.2
# Install droidcam v1.8.2
droidcam:
./install/droidcam
@./install/droidcam
##droidcam-obs: Install droidcam-obs plugin v1.5.1
# Install droidcam-obs plugin v1.5.1
droidcam-obs:
./install/droidcam-obs
@./install/droidcam-obs
##git: Install git (latest)
# Install file templates (KDE)
file-templates-kde:
@./install/file-templates-kde
# [TODO] Build flameshot from src (latest)
flameshot-build:
@./install/flameshot-build
# Install git (latest)
git:
./install/git
@./install/git
##golang: Install golang v1.18.3
# Install golang v1.18.3
golang:
./install/golang
@./install/golang
##grubc: Install grub-customizer (latest) + ppa
# Install grub-customizer (latest) + ppa
grubc:
./install/grubc
@./install/grubc
##kde-appmenu: Install KDE Window AppMenu Applet
# Install KDE Window AppMenu Applet
kde-appmenu:
./install/kde-appmenu
@./install/kde-appmenu
##lite-xl: Install lite-xl v2.0.5 (draft)
# Install KDE Backports + ppa
kde-backports:
@./install/kde-backports
# Install libreoffice
libreoffice:
@./install/libreoffice
# Install lite-xl v2.0.5 (draft)
lite-xl:
./install/lite-xl
@./install/lite-xl
##mariadb: Install mariadb (latest) and php-mysql + phpMyAdmin (if php is installed)
# Install mariadb (latest) and php-mysql + phpMyAdmin (if php is installed)
mariadb:
./install/mariadb
@./install/mariadb
##nodejs: Install nodejs + npm via nvm
# Install nodejs + npm via nvm
nodejs:
./install/nodejs
@./install/nodejs
##pgsql: Install postgresql (latest) and php-pgsql (if php is installed)
# Install ntfy (latest) + ppa
ntfy:
@./install/ntfy
# Install omz (latest)
omz-clean:
@./install/omz-clean
# Install omz fancy (powerline10k + MesloLGS font)
omz-fancy:
@./install/omz-fancy
# Install papirus-icon-theme (latest)
papirus:
@./install/papirus
# Install postgresql (latest) and php-pgsql (if php is installed)
pgsql:
./install/pgsql
@./install/pgsql
##php: Install php v8.1 + ppa
# Install php v8.1 + ppa
php:
./install/php
@./install/php
##postman: Install postman (latest)
# Install postman (latest)
postman:
./install/postman
@./install/postman
##rustdesk: Install rustdesk v1.1.8 (deb)
# Install qt5
qt5:
@./install/qt5
# Install rustdesk client v1.1.9 (deb)
rustdesk:
./install/rustdesk
@./install/rustdesk
##snap: Install bunch of software from snap
# Install bunch of software from snap
snap:
./install/snap
@./install/snap
##syncthing: Install syncthing (latest) + ppa
# Install syncthing (latest) + ppa
syncthing:
./install/syncthing
@./install/syncthing
##telebit: Install telebit (latest)
# Install telebit (latest)
telebit:
./install/telebit
@./install/telebit
##ulauncher: Install ulauncher (latest) + ppa
# Install ulauncher (latest) + ppa
ulauncher:
./install/ulauncher
@./install/ulauncher
##wine: Install wine (latest) + ppa (focal)
# Install wine (latest) + ppa (focal)
wine:
./install/wine
@./install/wine
##zint: Install zint (latest)
# Install zint (latest)
zint:
./install/zint
@./install/zint
##zsh: Install zsh + omz (latest)
# Install vanilla zsh
zsh:
./install/zsh
@./install/zsh
#===============================================
# Scripts listed in ./upgrade
#===============================================
# Upgrade omz
^omz:
@./upgrade/omz
#===============================================
# Scripts listed in ./uninstall
#===============================================
# Uninstall docker
/docker:
@./uninstall/docker
# Uninstall omz
/omz:
@./uninstall/omz
#===============================================
# Service goals
#===============================================
self:
@./gen-makefile
##help: Show this help message
help: Makefile
@echo "Usage:"
@echo "\tmake <goal>\n"
@echo "Available goals:"
@sed -n 's/^##//p' $< | column -t -s ':' | sed -e "s/^/\t/"
##<goal>_: Same as 'cat ./install/<goal>.sh'
%_:
@cat ./install/$*.sh
@echo "Ubuntu software installator"
@echo
@echo "Usage:\n make help|- show this help\n make self|- regenerate Makefile (alias of ./gen-makefile)\n make GOAL|- install software\n make ^GOAL|- upgrade software\n make /GOAL|- uninstall software" | column -ts '|'
@echo "\nYou can combine GOALs, here are some examples:"
@echo "\tmake @docker docker"
@echo "\tmake php @docker ^omz"
@echo "\nAvailable GOALs:"
@sed -n '/^#/{N;s/# *\(.*\)\n\([^# .].*:\)/\t\2\1/p}' $< | column -ts ':'

View File

@@ -4,11 +4,14 @@
## Requirements
* `bash`, `zsh` or other `sh`-compatible shell
* Ubuntu >= 20.04 (not tested with version < 20)
* `bash`, `zsh` or other POSIX-compatible shell
* `make` (optional but recommended)
* `wget` (necessary for some scripts)
* `git` (necessary for some scripts)
If some dependecies are missed for some of these scripts it is enougth to run `./install/apt` in most cases.
## Usage
### Clone this repo (recommended)
@@ -23,33 +26,37 @@ wget -qO - https://git.axenov.dev/anthony/my-env/archive/master.tar.gz | tar -zx
# switch to repo dir
cd my-env
# get full list of `make` goals
make help
# generate fresh ./Makefile and get full list of `make` goals
./gen-makefile
# generate new ./Makefile and get full list of `make` goals
./gen-makefile.sh
# get full list of `make` goals
make
```
### Selective straightforward installation
```shell
# from remote file
wget -qO - https://git.axenov.dev/anthony/my-env/raw/branch/master/install/apt.sh | bash
wget -qO - https://git.axenov.dev/anthony/my-env/raw/branch/master/install/apt | bash
# from locally cloned repo
./install/apt.sh
./install/apt
```
## How to add a new software script?
## How to add my script?
1. Create new `./install/*.sh` script.
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
##makedesc: Your description for Makefile
```
2. Test your script
3. Run `./gen-makefile.sh` to generate new `./Makefile`
2. Make this script executable, e.g.:
```shell
sudo chmod a+x ./install/myscript
```
3. Test your script
4. Run `make self` to generate new `./Makefile`
## How to create packs?
@@ -58,12 +65,12 @@ You can create new file inside `./packs` dir.
Syntax is same as classic makefile with one important and necessary addition -- a comment started with `##`:
```makefile
##mypack1: Pack description
# Pack description
mypack1: goal1 goal2 goalX ...
...
##mypackX: Pack description
mypackY: goalA goalB
# Pack description
mypackX: goalA goalB
@cp file1 file2
...
...
@@ -72,3 +79,36 @@ mypackY: goalA goalB
where:
* `mypack*` is the pack name
* `goal*` are script names in `./install`
## Testing in docker (not recommended)
> Note that this is almost useless way to test since you'll meet errors in many cases because dockerized OS is not fully-functional and will never be.
>
> You can use docker to test something **really simple**, e.g. to check general script steps or install cli tools.
>
> In other cases you need virtualized Ubuntu instead of dockerized one, so I strongly recommend you to use [VirtualBox](https://www.virtualbox.org/wiki/Downloads) or your host machine.
```shell
# switch to repo dir
cd my-env
# build and run container
docker build -t myenv . && docker run -it myenv
# or oneliner
docker run -it $(docker build -q .)
```
Now you can play around with scripts.
## TODO
* build: [flameshot](https://github.com/flameshot-org/flameshot#compilation)
* build: [rustdesk](https://github.com/rustdesk/rustdesk#build)
* [JB mono](https://www.jetbrains.com/ru-ru/lp/mono/#how-to-install) ([2](https://fonts.google.com/specimen/JetBrains+Mono))
* update scripts (when possible)
* uninstall scripts (when possible)
## License
[WTFPLv2](LICENSE)

131
dotfiles/.bash_aliases Normal file
View File

@@ -0,0 +1,131 @@
#!/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 ..='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 wine='LANG=ru_RU.utf8 wine'
alias docker.prune='docker image prune -f; docker network prune -f; docker container prune -f'
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
# }

15
dotfiles/.editorconfig Normal file
View File

@@ -0,0 +1,15 @@
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

275
dotfiles/.git_aliases Normal file
View File

@@ -0,0 +1,275 @@
[alias]
#-----------------------------------------------------------------
a = add
aa = add --all
#-----------------------------------------------------------------
b = branch
bm = branch --merged
bnm = branch --no-merged
bv = branch -v
bvv = branch -vv
#-----------------------------------------------------------------
c = commit
ci = commit --interactive
ca = commit --all
cm = commit --message
cam = commit --all --message
amend = commit --amend --all --no-edit
amendm = commit --amend --all --message
# https://words.filippo.io/git-fixup-amending-an-older-commit/
cf = "!f() { TARGET=$(git rev-parse \"$1\"); git commit --fixup=$TARGET && GIT_EDITOR=true git rebase --interactive --autosquash $TARGET~; }; f"
#-----------------------------------------------------------------
co = checkout
cog = checkout --guess
cob = checkout -b
#-----------------------------------------------------------------
cp = cherry-pick
cpa = cherry-pick --abort
cpc = cherry-pick --continue
cpn = cherry-pick --no-commit
# cpnx = cherry-pick --no-commit -x
#-----------------------------------------------------------------
d = diff
dw = diff --word-diff
dc = diff --cached
ds = diff --staged
dwc = diff --word-diff --cached
dws = diff --word-diff --staged
#-----------------------------------------------------------------
f = fetch
fa = fetch --all
#-----------------------------------------------------------------
# g = grep
#-----------------------------------------------------------------
l = log
lo = log --oneline
#-----------------------------------------------------------------
m = merge
ma = merge --abort
mc = merge --continue
mn = merge --no-commit
#-----------------------------------------------------------------
o = checkout
#-----------------------------------------------------------------
p = pull --recurse-submodules
clone = clone --recursive
#-----------------------------------------------------------------
r = remote
rv = remote -v
ra = remote add
ru = remote update
rs = remote show
rso = remote show origin
rp = remote prune
rpo = remote prune origin
rpd = remote prune --dry-run
rpod = remote prune origin --dry-run
#-----------------------------------------------------------------
rv = revert
rvn = revert --no-commit
#-----------------------------------------------------------------
rb = rebase
rba = rebase --abort
rbc = rebase --continue
rbs = rebase --skip
rbi = rebase --interactive
#-----------------------------------------------------------------
s = status
#-----------------------------------------------------------------
sb = show-branch
#-----------------------------------------------------------------
sub = submodule
# si = submodule init
# sdi = submodule deinit -f
# sa = submodule add
# sup = submodule update
# sst = submodule status
# ss = submodule summary
#-----------------------------------------------------------------
master = "!git checkout master && git pull"
main = "!git checkout main && git pull"
dev = "!git checkout dev && git pull"
develop = "!git checkout develop && git pull"
#-----------------------------------------------------------------
user = config --local --get-regexp '^user' # локальные настройки пользователя git
guser = config --global --get-regexp '^user' # глобальные настройки пользователя git
# whoami = user
# gwhoami = guser
#-----------------------------------------------------------------
contributors = shortlog --summary --numbered --no-merges
archive = !"f() { top=$(rev-parse --show-toplevel); cd $top; tar cvf $top.tar $top ; }; f"
default-branch = config init.defaultBranch
panic = "!git checkout $(git default-branch) && git fetch origin --prune && git reset --hard origin/$(git default-branch) && git clean -ffd"
uncommit = reset --soft HEAD~1
unadd = reset HEAD
discard = checkout --
cleaner = clean -dff
cleanest = clean -dffx
cleanout = !git clean -df && git checkout -- .
publish = "!git push --set-upstream origin $(git current-branch)"
inbound = "!git remote update --prune; git log ..@{upstream}"
outbound = log @{upstream}..
aliases = "!git config --get-regexp '^alias\\.' | cut -c 7- | sed 's/ / = /'"
branches = branch -a
tags = tag -n1 --list
stashes = stash list
current-branch = git branch --show-current #rev-parse --abbrev-ref HEAD
upstream-branch = !git for-each-ref --format='%(upstream:short)' $(git symbolic-ref -q HEAD)
exec = "!exec"
pruner = "!git prune --expire=now; git reflog expire --expire-unreachable=now --rewrite --all"
repacker = repack -a -d -f --depth=300 --window=300 --window-memory=1g
optimizer = "!git pruner; git repacker; git prune-packed"
last-tag = describe --tags --abbrev=0
last-tagged = "!git describe --tags $(git rev-list --tags --max-count=1)"
orphans = fsck --full
log-my = "!git log --author $(git config user.email)"
log-compact1 = log --graph --topo-order --date=short --abbrev-commit --decorate --all --boundary --pretty=format:'%Cgreen%ad %Cred%h%Creset -%C(yellow)%d%Creset %s %Cblue[%cn]%Creset %Cblue%G?%Creset'
chart = "!f() { \
git log \
--format=oneline \
--format=\"%aE %at\" \
--since=6-weeks-ago \
$* | \
awk ' \
function time_to_slot(t) { return strftime(\"%Y-%m-%d\", t, true) } \
function count_to_char(i) { return (i > 0) ? ((i < 10) ? i : \"X\") : \".\" } \
BEGIN { \
time_min = systime(); time_max = 0; \
SECONDS_PER_DAY=86400; \
} \
{ \
item = $1; \
time = 0 + $2; \
if (time > time_max){ time_max = time } else if (time < time_min){ time_min = time }; \
slot = time_to_slot(time); \
items[item]++; \
slots[slot]++; \
views[item, slot]++; \
} \
END{ \
printf(\"Chart time range %s to %s.\\n\", time_to_slot(time_min), time_to_slot(time_max)); \
time_max_add = time_max += SECONDS_PER_DAY; \
for(item in items){ \
row = \"\"; \
for(time = time_min; time < time_max_add; time += SECONDS_PER_DAY) { \
slot = time_to_slot(time); \
count = views[item, slot]; \
row = row count_to_char(count); \
} \
print row, item; \
} \
}'; \
}; f"
# # общее -----------------------------------------------------------------
# init = init -q # no blm!
# aliases = config --get-regexp '^alias' # показать список доступных алиасов
# user = config --local --get-regexp '^user' # локальные настройки пользователя git
# guser = config --global --get-regexp '^user' # глобальные настройки пользователя git
# user-me = "git config user.name 'Anthony Axenov'; git config user.email 'anthonyaxenov@gmail.com'; git config user.signingkey 'F7CCD4EC'"
# user-bars = "git config user.name 'Антон Аксенов'; git config user.email 'a.aksenov@bars.group'; git config user.signingkey '45C3E670'"
# # ветки -------------------------------------------------------------------
# bheads = branch -vv # ветки и их последние коммиты
# branches = branch --list -vv # показать текущую ветку в общем списке локальных веток
# # br = status -sb # показать название текущей ветки
# brd = branch -D # удалить ветку локально
# brod = "!git branch -D "$1"; git push origin :"$1";" # удалить ветку локально и на origin
# merged = branch --merged # показать список веток, слитых в текущую
# #ghpr = "!git fetch origin pull/$1/head:pr/$1 && git checkout pr/$1" # github: встать на PR с указанным id
# # удалить локальные ветки, слитые в текущую:
# trim = "!DEFAULT=master; git branch --merged ${1-$DEFAULT} | grep -v " ${1-$DEFAULT}$" | xargs git branch -d; git remote prune origin;"
# # переключение ------------------------------------------------------------
# co = checkout # переключиться на ветку/тег/коммит
# cob = checkout -b # создание новое ветки
# master = "!git checkout master && git pull" # переключиться на ветку master и обновить
# dev = "!git checkout dev && git pull" # переключиться на ветку dev и обновить
# develop = "!git checkout develop && git pull" # переключиться на ветку develop и обновить
# # фиксация изменений ------------------------------------------------------
# c = commit # коммит
# ca = commit -a # коммит всех файлов
# cm = commit -m # коммит с заданным сообщением
# cam = commit -am # коммит всех файлов с заданным сообщением
# amend = commit --amend --no-edit -a # прикрепляет все индексированные файлы к последнему коммиту, используя уже существующее сообщение
# #amenda = commit --amend --no-edit
# amendm = commit --amend -m # прикрепляет все индексированные файлы к последнему коммиту, спрашивает новое сообщение к коммиту
# cp = cherry-pick # применить коммит поверх текущего HEAD
# diffc = diff --cached # показать дельту staged-файла
# # управление изменениями, сброс состояний, откат --------------------------
# # st = status -sb # короткий status
# st = status # сокращение
# rh = reset --hard # откат коммита с удалением всех изменений на указанный коммит
# rhh = reset --hard HEAD # откат коммита с удалением всех изменений на последний коммит
# rmh = reset --mixed HEAD # откат коммита с сохранением всех изменений
# unstage = reset HEAD # переводит файл staged => unstaged без потери изменений
# clear = checkout -- # удаляет изменения в файле
# # алиасы для временной фиксации
# # на самом деле, для таких дел надо использовать git stash
# # save = !git add -A && git commit -m 'SAVEPOINT'
# wip = commit -am "WIP"
# wipa = commit --amend -am "WIP"
# undo = reset --mixed HEAD~
# # работа с remote-репами --------------------------------------------------
# pushf = push --force # отправить ветку принудительно
# pusht = push --tags # отправить теги
# pushft = push --tags --force # отправить теги принудительно
# pullf = pull --force # получить ветку принудительно
# pullt = pull --tags # получить теги
# pullft = pull --tags --force # получить теги
# ploh = pull origin HEAD # получить текущую ветку из origin
# remotes = remote -v # показать список удалённых репозиториев
# #sy = remote update origin --prune #
# rso = remote show origin # показать состояние локальных веток относительно удалённых на origin bare
# rpo = remote prune origin # удалить все мёртвые ссылки на bare-ветки origin
# repush = 'git push origin :$1 && git push origin $1' # замена push --force
# # просмотр логов ----------------------------------------------------------
# head = log -1 HEAD # показать последний коммит в текущей ветке
# heads = log --graph --decorate --simplify-by-decoration --oneline # коммиты, которыми оканчиваются ветки
# # название текущей ветки или тега при detached head:
# dehead = "!BR=$(git branch --show-current); if [ -n \"$BR\" ]; then echo $BR; else git describe --contains --all HEAD; fi;"
# tree = log --graph --pretty=format:'%C(yellow)%h%C(cyan)%d%Creset %s %C(white)- %an, %ar%Creset'
# hist = log --pretty=format:\"%h | %an (%ad) %s%d\" --graph --date=relative
# logfull = log --graph --decorate --all
# grog = 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'
# # сабмодули ---------------------------------------------------------------

28
dotfiles/.gitconfig Normal file
View File

@@ -0,0 +1,28 @@
[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 Normal file
View File

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

0
dotfiles/.profile Normal file
View File

2
dotfiles/README Normal file
View File

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

View File

@@ -1,12 +0,0 @@
#!/bin/bash
echo
echo "==============================================="
echo "Installing flatpak and its software..."
echo "==============================================="
echo
sudo apt install -y --autoremove \
flatpak \
gnome-software-plugin-flatpak
flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo

View File

@@ -1,49 +0,0 @@
#!/bin/bash
echo
echo "==============================================="
echo "Installing oci8..."
echo "==============================================="
echo
# https://www.oracle.com/cis/database/technologies/instant-client/downloads.html
#check for
# wget https://download.oracle.com/otn_software/linux/instantclient/instantclient-basic-linuxx64.zip
# wget https://download.oracle.com/otn_software/linux/instantclient/instantclient-basiclite-linuxx64.zip -- only libociicus.so
# wget https://download.oracle.com/otn_software/linux/instantclient/instantclient-sqlplus-linuxx64.zip
# wget https://download.oracle.com/otn_software/linux/instantclient/instantclient-tools-linuxx64.zip
# wget https://download.oracle.com/otn_software/linux/instantclient/instantclient-sdk-linuxx64.zip
#unzip
sudo mkdir /opt/oracle/
sudo mv ~/Downloads/instant_client/ /opt/oracle/
sudo sh -c "echo /opt/oracle/instant_client > /etc/ld.so.conf.d/oracle-instantclient.conf"
sudo ldconfig
sudo apt install -y --autoremove \
php-dev \
php-pear \
build-essential \
libaio1 \
default-jdk
sudo pecl channel-update pecl.php.net
sudo pecl install oci8 # php8
#sudo pecl install oci8-2.2.0 # php7
#sh -c "echo '; priority=10' > /etc/php/7.4/mods-available/oci8.ini"
# sudo sh -c "echo 'extension=oci8.so' >> /etc/php/7.4/mods-available/oci8.ini"
# sudo chmod 0644 /etc/php/7.4/mods-available/oci8.ini
sudo phpenmod oci8
php -i | grep oci8
# instantclient,/opt/oracle/instant_client
# https://pecl.php.net/package/oci8
#sudo pecl install oci8-2.2.0

View File

@@ -1,42 +0,0 @@
#!/bin/bash
echo
echo "==============================================="
echo "Installing phpstorm-url-handler..."
echo "==============================================="
echo
installed() {
command -v "$1" >/dev/null 2>&1
}
# https://github.com/rozwell/phpstorm-url-handler/
# https://askubuntu.com/a/1023143
# https://askubuntu.com/a/919825
# https://medium.com/swlh/custom-protocol-handling-how-to-8ac41ff651eb
# https://www.linuxquestions.org/questions/linux-desktop-74/xdg-open-doesn%27t-recognize-custom-protocol-4175433062/#post4809984
sudo rm -rf /usr/bin/phpstorm-url-handler >/dev/null
sudo rm -rf ~/.local/share/applications/phpstorm-url-handler.desktop >/dev/null
sudo rm -rf /usr/share/applications/phpstorm-url-handler.desktop >/dev/null
if installed "git"; then
sudo git clone https://github.com/rozwell/phpstorm-url-handler.git /usr/src/phpstorm-url-handler
else
sudo wget https://github.com/rozwell/phpstorm-url-handler/archive/master.zip -O /tmp/phpstorm-url-handler.zip
sudo unzip /tmp/phpstorm-url-handler.zip -d /usr/src/phpstorm-url-handler
sudo rm -f /tmp/phpstorm-url-handler.zip
fi
info "Copy .desktop"
sudo cp /usr/src/phpstorm-url-handler/phpstorm-url-handler.desktop /usr/share/local/applications/phpstorm-url-handler.desktop
info "Symlink bin"
sudo cp /usr/src/phpstorm-url-handler/phpstorm-url-handler /usr/bin/phpstorm-url-handler
info "desktop-file-install"
sudo desktop-file-install phpstorm-url-handler.desktop
info "update-desktop-database"
sudo update-desktop-database -v 2>&1 | grep -E "^(.+)\/phpstorm-url-handler.desktop(.+)$"
info "xdg-mime"
xdg-mime default phpstorm-url-handler.desktop x-scheme-handler/phpstorm

View File

@@ -1,46 +0,0 @@
#!/bin/bash
echo
echo "==============================================="
echo "Installing samp-server v03svr_R2-1..."
echo "==============================================="
echo
# https://sampwiki.blast.hk/wiki/Linux_Server
# https://team.sa-mp.com/wiki/Server.cfg_RU.html
cd $HOME
wget -qO - https://files.sa-mp.com/samp03svr_R2-1.tar.gz | tar -zxf -
# sudo dpkg --add-architecture i386
# sudo apt update
# sudo apt install -y libc6:i386
apt-get install ia32-libs
echo "echo Executing Server Config...
lanmode 0
rcon 1
language Russian
rcon_password bootsector
maxplayers 50
port 7777
hostname My Server
gamemode0 bare 1
filterscripts base gl_actions gl_property gl_realtime
announce 1
query 1
weburl
maxnpc 0
onfoot_rate 40
incar_rate 40
weapon_rate 40
stream_distance 800.0
stream_rate 1000
timestamp 1
output 0
" > $HOME/samp03/server.cfg
ln -s $HOME/samp03/samp03svr /usr/local/bin/samp
echo
echo "Success! Now run via 'samp &'"
echo

View File

@@ -1,12 +0,0 @@
#!/bin/bash
echo
echo "==============================================="
echo "Installing wkhtmltopdf..."
echo "==============================================="
echo
# не тестировалось
wget "https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.focal_amd64.deb" -O /tmp/wkhtmltopdf.deb
sudo dpkg -i /tmp/wkhtmltopdf.deb
rm /tmp/wkhtmltopdf.deb

92
gen-makefile Executable file
View File

@@ -0,0 +1,92 @@
#!/bin/bash
mv Makefile Makefile.bak
CHR_UPGRADE='^'
CHR_UNINSTALL='/'
cat << EOF >> Makefile
# Autogenerated at $(date +'%d.%m.%Y %H:%M') using ${BASH_SOURCE[0]}
.DEFAULT_GOAL := help
#===============================================
# Scripts listed in ./packs
#===============================================
EOF
for file in ./packs/*; do
cat "$file" >> Makefile
echo >> Makefile
done;
cat << EOF >> Makefile
#===============================================
# Scripts listed in ./install
#===============================================
EOF
for file in ./install/*; do
name=${file##*/}
name=${name%.sh}
desc=$(grep -m 1 -oP "(?<=^##makedesc:\s).*$" ${file})
[ -z "$desc" ] && desc='<no description>'
echo -e "# ${desc}\n${name}:\n\t@${file}\n" >> Makefile
done;
cat << EOF >> Makefile
#===============================================
# Scripts listed in ./upgrade
#===============================================
EOF
for file in ./upgrade/*; do
name=${file##*/}
name=${name%.sh}
desc=$(grep -m 1 -oP "(?<=^##makedesc:\s).*$" ${file})
[ -z "$desc" ] && desc='<no description>'
echo -e "# ${desc}\n${CHR_UPGRADE}${name}:\n\t@${file}\n" >> Makefile
done;
cat << EOF >> Makefile
#===============================================
# Scripts listed in ./uninstall
#===============================================
EOF
for file in ./uninstall/*; do
name=${file##*/}
name=${name%.sh}
desc=$(grep -m 1 -oP "(?<=^##makedesc:\s).*$" ${file})
[ -z "$desc" ] && desc='<no description>'
echo -e "# ${desc}\n${CHR_UNINSTALL}${name}:\n\t@${file}\n" >> Makefile
done;
cat << EOF >> Makefile
#===============================================
# Service goals
#===============================================
self:
@./gen-makefile
help: Makefile
@echo "Ubuntu software installator"
@echo
@echo "Usage:\n \
make help|- show this help\n \
make self|- regenerate Makefile (alias of ./gen-makefile)\n \
make GOAL|- install software\n \
make ${CHR_UPGRADE}GOAL|- upgrade software\n \
make ${CHR_UNINSTALL}GOAL|- uninstall software" | column -ts '|'
@echo "\nYou can combine GOALs, here are some examples:"
@echo "\tmake @docker docker"
@echo "\tmake php @docker ^omz"
@echo "\nAvailable GOALs:"
@sed -n '/^#/{N;s/# *\(.*\)\n\([^# .].*:\)/\t\2\1/p}' $< | column -ts ':'
EOF
echo "New ./Makefile has been generated!"
echo "Old one has been saved as ./Makefile.bak"
echo "Now run 'make' to get help"

View File

@@ -1,34 +0,0 @@
#!/bin/bash
mv Makefile Makefile.bak
echo -e "# Autogenerated at $(date +'%d.%m.%Y %H:%M') using ${BASH_SOURCE[0]}\n" > Makefile
for file in ./packs/*; do
cat ${file} >> Makefile
done;
for file in ./install/*; do
name=${file##*/}
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
done;
cat << EOF >> Makefile
##help: Show this help message
help: Makefile
@echo "Usage:"
@echo "\tmake <goal>\n"
@echo "Available goals:"
@sed -n 's/^##//p' $< | column -t -s ':' | sed -e "s/^/\t/"
##<goal>_: Same as 'cat ./install/<goal>.sh'
%_:
@cat ./install/\$*.sh
EOF
echo "New ./Makefile has been generated!"
echo "Old one has been saved as ./Makefile.bak"
echo
make help

View File

@@ -7,6 +7,6 @@ echo "Installing apache2..."
echo "==============================================="
echo
sudo apt install -y --autoremove apache2
sudo service apache2 restart
sudo apt install -y --autoremove apache2 && \
sudo systemctl restart apache2 && \
apache2 -v

View File

@@ -7,54 +7,50 @@ echo "Installing software from apt..."
echo "==============================================="
echo
sudo apt update && sudo apt upgrade -y --autoremove
sudo apt install -y --autoremove \
sudo apt update && \
sudo apt upgrade -y --autoremove
sudo apt install -y \
alien \
apt-transport-https \
ca-certificates \
curl \
make \
cmake \
dialog \
build-essential \
software-properties-common \
libaio1 \
libssl-dev \
libghc-zlib-dev \
libcurl4-gnutls-dev \
libexpat1-dev \
ca-certificates \
cmake \
curl \
dconf-editor \
default-jdk \
dialog \
gettext \
gnupg \
ubuntu-restricted-extras \
unzip \
mc \
htop \
nano \
neofetch \
default-jdk \
terminator \
dconf-editor \
alien \
meld \
vlc \
gparted \
hardinfo \
libreoffice \
pulseeffects \
lsp-plugins \
htop \
libaio1 \
libcurl4-gnutls-dev \
libexpat1-dev \
libghc-zlib-dev \
libssl-dev \
lsb-release \
lsp-plugins \
make \
mc \
meld \
nano \
neofetch \
net-tools \
nmap \
p7zip-full \
sqlitebrowser
pulseeffects \
software-properties-common \
sqlitebrowser \
terminator \
ubuntu-restricted-extras \
unzip \
vlc
# earlyoom \
# etckeeper \
# geoclue-2.0 \
# gnome-software \
# minder \
# redshift \
# redshift-gtk \
# nodejs \
# compiz \
# compizconfig-settings-manager \
# earlyoom \
# etckeeper \
# deepin-screenshot \
# geoclue-2.0 \
# at
# redshift-gtk

11
install/canon-mg2500 Executable file
View File

@@ -0,0 +1,11 @@
#!/bin/bash
##makedesc: Install Canon Pixma MG2500 + ppa
echo
echo "==============================================="
echo "Installing Canon Pixma MG2500 + ppa..."
echo "==============================================="
echo
sudo add-apt-repository -y ppa:thierry-f/fork-michael-gruz
sudo apt install cnijfilter-mg2500series scangearmp-mg2500series

View File

@@ -9,7 +9,6 @@ echo
# https://t.me/axenov_blog/251
# sudo snap install chromium
wget "https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb" -O /tmp/google-chrome-stable_current_amd64.deb
sudo dpkg -i /tmp/google-chrome-stable_current_amd64.deb
wget "https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb" -O /tmp/google-chrome-stable_current_amd64.deb && \
sudo dpkg -i /tmp/google-chrome-stable_current_amd64.deb && \
rm /tmp/google-chrome-stable_current_amd64.deb

View File

@@ -1,56 +0,0 @@
#!/bin/bash
##makedesc: Install composer (latest)
echo
echo "==============================================="
echo "Installing composer (latest)..."
echo "==============================================="
echo
installed() {
command -v "$1" >/dev/null 2>&1
}
if installed "php"; then
if installed "composer"; then
echo "WARNING: You already have composer installed - removing to install actual version"
sudo apt remove -y --autoremove composer
sudo rm -f /bin/composer
sudo rm -f /usr/bin/composer
sudo rm -f /usr/local/bin/composer
sudo rm -rf /usr/src/composer
fi
sudo mkdir -m 0777 -p /usr/src/composer
cd /usr/src/composer
# https://getcomposer.org/doc/faqs/how-to-install-composer-programmatically.md
EXPECTED_CHECKSUM="$(php -r 'copy("https://composer.github.io/installer.sig", "php://stdout");')"
sudo php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
ACTUAL_CHECKSUM="$(php -r "echo hash_file('sha384', 'composer-setup.php');")"
if [ "$EXPECTED_CHECKSUM" != "$ACTUAL_CHECKSUM" ]; then
>&2 echo 'ERROR: Invalid installer checksum'
rm composer-setup.php
exit 1
fi
php composer-setup.php --quiet
sudo cp /usr/src/composer/composer.phar /usr/local/bin/composer
cd - >/dev/null
sudo rm -rf /usr/src/composer/
installed "composer" && composer --version
else
echo "WARNING: You need to have php installed"
fi
# title "Installing composer.phar in home dir..."
# cd ~
# EXPECTED_SIGNATURE="$(wget -q -O - https://composer.github.io/installer.sig)"
# php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
# ACTUAL_SIGNATURE="$(php -r "echo hash_file('sha384', 'composer-setup.php');")"
# if [ "$EXPECTED_SIGNATURE" != "$ACTUAL_SIGNATURE" ]
# then
# >&2 echo 'ERROR: Invalid installer signature'
# rm composer-setup.php
# exit 1
# fi
# php composer-setup.php --quiet
# RESULT=$?
# rm composer-setup.php

42
install/composer-clean Executable file
View File

@@ -0,0 +1,42 @@
#!/bin/bash
##makedesc: Install composer (latest)
echo
echo "==============================================="
echo "Installing composer (latest)..."
echo "==============================================="
echo
# https://getcomposer.org/doc/faqs/how-to-install-composer-programmatically.md
installed() {
command -v "$1" >/dev/null 2>&1
}
!installed "php" && echo "WARNING: You need to have php installed"
if installed "composer"; then
echo "WARNING: Removing current composer to install its actual version"
sudo apt remove -y --autoremove composer
sudo rm /bin/composer
sudo rm /usr/bin/composer
sudo rm /usr/local/bin/composer
sudo rm /usr/src/composer
rm $HOME/.local/bin/composer
fi
mkdir -p $HOME/install && cd $HOME/install
# mkdir -p $HOME/.local/bin
EXPECTED_CHECKSUM="$(php -r 'copy("https://composer.github.io/installer.sig", "php://stdout");')"
# php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
wget https://getcomposer.org/installer -O composer-setup.php
ACTUAL_CHECKSUM="$(php -r "echo hash_file('sha384', 'composer-setup.php');")"
if [ "$EXPECTED_CHECKSUM" != "$ACTUAL_CHECKSUM" ]; then
>&2 echo 'ERROR: Invalid installer checksum'
rm composer-setup.php
exit 1
fi
php composer-setup.php --quiet
cp $HOME/install/composer.phar $HOME/.local/bin/composer
cd - >/dev/null
installed "composer" && composer --version

View File

@@ -9,18 +9,19 @@ echo
# https://docs.docker.com/engine/install/ubuntu/
sudo apt remove -y docker docker-engine docker.io containerd runc
sudo apt-get install \
ca-certificates \
curl \
gnupg \
lsb-release
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo chmod a+r /etc/apt/keyrings/docker.gpg
sudo apt update
sudo apt install -y --autoremove \
docker-ce \
@@ -29,6 +30,9 @@ sudo apt install -y --autoremove \
docker-compose-plugin \
docker-compose
sudo usermod -aG docker anthony
echo
echo "You need to logout and log in again to apply docker group"
echo "Finish!"
echo "Probably, you need to relogin to apply 'docker' group."
echo "Your ones currently are: $(groups)"
echo

84
install/file-templates-kde Executable file
View File

@@ -0,0 +1,84 @@
#!/bin/bash
##makedesc: Install file templates (KDE)
echo
echo "==============================================="
echo "Installing file templates (KDE)..."
echo "==============================================="
echo
TPL_DIR="$HOME/.local/share/templates"
TPL_SRC="$TPL_DIR/.source"
[ ! -d "$TPL_SRC" ] && mkdir -p "$TPL_SRC"
echo "- Markdown" ####################################################
cat <<EOF > "$TPL_SRC/template.md"
# Title
EOF
cat << EOF > "$TPL_DIR/md.desktop"
[Desktop Entry]
Name=Документ Markdown
Icon=text-markdown
Type=Link
URL=.source/template.md
EOF
echo "- PHP" ####################################################
cat <<EOF > "$TPL_SRC/template.php"
<?php
declare(strict_types=1);
ini_set('error_reporting', E_ALL);
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
ini_set('log_errors', 1);
EOF
cat << EOF > "$TPL_DIR/php.desktop"
[Desktop Entry]
Name=PHP-скрипт
Icon=application-x-php
Type=Link
URL=.source/template.php
EOF
echo "- Shell" ####################################################
cat <<EOF > "$TPL_SRC/template.sh"
#!/bin/bash
EOF
cat << EOF > "$TPL_DIR/sh.desktop"
[Desktop Entry]
Name=Bash-скрипт
Icon=terminal
Type=Link
URL=.source/template.sh
EOF
echo "- Go" ####################################################
cat <<EOF > "$TPL_SRC/template.go"
package main
import "fmt"
func main() {
fmt.Println("hello world")
}
EOF
cat << EOF > "$TPL_DIR/go.desktop"
[Desktop Entry]
Name=Golang файл
Type=Link
URL=.source/template.go
EOF
echo
echo "Finish! You can find them here:"
echo -e "\t$TPL_DIR"
echo

8
install/flameshot-build Executable file
View File

@@ -0,0 +1,8 @@
#!/bin/bash
##makedesc: [TODO] Build flameshot from src (latest)
echo
echo "==============================================="
echo "Installing flameshot (latest)..."
echo "==============================================="
echo

View File

@@ -10,29 +10,31 @@ echo
installed() {
command -v "$1" >/dev/null 2>&1
}
ENVDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
! installed make && sudo apt install -y make
if installed git; then
sudo rm -rf /usr/src/git
sudo git clone https://github.com/git/git.git --depth=1 /usr/src/git
sudo chown -R $USER: /usr/src/git
if [ -d "${HOME}/install/git" ]; then
cd /usr/src/git/ && \
git pull
else
git clone https://github.com/git/git.git --depth=1 "${HOME}/install/git" && \
cd /usr/src/git/
sudo make prefix=/usr/local all
fi
sudo make prefix=/usr/local all && \
sudo make prefix=/usr/local install
else
! installed wget && sudo apt install -y wget
wget https://github.com/git/git/archive/master.zip -O /tmp/git.zip
sudo unzip -q /tmp/git.zip -d /usr/src/git
rm /tmp/git.zip
cd /usr/src/git/git-master
sudo make prefix=/usr/local all
sudo make prefix=/usr/local install
cd /usr/src
sudo rm -rf git
sudo git clone https://github.com/git/git.git --depth=1 /usr/src/git
sudo chown -R $USER: /usr/src/git
[ -d "${HOME}/install/git" ] || mkdir -p "${HOME}/install/git"
wget https://github.com/git/git/archive/master.zip -O /tmp/git.zip && \
unzip -q /tmp/git.zip -d "${HOME}/install/git" && \
rm /tmp/git.zip && \
cd "${HOME}/install/git/git-master" && \
sudo make prefix=/usr/local all && \
sudo make prefix=/usr/local install && \
cd - && \
rm -rf git && \
git clone https://github.com/git/git.git --depth=1 "${HOME}/install/git"
fi
git --version

View File

@@ -7,5 +7,5 @@ echo "Installing grub-customizer (latest)..."
echo "==============================================="
echo
sudo add-apt-repository ppa:danielrichter2007/grub-customizer
sudo add-apt-repository -y ppa:danielrichter2007/grub-customizer
sudo apt install -y --autoremove grub-customizer

14
install/kde-backports Executable file
View File

@@ -0,0 +1,14 @@
#!/bin/bash
##makedesc: Install KDE Backports + ppa
echo
echo "==============================================="
echo "Installing KDE Backports + ppa..."
echo "==============================================="
echo
sudo add-apt-repository -y ppa:kubuntu-ppa/backports
sudo add-apt-repository -y ppa:kubuntu-ppa/backports-extra
sudo apt update
sudo pkcon update
sudo apt full-upgrade

11
install/libreoffice Executable file
View File

@@ -0,0 +1,11 @@
#!/bin/bash
##makedesc: Install libreoffice
echo
echo "==============================================="
echo "Installing libreoffice..."
echo "==============================================="
echo
sudo apt update && \
sudo apt install -y --autoremove libreoffice

25
install/ntfy Executable file
View File

@@ -0,0 +1,25 @@
#!/bin/bash
##makedesc: Install ntfy (latest) + ppa
echo
echo "==============================================="
echo "Installing ntfy (latest) + ppa..."
echo "==============================================="
echo
# https://ntfy.sh/docs/install/#general-steps
installed() {
command -v "$1" >/dev/null 2>&1
}
! installed curl && sudo apt install -y curl
curl -sSL https://archive.heckel.io/apt/pubkey.txt | sudo apt-key add - && \
sudo apt install apt-transport-https && \
sudo sh -c "echo 'deb [arch=amd64] https://archive.heckel.io/apt debian main' \
> /etc/apt/sources.list.d/archive.heckel.io.list" && \
sudo apt update && \
sudo apt install ntfy -y && \
sudo systemctl enable ntfy && \
sudo systemctl start ntfy

19
install/omz-clean Executable file
View File

@@ -0,0 +1,19 @@
#!/bin/bash
##makedesc: Install omz (latest)
echo
echo "==============================================="
echo "Installing omz (latest)..."
echo "==============================================="
echo
installed() {
command -v "$1" >/dev/null 2>&1
}
if ! installed zsh || ! installed git || ! installed curl; then
echo "ERROR: you need git, zsh and curl to be installed!"
exit 1
fi
sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

51
install/omz-fancy Executable file
View File

@@ -0,0 +1,51 @@
#!/bin/bash
##makedesc: Install omz fancy (powerline10k + MesloLGS font)
echo
echo "==============================================="
echo "Installing omz fancy: powerline10k + MesloLGS font..."
echo "==============================================="
echo
installed() {
command -v "$1" >/dev/null 2>&1
}
if ! installed zsh || ! installed git || ! installed wget; then
echo "ERROR: you need git, zsh and wget to be installed!"
exit 1
fi
if [[ ! -d "$HOME/.oh-my-zsh" ]]; then
echo "ERROR: you need omz to be installed!"
exit 1
fi
echo
echo "1/3 Installing MesloLGS fonts..."
mkdir -p "$HOME/.local/share/fonts/"
FONTS_URL="https://github.com/romkatv/powerlevel10k-media/raw/master"
wget "$FONTS_URL/MesloLGS%20NF%20Regular.ttf" -O "$HOME/.local/share/fonts/MesloLGS NF Regular.ttf"
wget "$FONTS_URL/MesloLGS%20NF%20Bold.ttf" -O "$HOME/.local/share/fonts/MesloLGS NF Bold.ttf"
wget "$FONTS_URL/MesloLGS%20NF%20Italic.ttf" -O "$HOME/.local/share/fonts/MesloLGS NF Italic.ttf"
wget "$FONTS_URL/MesloLGS%20NF%20Bold%20Italic.ttf" -O "$HOME/.local/share/fonts/MesloLGS NF Bold Italic.ttf"
fc-cache -vf "$HOME/.local/share/fonts/"
echo
echo "2/3 Installing powerlevel10k theme..."
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
sed -i 's#^ZSH_THEME=.*$#ZSH_THEME="powerlevel10k/powerlevel10k"#g' "$HOME/.zshrc"
echo
echo "3/3 Installing plugins..."
git clone https://github.com/zsh-users/zsh-autosuggestions.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
sed -i 's/^plugins=/plugins=(git laravel docker docker-compose composer zsh-autosuggestions zsh-syntax-highlighting)/g' $HOME/.zshrc
p10k configure
echo
echo "Finish! You need to:"
echo "- review your plugins in $HOME/.zshrc"
echo "- restart terminal windows to reload fonts and set 'MesloLGS NF Regular' as default font"
echo "- log out of your session and login again"
echo

32
install/papirus Executable file
View File

@@ -0,0 +1,32 @@
#!/bin/bash
##makedesc: Install papirus-icon-theme (latest)
echo
echo "==============================================="
echo "Installing papirus-icon-theme (latest)..."
echo "==============================================="
echo
installed() {
command -v "$1" >/dev/null 2>&1
}
if installed git; then
mkdir ${HOME}/install/
git clone https://github.com/PapirusDevelopmentTeam/papirus-icon-theme.git --depth=1 ${HOME}/install/papirus-icon-theme
else
! installed wget && sudo apt install -y wget
mkdir ${HOME}/install/papirus-icon-theme
wget https://github.com/PapirusDevelopmentTeam/papirus-icon-theme/archive/refs/heads/master.zip -O ${HOME}/install/papirus-icon-theme.zip
unzip ${HOME}/install/papirus-icon-theme.zip -d ${HOME}/install/papirus-icon-theme
fi
ln -s ${HOME}/install/papirus-icon-theme/Papirus ${HOME}/.local/share/icons/Papirus
ln -s ${HOME}/install/papirus-icon-theme/Papirus-Dark ${HOME}/.local/share/icons/Papirus-Dark
ln -s ${HOME}/install/papirus-icon-theme/Papirus-Light ${HOME}/.local/share/icons/Papirus-Light
echo
echo "Finish! Don't forget to change current icon theme."
echo "You can find them here:"
echo -e "\t${HOME}/.local/share/icons/"
echo

View File

@@ -14,21 +14,21 @@ sudo apt install -y --autoremove \
php${PHPVER}-cli \
php${PHPVER}-common \
php${PHPVER}-xdebug \
# php${PHPVER}-bcmath \
# php${PHPVER}-bz2 \
# php${PHPVER}-curl \
# php${PHPVER}-gd \
# php${PHPVER}-json \
# php${PHPVER}-mbstring \
php${PHPVER}-dom \
php${PHPVER}-curl \
php${PHPVER}-bcmath \
php${PHPVER}-gd \
php${PHPVER}-intl \
php${PHPVER}-mbstring \
# php${PHPVER}-mysql \
# php${PHPVER}-opcache \
# php${PHPVER}-pgsql \
# php${PHPVER}-soap \
php${PHPVER}-soap \
# php${PHPVER}-xml \
# php${PHPVER}-xmlrpc \
# php${PHPVER}-xsl \
# php${PHPVER}-sqlite3 \
# php${PHPVER}-zip
# php${PHPVER}-dba
# php${PHPVER}-zip \
# php${PHPVER}-dba \
# php${PHPVER}-ldap
php -v

View File

@@ -7,21 +7,21 @@ echo "Installing postman (latest)..."
echo "==============================================="
echo
wget "https://dl.pstmn.io/download/latest/linux64" -O /tmp/postman.tar.gz
# sudo tar -xvzf /tmp/postman.tar.gz -C /usr/local/bin
sudo tar -xzf /tmp/postman.tar.gz -C /usr/local
rm /tmp/postman.tar.gz
sudo ln -s /usr/local/Postman/Postman /usr/local/bin/postman
echo "#!/usr/bin/env xdg-open
mkdir -p ${HOME}/install/postman
mkdir -p ${HOME}/.local/bin
wget "https://dl.pstmn.io/download/latest/linux64" -O ${HOME}/install/postman.tar.gz && \
tar -xzf ${HOME}/install/postman.tar.gz -C ${HOME}/install/postman && \
ln -s ${HOME}/install/postman/Postman/Postman ${HOME}/.local/bin/postman && \
cat << EOF > ${HOME}/.local/share/applications/Postman.desktop
#!/usr/bin/env xdg-open
[Desktop Entry]
Name=Postman
Exec=/usr/local/bin/postman
Icon=/usr/local/Postman/app/icons/icon_128x128.png
Exec=${HOME}/.local/bin/postman
Icon=${HOME}/install/postman/Postman/app/icons/icon_128x128.png
Categories=Utility,Network
Terminal=false
Type=Application
Encoding=UTF-8
" > $HOME/.local/share/applications/Postman.desktop
EOF
sudo update-desktop-database

25
install/qt5 Executable file
View File

@@ -0,0 +1,25 @@
#!/bin/bash
##makedesc: Install qt5
echo
echo "==============================================="
echo "Installing qt5..."
echo "==============================================="
echo
sudo apt install -y --autoremove \
build-essential \
ca-certificates \
cmake \
g++ \
libqt5core5a \
libqt5dbus5 \
libqt5gui5 \
libqt5network5 \
libqt5svg5 \
libqt5svg5-dev \
libqt5widgets5 \
openssl \
qtbase5-dev \
qttools5-dev \
qttools5-dev-tools

View File

@@ -1,7 +1,7 @@
#!/bin/bash
##makedesc: Install rustdesk v1.1.8 (deb)
##makedesc: Install rustdesk client v1.1.9 (deb)
[ $1 ] && RDVER="$1" || RDVER="1.1.8"
[ $1 ] && RDVER="$1" || RDVER="1.1.9"
echo
echo "==============================================="
echo "Installing rustdesk v${RDVER}..."
@@ -10,7 +10,6 @@ echo
# https://github.com/rustdesk/rustdesk
sudo apt install libxdo3
wget "http://github.com/rustdesk/rustdesk/releases/download/${RDVER}/rustdesk-${RDVER}.deb" -qO /tmp/rustdesk.deb
sudo dpkg -i /tmp/rustdesk.deb
rm /tmp/rustdesk.deb
sudo apt install libxdo3 && \
wget "http://github.com/rustdesk/rustdesk/releases/download/${RDVER}/rustdesk-${RDVER}.deb" -O ${HOME}/install/rustdesk_${RDVER}.deb && \
sudo dpkg -i ${HOME}/install/rustdesk_${RDVER}.deb

View File

@@ -7,5 +7,5 @@ echo "Installing ulauncher (latest) + ppa..."
echo "==============================================="
echo
sudo add-apt-repository ppa:agornostal/ulauncher
sudo add-apt-repository -y ppa:agornostal/ulauncher
sudo apt install -y --autoremove ulauncher

View File

@@ -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 'deb https://dl.winehq.org/wine-builds/ubuntu/ focal main'
sudo add-apt-repository -y 'deb https://dl.winehq.org/wine-builds/ubuntu/ focal main'
sudo apt install -y --autoremove winehq-stable
wine --version

View File

@@ -1,56 +1,11 @@
#!/bin/bash
##makedesc: Install zsh + omz (latest)
##makedesc: Install vanilla zsh
echo
echo "==============================================="
echo "Installing zsh + omz (latest)..."
echo "Installing vanilla zsh..."
echo "==============================================="
echo
installed() {
command -v "$1" >/dev/null 2>&1
}
if ! installed git || ! installed curl; then
echo "ERROR: you need git and curl to be installed!"
exit 1
fi
sudo apt install -y --autoremove zsh
# sudo chsh -s $(which zsh)
# Based on:
# https://github.com/Powerlevel9k/powerlevel9k/wiki/Install-Instructions
# https://github.com/ohmyzsh/ohmyzsh
# https://powerline.readthedocs.io/en/latest/installation/linux.html#fonts-installation
# https://gist.github.com/dogrocker/1efb8fd9427779c827058f873b94df95
# https://linuxhint.com/install_zsh_shell_ubuntu_1804/
echo
echo "1. Installing oh-my-zsh..."
sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
echo
echo "2. Installing powerlevel9k theme (legacy)..."
git clone https://github.com/bhilburn/powerlevel9k.git ~/.oh-my-zsh/custom/themes/powerlevel9k
sed -i 's@^ZSH_THEME=.*$@ZSH_THEME="powerlevel9k/powerlevel9k"@g' ~/.zshrc
echo
echo "3. Installing powerline fonts..."
wget https://github.com/powerline/powerline/raw/develop/font/PowerlineSymbols.otf
wget https://github.com/powerline/powerline/raw/develop/font/10-powerline-symbols.conf
mkdir -p ~/.local/share/fonts/
mv PowerlineSymbols.otf ~/.local/share/fonts/
fc-cache -vf ~/.local/share/fonts/
mkdir -p ~/.config/fontconfig/conf.d/
mv 10-powerline-symbols.conf ~/.config/fontconfig/conf.d/
echo
echo "4. Installing autosuggestions and syntax highlighting..."
git clone https://github.com/zsh-users/zsh-autosuggestions.git .oh-my-zsh/custom/plugins/zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git .oh-my-zsh/custom/plugins/zsh-syntax-highlighting
sed -i 's@plugins=(git)@plugins=(git zsh-autosuggestions zsh-syntax-highlighting)@g' ~/.zshrc
echo
echo "Finish! Log out of your session and login again."
echo
echo "source ~/.profile" >> ~/.zshrc

2
packs/composer Normal file
View File

@@ -0,0 +1,2 @@
# [PACK] php + composer
composer: php composer-clean

2
packs/flameshot Normal file
View File

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

2
packs/lamp Normal file
View File

@@ -0,0 +1,2 @@
# [PACK] Apache + php + mariadb
lamp: apache php mariadb

View File

@@ -1,2 +0,0 @@
##lamp: Apache + php + mariadb
lamp: apache php mariadb

4
packs/omz Normal file
View File

@@ -0,0 +1,4 @@
# [PACK] zsh + omz + powerline10k + MesloLGS font
omz: zsh omz-clean omz-fancy
chsh -s /usr/bin/zsh
@exec zsh

View File

@@ -1,120 +0,0 @@
##############################################################
# Скрипт для автоматического резервного копирования
# базы данных.
#
# Автор: Антон Аксенов
# URL: anthonyaxenov.ru
# Email: anthonyaxenov@gmail.com
#
# Подробности о скрипте, подготовка к работе:
# https://anthonyaxenov.blogspot.ru/2017/05/cron-1.html
#
##############################################################
#!/bin/bash
# Данные для работы с БД
DBHOST=
DBUSER=
DBPASS=
DBNAME=
DBCHARSET="utf8"
# Даты
FMT_DT_DIR="%d-%m-%Y" # формат даты для директорий | 19-03-2021
FMT_DT_FILE="%H%M%S-%d%m%y" # формат даты для файлов | 082456-190321
FMT_DT_LOG="%H:%M:%S" # формат даты для лога | 08:24:15.168149413
# Локальное хранилище
LOCALDIR=/backup # полный путь директории для бэкапов
LOCALPATH=$LOCALDIR/$(date +$FMT_DT_DIR) # полный путь директории за сегодня
LOCALFILE=$LOCALPATH/$DBNAME-$(date +$FMT_DT_FILE).sql # полный путь к файлу дампа
# Облачное хранилище
CLOUDUSE=1 # Копировать ли в облако? Закомментировать строку, если не надо
CLOUDMNT=/mnt/yadisk # Точка монтирования облака относительно корня
CLOUDDIR=db_backup # Папка в облаке, куда будут лететь файлы (внутри папки CLOUDMNT, т.е. без / в начале)
CLOUDPATH=$CLOUDMNT/$CLOUDDIR/$DATE # полный путь к папке текущей даты в облаке относительно корня
CLOUDFILE=$CLOUDPATH/$DBNAME-$DATETIME.sql # полный путь к файлу дампа в облаке
CLOUDFILEGZ=$CLOUDFILE.gz # полный путь к архиву в облаке
# Путь к бекапу на примонтированном хранилище будет выглядеть так:
# /mnt/yadisk/db_backup/2017-01-01/mybigdatabase-2017-01-01-12-23-34.sql.gz
log() {
echo "[$(date +$FMT_DT_LOG)] $*"
}
is_dir() {
[ -d "$1" ]
}
# Начало процесса
echo "[--------------------------------[$(date +$FMT_DT_LOG)]--------------------------------]"
log $LOCALPATH
if ! is_dir $LOCALPATH; then # Если нет папки за сегодня
sudo mkdir -p $LOCALPATH # создаём её, ошибки игнорируем
[ $? -eq 0 ] && log "New directory: $LOCALPATH"
fi
log "Generate a database dump: '$DBNAME'..."
mysqldump \
-q \
--user=$DBUSER \
--host=$DBHOST \
--password=$DBPASS \
--opt \
--default-character-set=$DBCHARSET $DBNAME \
> $LOCALFILE
exit
if [[ $? -gt 0 ]]; then
# если дамп сделать не удалось (код завершения предыдущей команды больше нуля) - прерываем весь скрипт
log "Dumping failed! Script aborted."
exit 1
else # иначе - упаковываем его
log "Dumping successfull! Packing in GZIP..."
gzip $LOCALFILE # Упаковка
if [[ $? -ne 0 ]]; then # Если не удалась
log "GZipping failed! SQL-file will be uploaded."
GZIP_FAILED=1 # Создаём флажок, что упаковка сорвалась
else
log "Result file: $LOCALFILEGZ"
fi
if [[ $CLOUDUSE -eq 1 ]]; then # Если задано копирование в облако - делаем всякое такое
mount | grep "$CLOUDMNT" > /dev/null # Проверяем примонтировано ли уже у нас облако (вывод не важен)
if [[ $? -ne 0 ]]; then # Если нет
mount $CLOUDMNT # значит монтируем
fi
if [[ $? -eq 0 ]]; then # если монтирование успешно - копируем туда файл
log "Cloud: successfully mounted at $CLOUDMNT"
log "Cloud: copying started => $CLOUDFILEGZ"
if ! [[ -d $CLOUDPATH ]]; then # Если в облаке нет папки за сегодня
mkdir $CLOUDPATH 2> /dev/null # создаём её, ошибки игнорируем
fi
if [[ -f $LOCALFILEGZ && GZIP_FAILED -ne 1 ]]; then # Если у нас архивирование выше не сорвалось
cp -R $LOCALFILEGZ $CLOUDFILEGZ # Копируем архив
else
cp -R $LOCALFILE $CLOUDFILE # Иначе - копируем большой тяжёлый дамп
fi
if [[ $? -gt 0 ]]; then # Если не скопировался - просто сообщаем
log "Cloud: copy failed."
else # Если скопировался - сообщаем и размонтируем
log "Cloud: file successfully uploaded!"
umount $CLOUDMNT # Размонтирование облака
if [[ $? -gt 0 ]]; then # Сообщаем результат размонтирования (если необходимо)
log "Cloud: umount - failed!"
fi # Конец проверки успешного РАЗмонтирования
fi # Конец проверки успешного копирования
else # если монтирование НЕуспешно - сообщаем
log "Cloud: failed to mount cloud at $CLOUDMNT"
fi # Конец проверки успешного монтирования
fi # Конец проверки необходимости выгрузки в облако
fi # Конец проверки успешного выполнения mysqldump
log "Stat datadir space (USED): `du -h $LOCALPATH | tail -n1`" # вывод размера папки с бэкапами за текущий день
log "Free HDD space: `df -h /home|tail -n1|awk '{print $4}'`" # вывод свободного места на локальном диске
log "All operations completed!"
exit 0 # Успешное завершение скрипта

38
tools/inotifywait-cp.sh Executable file
View File

@@ -0,0 +1,38 @@
#!/bin/bash
# My use case:
# syncthing synchronizes ALL changes in DCIM directory on my android to PC.
# I wanted files to be copied somewhere else on my PC to stay forever, so I
# could sort them later and safely free some space on mobile without loss.
# Also I wish to have some stupid log with history of such events.
# inotify-tools package must be installed!
# CHANGE THIS PARAMETERS to ones you needed
dir_src="$HOME/Syncthing/Mobile/Camera"
dir_dest="$HOME/some/safe/place"
dir_logs="$HOME/inotifywait-cp-logs"
regexp="[0-9]{8}_[0-9]{6}.*\.(jpg|mp4|gif)"
# Arguments description:
# --quiet -- print less (only print events)
# --monitor -- don't stop after first event (like infinite loop)
# --event -- first syncthing creates hidden file to write data into
# then renames it according to source file name, so here
# we listen to MOVED_TO event to catch final filename
# --format %f -- print only filename
# --include -- filename regexp to catch event from, ensure your $regexp
# is correct or remove line 32 to catch synced ALL files
mkdir -p "$dir_dest" "$dir_logs"
inotifywait \
--quiet \
--monitor \
--event moved_to \
--format %f \
--include "$regexp" \
"$dir_src" \
| while read filename; do
cp "$dir_src/$filename" "$dir_dest/$filename"
echo "[`date '+%H:%M:%S'`] COPIED: $dir_src/$filename => $dir_dest/$filename" \
| tee -a "$dir_logs/`date '+%Y%m%d'`.log"
done

108
tools/quick-backup.sh Normal file
View File

@@ -0,0 +1,108 @@
#!/bin/bash
#####################################################################
# #
# Stupidly simple backup script for own projects #
# #
# Author: Anthony Axenov (Антон Аксенов) #
# Version: 1.0 #
# License: WTFPLv2 More info (RU): https://axenov.dev/?p=1234 #
# #
#####################################################################
# https://gist.github.com/anthonyaxenov/b8336a2bc9e6a742b5a050fa2588d71e
# database credentials ==============================================
DBUSER=
DBPASS=
DBNAME=
DBCHARSET="utf8"
# date formats ======================================================
FMT_DT_DIR="%Y.%m.%d" # 2021.03.19
FMT_DT_FILE="%H.%M" # 08.24
FMT_DT_LOG="%H:%M:%S" # 08:24:15.168149413
# local storage =====================================================
LOCAL_BAK_DIR="/backup/$(date +$FMT_DT_DIR)"
# database backup file
LOCAL_SQL_FILE="$(date +$FMT_DT_FILE)-db.sql.gz"
LOCAL_SQL_PATH="$LOCAL_BAK_DIR/$LOCAL_SQL_FILE"
# project path and backup file
LOCAL_SRC_DIR="/var/www/"
LOCAL_SRC_FILE="$(date +$FMT_DT_FILE)-src.tar.gz"
LOCAL_SRC_PATH="$LOCAL_BAK_DIR/$LOCAL_SRC_FILE"
# log file
LOG_FILE="$(date +$FMT_DT_FILE).log"
LOG_PATH="$LOCAL_BAK_DIR/$LOG_FILE"
log() {
echo -e "[$(date +$FMT_DT_LOG)] $*" | tee -a "$LOG_PATH"
}
# remote storage ====================================================
REMOTE_HOST="user@example.com"
REMOTE_BAK_DIR="/backup/$(date +$FMT_DT_DIR)"
REMOTE_SQL_PATH="$REMOTE_BAK_DIR/$LOCAL_SQL_FILE"
REMOTE_SRC_PATH="$REMOTE_BAK_DIR/$LOCAL_SRC_FILE"
REMOTE_LOG_PATH="$REMOTE_BAK_DIR/$LOG_FILE"
# start =============================================================
echo
log "Start ----------------------------------------------------------------"
log "Initialized parameters:"
log "\tDB_USER\t\t= $DB_USER"
log "\tDB_NAME\t\t= $DB_NAME"
log "\tDB_CHARSET\t= $DB_CHARSET"
log "\tLOCAL_SRC_DIR\t= $LOCAL_SRC_DIR"
log "\tLOCAL_SRC_PATH\t= $LOCAL_SRC_PATH"
log "\tLOCAL_SQL_PATH\t= $LOCAL_SQL_PATH"
log "\tLOG_PATH\t= $LOG_PATH"
log "\tREMOTE_HOST\t= $REMOTE_HOST"
log "\tREMOTE_SQL_PATH\t= $REMOTE_SQL_PATH"
log "\tREMOTE_SRC_PATH\t= $REMOTE_SRC_PATH"
log "\tREMOTE_LOG_PATH\t= $REMOTE_LOG_PATH"
mkdir -p $LOCAL_BAK_DIR
log "Created local dir: $LOCAL_BAK_DIR"
ssh $REMOTE_HOST mkdir -p $REMOTE_BAK_DIR
log "Created remote dir: $REMOTE_BAK_DIR"
log "1/4 Dumping DB: $DBNAME..."
mysqldump \
--user="$DBUSER" \
--password="$DBPASS" \
--default-character-set="$DBCHARSET" \
--opt \
--quick \
"$DBNAME" | gzip > "$LOCAL_SQL_PATH"
# --opt Same as --add-drop-table, --add-locks, --create-options,
# --quick, --extended-insert, --lock-tables, --set-charset,
# and --disable-keys
[ $? -gt 0 ] && log "ERROR: failed to create dump. Exit-code: $?" || log "\t- OK"
log "2/4 Sending database backup to $REMOTE_HOST..."
rsync --progress "$LOCAL_SQL_PATH" "$REMOTE_HOST:$REMOTE_SQL_PATH"
[ $? -gt 0 ] && log "ERROR: failed to send database backup. Exit-code: $?" || log "\t- OK"
log "3/4 Compressing project dir: $LOCAL_SRC_DIR..."
tar -zcf "$LOCAL_SRC_PATH" "$LOCAL_SRC_DIR"
[ $? -gt 0 ] && log "ERROR: failed to compress project. Exit-code: $?" || log "\t- OK"
log "4/4 Sending project backup to ${REMOTE_HOST}..."
rsync --progress "$LOCAL_SRC_PATH" "$REMOTE_HOST:$REMOTE_SRC_PATH"
[ $? -gt 0 ] && log "ERROR: failed to send project backup. Exit-code: $?" || log "\t- OK"
rsync --progress "$LOG_PATH" "$REMOTE_HOST:$REMOTE_LOG_PATH"
log "Finish!"
log "Used space: $(du -h "$LOCAL_BAK_DIR" | tail -n1)"
log "Free space: $(df -h | tail -n1 | awk '{print $4}')"

View File

@@ -1,7 +1,4 @@
#!/bin/bash
# https://gist.github.com/anthonyaxenov/c16e1181d4b8a8644c57ec8a1f6cf21c
#########################################################################
# #
# Set display resolution #
@@ -18,6 +15,8 @@
# #
#########################################################################
# https://gist.github.com/anthonyaxenov/c16e1181d4b8a8644c57ec8a1f6cf21c
# Set display name to work with. You can get it via 'xrandr --listactivemonitors'
display="HDMI-2"
# Set width of this display in px

21
uninstall/docker Executable file
View File

@@ -0,0 +1,21 @@
#!/bin/bash
##makedesc: Uninstall docker
echo
echo "==============================================="
echo "Uninstalling docker..."
echo "==============================================="
echo
# sudo apt remove -y docker docker-engine docker.io containerd runc
sudo apt remove -y \
containerd \
containerd.io \
docker \
docker-ce \
docker-ce-cli \
docker-compose \
docker-compose-plugin \
docker-engine \
docker.io \
runc

11
uninstall/omz Executable file
View File

@@ -0,0 +1,11 @@
#!/bin/bash
##makedesc: Uninstall omz
echo
echo "==============================================="
echo "Uninstalling omz..."
echo "==============================================="
echo
bash $ZSH/tools/uninstall.sh
exec bash

10
upgrade/omz Executable file
View File

@@ -0,0 +1,10 @@
#!/bin/bash
##makedesc: Upgrade omz
echo
echo "==============================================="
echo "Upgrading omz..."
echo "==============================================="
echo
bash $ZSH/tools/upgrade.sh