Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
66aff98afd
|
|||
|
c7449f4acb
|
|||
|
0493f18b18
|
|||
|
b8ca9a8dad
|
@@ -1,158 +0,0 @@
|
||||
#!/usr/bin/env 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 sudo’ed
|
||||
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
|
||||
# }
|
||||
110
dotfiles/.bashrc
110
dotfiles/.bashrc
@@ -1,110 +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
|
||||
|
||||
[ -f ~/.profile ] && source ~/.profile
|
||||
@@ -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
|
||||
@@ -1,143 +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
|
||||
archive = "!f() { top=$(rev-parse --show-toplevel); cd $top; tar cvzf $top.tar.gz $top ; }; f" # make repo .tar.gz
|
||||
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
|
||||
br = "branch" #
|
||||
branches = "branch -a"
|
||||
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
|
||||
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
|
||||
empty="!git commit --allow-empty"
|
||||
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
|
||||
gwhoami = "guser"
|
||||
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"
|
||||
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" # получить теги
|
||||
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" # отправить ветку принудительно
|
||||
pushft = "!git push --tags --force" # отправить теги принудительно
|
||||
pusht = "!git push --tags" # отправить теги
|
||||
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"
|
||||
st = "status"
|
||||
start = "!git init -q && git commit --allow-empty -m 'Initial commit'"
|
||||
stashes = "stash list" # show stashed changes
|
||||
sub = "submodule"
|
||||
tags = "tag -n1 --list" # shot tag names and commit message
|
||||
targz = "archive"
|
||||
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"
|
||||
undo = "uncommit"
|
||||
unstage = "reset HEAD" # staged file => unstaged
|
||||
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)
|
||||
vacuum="!git reflog expire --expire-unreachable=now --all; git gc --prune=now"
|
||||
whoami = "user"
|
||||
wip = "!git add . && git commit -am 'WIP'"
|
||||
wipa = "!git add . && git commit --amend -am 'WIP'"
|
||||
|
||||
|
||||
|
||||
|
||||
; branches = "bvv"
|
||||
; cpnx = "cherry-pick --no-commit -x"
|
||||
; last-tag = "describe --tags --abbrev=0"
|
||||
; last-tagged = "!git describe --tags $(git rev-list --tags --max-count=1)"
|
||||
; ploh = "pull origin HEAD" # получить текущую ветку из origin
|
||||
; pr = "!git fetch origin pull/$1/head:pr/$1 && git checkout pr/$1" # github: встать на PR с указанным id
|
||||
; sa = "submodule add"
|
||||
; sdi = "submodule deinit -f"
|
||||
; si = "submodule init"
|
||||
; ss = "submodule summary"
|
||||
; sst = "submodule status"
|
||||
; sup = "submodule update"
|
||||
; sy = "remote update origin --prune"
|
||||
@@ -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
|
||||
5
dotfiles/.gitignore
vendored
5
dotfiles/.gitignore
vendored
@@ -1,5 +0,0 @@
|
||||
.DS_Store
|
||||
Desktop.ini
|
||||
._*
|
||||
Thumbs.db
|
||||
nbproject/
|
||||
@@ -1,63 +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 ##########################################
|
||||
|
||||
[ -f ~/.bash_aliases ] && source ~/.bash_aliases
|
||||
[ -f ~/bars/src/lis-docker/.bash_aliases ] && source ~/bars/src/lis-docker/.bash_aliases
|
||||
|
||||
export LITE_SCALE=1 # workaround https://github.com/lite-xl/lite-xl/issues/1173
|
||||
|
||||
export JAVA_HOME="/usr/bin/"
|
||||
export PATH="/opt/nvim-linux64/bin:$PATH"
|
||||
export PATH="$HOME/.local/bin/:$PATH"
|
||||
export PATH="$HOME/.local/share/JetBrains/Toolbox/scripts:$PATH"
|
||||
export PATH="$(composer config -g home)/vendor/bin:$PATH"
|
||||
|
||||
# phpbrew
|
||||
# export PHPBREW_SET_PROMPT=1
|
||||
# export PHPBREW_RC_ENABLE=1
|
||||
# [ -f ~/.phpbrew/bashrc ] && source ~/.phpbrew/bashrc
|
||||
|
||||
# golang
|
||||
export PATH="/usr/local/go/bin:$PATH"
|
||||
export GOPATH="$HOME/.go"
|
||||
|
||||
# rust cargo
|
||||
[ -f ~/.cargo/env ] && source ~/.cargo/env
|
||||
|
||||
# nvm
|
||||
# export NVM_DIR="$HOME/.nvm"
|
||||
# [ -s "$NVM_DIR/nvm.sh" ] && source "$NVM_DIR/nvm.sh" # This loads nvm
|
||||
# [ -s "$NVM_DIR/bash_completion" ] && source "$NVM_DIR/bash_completion" # This loads nvm bash_completion
|
||||
|
||||
# The next line updates PATH for Yandex Cloud CLI.
|
||||
[ -f "$HOME/yandex-cloud/path.bash.inc" ] && source "$HOME/yandex-cloud/path.bash.inc"
|
||||
|
||||
# The next line enables shell command completion for yc.
|
||||
[ -f "$HOME/yandex-cloud/completion.zsh.inc" ] && source "$HOME/yandex-cloud/completion.zsh.inc"
|
||||
114
dotfiles/.zshrc
114
dotfiles/.zshrc
@@ -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
|
||||
@@ -1,2 +0,0 @@
|
||||
This directory contains files whose names start with a dot.
|
||||
Make sure your file manager displays them here.
|
||||
@@ -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"
|
||||
]
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
// https://docs.sublimetext.io/reference/commands.html
|
||||
// https://docs.sublimetext.io/reference/key_bindings.html
|
||||
[
|
||||
{ "keys": ["ctrl+k", "ctrl+o"], "command": "prompt_open_folder" },
|
||||
{ "keys": ["ctrl+f2"], "command": "find_all_under"},
|
||||
]
|
||||
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
// https://docs.sublimetext.io/reference/commands.html
|
||||
// https://docs.sublimetext.io/reference/mouse_bindings.html
|
||||
[
|
||||
{
|
||||
"button": "button2", "modifiers": ["ctrl"],
|
||||
"command": "fold",
|
||||
"press_command": "drag_select"
|
||||
},
|
||||
]
|
||||
@@ -1,18 +0,0 @@
|
||||
{
|
||||
"bootstrapped": true,
|
||||
"in_process_packages":
|
||||
[
|
||||
],
|
||||
"installed_packages":
|
||||
[
|
||||
"Docker Based Build Systems",
|
||||
"Dockerfile Syntax Highlighting",
|
||||
"LogView",
|
||||
"Markdown Extended",
|
||||
"MarkdownLivePreview",
|
||||
"MarkdownPreview",
|
||||
"Materialize",
|
||||
"Package Control",
|
||||
"phpfmt",
|
||||
],
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
{
|
||||
"ignored_packages":
|
||||
[
|
||||
"Vintage",
|
||||
],
|
||||
"color_scheme": "Packages/Materialize/schemes/Material One Dark.tmTheme",
|
||||
"theme": "Material One Dark.sublime-theme",
|
||||
"index_files": true,
|
||||
"font_face": "JetBrains Mono NL",
|
||||
"font_options": [
|
||||
"dlig",
|
||||
"ss01",
|
||||
"gray_antialias"
|
||||
],
|
||||
"fade_fold_buttons": false,
|
||||
"rulers": [120],
|
||||
"translate_tabs_to_spaces": true,
|
||||
"highlight_line": true,
|
||||
"control_character_style": "names",
|
||||
"trim_trailing_white_space_on_save": "all",
|
||||
"trim_only_modified_white_space": false,
|
||||
"ensure_newline_at_eof_on_save": true,
|
||||
"scroll_speed": 1.2,
|
||||
"show_tab_close_buttons": false,
|
||||
"folder_exclude_patterns": [".svn", ".hg", "CVS", ".Trash", ".Trash-*"],
|
||||
}
|
||||
46
install/_example
Normal file
46
install/_example
Normal 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
46
install/anytype
Executable 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
|
||||
@@ -1,11 +1,46 @@
|
||||
#!/usr/bin/env bash
|
||||
##makedesc: Install apache2 (latest)
|
||||
source "$( dirname $(readlink -e -- "${BASH_SOURCE}"))/../helpers.sh" || exit 255
|
||||
##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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
##makedesc: Install software from apt
|
||||
##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
|
||||
|
||||
@@ -1,13 +1,52 @@
|
||||
#!/usr/bin/env bash
|
||||
##makedesc: Install Canon Pixma MG2500 + ppa
|
||||
source "$( dirname $(readlink -e -- "${BASH_SOURCE}"))/../helpers.sh" || exit 255
|
||||
##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
|
||||
|
||||
@@ -1,17 +1,56 @@
|
||||
#!/usr/bin/env bash
|
||||
##makedesc: Install google chrome (latest)
|
||||
source "$( dirname $(readlink -e -- "${BASH_SOURCE}"))/../helpers.sh" || exit 255
|
||||
##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
|
||||
|
||||
@@ -1,6 +1,56 @@
|
||||
#!/usr/bin/env bash
|
||||
##makedesc: ClamAV (WIP)
|
||||
##makedesc: ClamAV
|
||||
|
||||
sudo apt install clamav -y && \
|
||||
echo "DatabaseMirror packages.microsoft.com/clamav" | sudo tee -a /etc/clamav/freshclam.conf && \
|
||||
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
|
||||
|
||||
@@ -1,39 +1,78 @@
|
||||
#!/usr/bin/env bash
|
||||
##makedesc: Install docker (latest) + ppa
|
||||
source "$( dirname $(readlink -e -- "${BASH_SOURCE}"))/../helpers.sh" || exit 255
|
||||
##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
|
||||
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
|
||||
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
|
||||
}
|
||||
|
||||
key="/etc/apt/keyrings/docker.asc"
|
||||
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
|
||||
}
|
||||
|
||||
sudo install -m 0755 -d /etc/apt/keyrings
|
||||
sudo cdownload https://download.docker.com/linux/ubuntu/gpg $key
|
||||
sudo chmod a+r $key
|
||||
remove() {
|
||||
echo
|
||||
echo "==============================================="
|
||||
echo "Removing Docker"
|
||||
echo "==============================================="
|
||||
echo
|
||||
doRemove
|
||||
echo
|
||||
echo "Finish!"
|
||||
echo
|
||||
}
|
||||
|
||||
echo "deb [arch=$(dpkg_arch) signed-by=$key] https://download.docker.com/linux/ubuntu $VERSION_CODENAME stable" \
|
||||
| sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
|
||||
|
||||
apt_update
|
||||
apt_install \
|
||||
docker-ce \
|
||||
docker-ce-cli \
|
||||
containerd.io \
|
||||
docker-buildx-plugin \
|
||||
docker-compose-plugin
|
||||
|
||||
sudo usermod -aG docker $(whoami)
|
||||
newgrp docker
|
||||
|
||||
success "Docker installed!"
|
||||
docker --version
|
||||
info "Probably, you need to relogin to apply 'docker' group permanently."
|
||||
case "$1" in
|
||||
u|upgrade|update) upgrade ;;
|
||||
r|remove|d|delete|p|purge) remove ;;
|
||||
*) install ;;
|
||||
esac
|
||||
|
||||
53
install/frkn
53
install/frkn
@@ -1,53 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
##makedesc: Install Wireguard + FRKN (deprecated)
|
||||
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=(jp nl tr at ru se)
|
||||
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"
|
||||
}
|
||||
@@ -1,28 +1,55 @@
|
||||
#!/usr/bin/env bash
|
||||
##makedesc: Install golang v1.21.0
|
||||
source "$( dirname $(readlink -e -- "${BASH_SOURCE}"))/../helpers.sh" || exit 255
|
||||
##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
|
||||
success "golang installed!"
|
||||
info "NOTE: now run 'source ~/.profile' to apply new env vars"
|
||||
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
|
||||
echo "Finish!"
|
||||
go version
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
#!/usr/bin/env 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
|
||||
}
|
||||
66
install/nerd-fonts
Executable file
66
install/nerd-fonts
Executable 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
|
||||
|
||||
81
install/nvim
81
install/nvim
@@ -1,33 +1,80 @@
|
||||
#!/usr/bin/env bash
|
||||
##makedesc: Install nvim + lazyvim
|
||||
source "$( dirname $(readlink -e -- "${BASH_SOURCE}"))/../helpers.sh" || exit 255
|
||||
set -eo pipefail
|
||||
|
||||
# https://www.lazyvim.org/installation
|
||||
# https://www.devas.life/effective-neovim-setup-for-web-development-towards-2024/
|
||||
|
||||
title
|
||||
# TODO https://github.com/rockerBOO/awesome-neovim
|
||||
# TODO https://docs.astronvim.com
|
||||
|
||||
require git
|
||||
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
|
||||
)
|
||||
|
||||
nvimUrl="https://github.com/neovim/neovim/releases/latest/download/nvim-linux-x86_64.tar.gz"
|
||||
installPath="$HOME/install"
|
||||
installTar="$installPath/nvim.tar.gz"
|
||||
backup() {
|
||||
echo "Backup configuration files..."
|
||||
t=$(date +'%s')
|
||||
for path in "${nvimDataPaths[@]}"; do
|
||||
[[ -d "$path" ]] && cp -v "$path" "$path-$t.bak"
|
||||
done
|
||||
echo "Done"
|
||||
}
|
||||
|
||||
[ -d "$HOME/.config/nvim" ] && mv "$HOME"/.config/nvim{,.bak}
|
||||
[ -d "$HOME/.local/share/nvim" ] && mv "$HOME"/.local/share/nvim{,.bak}
|
||||
[ -d "$HOME/.local/state/nvim" ] && mv "$HOME"/.local/state/nvim{,.bak}
|
||||
[ -d "$HOME/.cache/nvim" ] && mv "$HOME"/.cache/nvim{,.bak}
|
||||
install() {
|
||||
echo
|
||||
echo "==============================================="
|
||||
echo "Installing neovim"
|
||||
echo "==============================================="
|
||||
echo
|
||||
|
||||
download "$nvimUrl" "$installTar"
|
||||
unpack_targz "$installTar" "$installPath"
|
||||
backup
|
||||
wget "$url" -O "$downloadTarGz"
|
||||
tar -xzf "$downloadTarGz" -C "$downloadPath"
|
||||
|
||||
sudo rm -vrf /opt/nvim
|
||||
sudo mv -v "$installPath/nvim-linux-x86_64" /opt/nvim
|
||||
sudo rm -rf "$installPath"
|
||||
sudo mv "$downloadPath/nvim-linux-x86_64" "$installPath"
|
||||
|
||||
git.clone_quick https://github.com/LazyVim/starter "$HOME/.config/nvim"
|
||||
rm -rf "$HOME/.config/nvim/.git"
|
||||
git clone --depth=1 --single-branch https://github.com/LazyVim/starter "$cfgPath"
|
||||
rm -rf "$cfgPath/.git"
|
||||
|
||||
sudo update-desktop-database && \
|
||||
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"
|
||||
|
||||
@@ -6,6 +6,6 @@
|
||||
|
||||
# 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-0'
|
||||
DIRECTION="$1" # (left|right|normal|inverted)
|
||||
OUTPUT='HDMI-A-1'
|
||||
[ "$1" ] && DIRECTION="$1" || DIRECTION="normal" # (left|right|normal|inverted)
|
||||
kscreen-doctor "output.$OUTPUT.rotation.$DIRECTION"
|
||||
@@ -3,7 +3,6 @@
|
||||
# https://gist.github.com/anthonyaxenov/02c00c965be4eb5bb163a153abdf4c2b
|
||||
# https://itsfoss.com/free-up-space-ubuntu-linux/
|
||||
|
||||
|
||||
echo
|
||||
echo
|
||||
df -hx tmpfs
|
||||
@@ -51,10 +50,6 @@ sudo snap list --all \
|
||||
sudo snap remove "$snapname" --revision="$revision"
|
||||
done
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
echo
|
||||
echo
|
||||
df -hx tmpfs
|
||||
6
scripts/utils/clock
Executable file
6
scripts/utils/clock
Executable file
@@ -0,0 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
set -u
|
||||
set -o pipefail
|
||||
|
||||
exec watch -tn 1 date '+%l:%M:%S%p'
|
||||
18
scripts/utils/copy
Executable file
18
scripts/utils/copy
Executable file
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
set -u
|
||||
|
||||
if hash pbcopy 2>/dev/null; then
|
||||
exec pbcopy
|
||||
elif hash xclip 2>/dev/null; then
|
||||
exec xclip -selection clipboard
|
||||
elif hash putclip 2>/dev/null; then
|
||||
exec putclip
|
||||
else
|
||||
rm -f /tmp/clipboard 2> /dev/null
|
||||
if [ $# -eq 0 ]; then
|
||||
cat > /tmp/clipboard
|
||||
else
|
||||
cat "$1" > /tmp/clipboard
|
||||
fi
|
||||
fi
|
||||
0
tools/dc → scripts/utils/dc
Normal file → Executable file
0
tools/dc → scripts/utils/dc
Normal file → Executable file
69
scripts/utils/httpcode
Executable file
69
scripts/utils/httpcode
Executable file
@@ -0,0 +1,69 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
set -u
|
||||
|
||||
statuses="100 Continue
|
||||
101 Switching Protocols
|
||||
102 Processing
|
||||
200 OK
|
||||
201 Created
|
||||
202 Accepted
|
||||
203 Non-Authoritative Information
|
||||
204 No Content
|
||||
205 Reset Content
|
||||
206 Partial Content
|
||||
207 Multi-Status
|
||||
208 Already Reported
|
||||
300 Multiple Choices
|
||||
301 Moved Permanently
|
||||
302 Found
|
||||
303 See Other
|
||||
304 Not Modified
|
||||
305 Use Proxy
|
||||
307 Temporary Redirect
|
||||
400 Bad Request
|
||||
401 Unauthorized
|
||||
402 Payment Required
|
||||
403 Forbidden
|
||||
404 Not Found
|
||||
405 Method Not Allowed
|
||||
406 Not Acceptable
|
||||
407 Proxy Authentication Required
|
||||
408 Request Timeout
|
||||
409 Conflict
|
||||
410 Gone
|
||||
411 Length Required
|
||||
412 Precondition Failed
|
||||
413 Request Entity Too Large
|
||||
414 Request-URI Too Large
|
||||
415 Unsupported Media Type
|
||||
416 Request Range Not Satisfiable
|
||||
417 Expectation Failed
|
||||
418 I'm a teapot
|
||||
420 Blaze it
|
||||
422 Unprocessable Entity
|
||||
423 Locked
|
||||
424 Failed Dependency
|
||||
425 No code
|
||||
426 Upgrade Required
|
||||
428 Precondition Required
|
||||
429 Too Many Requests
|
||||
431 Request Header Fields Too Large
|
||||
449 Retry with
|
||||
500 Internal Server Error
|
||||
501 Not Implemented
|
||||
502 Bad Gateway
|
||||
503 Service Unavailable
|
||||
504 Gateway Timeout
|
||||
505 HTTP Version Not Supported
|
||||
506 Variant Also Negotiates
|
||||
507 Insufficient Storage
|
||||
509 Bandwidth Limit Exceeded
|
||||
510 Not Extended
|
||||
511 Network Authentication Required"
|
||||
|
||||
if [ $# -eq 0 ]; then
|
||||
echo "$statuses"
|
||||
else
|
||||
echo "$statuses" | grep -i --color=never "$@"
|
||||
fi
|
||||
5
scripts/utils/len
Executable file
5
scripts/utils/len
Executable file
@@ -0,0 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
set -u
|
||||
|
||||
echo -n "$@" | wc -c | awk '{print $1}'
|
||||
6
scripts/utils/line
Executable file
6
scripts/utils/line
Executable file
@@ -0,0 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
set -u
|
||||
|
||||
lineno="$1"; shift
|
||||
sed -n "${lineno}p" -- "$@"
|
||||
23
scripts/utils/mksh
Executable file
23
scripts/utils/mksh
Executable file
@@ -0,0 +1,23 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
set -u
|
||||
set -o pipefail
|
||||
|
||||
if [ ! $# -eq 1 ]; then
|
||||
echo 'mksh takes one argument' 1>&2
|
||||
exit 1
|
||||
elif [ -e "$1" ]; then
|
||||
echo "$1 already exists" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo '#!/usr/bin/env bash
|
||||
set -e
|
||||
set -u
|
||||
set -o pipefail
|
||||
|
||||
' > "$1"
|
||||
|
||||
chmod u+x "$1"
|
||||
|
||||
"$EDITOR" "$1"
|
||||
73
scripts/utils/note
Executable file
73
scripts/utils/note
Executable file
@@ -0,0 +1,73 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Note taking tool
|
||||
#
|
||||
# Usage:
|
||||
# note [name] - Create a new note with optional name (defaults to "New note")
|
||||
# note -e|--edit [name] - Edit an existing note by name
|
||||
#
|
||||
# Arguments explanation:
|
||||
# [name] - Note filename (without extension) and title
|
||||
# -e, --edit [name] - Edit existing note by name
|
||||
#
|
||||
# Detailed usage:
|
||||
# note - Creates "New note" with current timestamp
|
||||
# note my-idea - Creates note titled "my-idea"
|
||||
# note my-idea "My Great Idea" - Creates note file "my-idea" but titled "My Great Idea"
|
||||
# note -e my-idea - Edits existing note with name "my-idea"
|
||||
#
|
||||
# Notes are stored as markdown files in ~/notes/ with timestamps
|
||||
# When multiple notes have the same name, you'll be prompted to select which one to edit
|
||||
|
||||
arg1="$1"
|
||||
arg2="$2"
|
||||
path="$HOME/notes"
|
||||
[[ ! -d "$path" ]] && mkdir -p "$path"
|
||||
|
||||
shopt -s nullglob
|
||||
files=("$path"/*.md)
|
||||
shopt -u nullglob
|
||||
|
||||
case "$arg1" in
|
||||
-e|--edit)
|
||||
[[ -z "$arg2" ]] && {
|
||||
echo "Note name is required"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# shellcheck disable=SC2207
|
||||
found=($(echo "${files[@]}" | grep -P "[0-9]{10}-$arg2.md"))
|
||||
[[ ${#found[@]} -eq 0 ]] && {
|
||||
echo "Note with name '$arg2' not found."
|
||||
echo "Create it with using 'note $arg2'"
|
||||
exit
|
||||
}
|
||||
|
||||
[[ ${#found[@]} -eq 1 ]] && {
|
||||
nano "${found[0]}"
|
||||
exit
|
||||
}
|
||||
|
||||
PS3="Select a note to edit: "
|
||||
select selection in "${found[@]}" "Exit"; do
|
||||
[[ "$selection" == "Exit" ]] && exit
|
||||
[[ -f "$selection" ]] && {
|
||||
nano "$selection"
|
||||
exit
|
||||
}
|
||||
continue
|
||||
done
|
||||
;;
|
||||
|
||||
*)
|
||||
[[ -z "$arg2" ]] && arg2="${arg1:-New note}"
|
||||
file="$path/$(date +%s)-$arg1.md"
|
||||
cat <<EOF > "$file"
|
||||
# $arg2
|
||||
|
||||
Note taken: $(date '+%d.%m.%Y %H:%M:%S')
|
||||
|
||||
EOF
|
||||
nano "$file"
|
||||
;;
|
||||
esac
|
||||
45
scripts/utils/notes
Executable file
45
scripts/utils/notes
Executable file
@@ -0,0 +1,45 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
set -o pipefail
|
||||
|
||||
# Notes listing tool
|
||||
#
|
||||
# Purpose:
|
||||
# Lists all markdown notes stored in ~/notes/ directory
|
||||
#
|
||||
# Usage:
|
||||
# notes - Display all available notes
|
||||
#
|
||||
# Output:
|
||||
# - Shows filenames of all .md files in ~/notes/
|
||||
# - If no notes exist or directory is empty, displays "Empty"
|
||||
# - Provides hint to use 'note -e' for editing
|
||||
#
|
||||
# Example output:
|
||||
# 1703123456-my-idea.md
|
||||
# 1703123789-shopping-list.md
|
||||
# 1703124012-project-notes.md
|
||||
#
|
||||
# Use 'note -e' to edit existing notes
|
||||
|
||||
path="$HOME/notes"
|
||||
|
||||
[[ ! -d "$path" ]] && {
|
||||
echo "Empty"
|
||||
exit 0
|
||||
}
|
||||
|
||||
shopt -s nullglob
|
||||
files=("$path"/*.md)
|
||||
shopt -u nullglob
|
||||
|
||||
[[ "${#files}" -eq 0 ]] && {
|
||||
echo "Empty"
|
||||
exit 0
|
||||
}
|
||||
for file in "${files[@]}"; do
|
||||
echo "${file/$path\//}"
|
||||
done
|
||||
|
||||
echo
|
||||
echo "Use 'note -e' to edit existing notes"
|
||||
3
scripts/utils/now
Executable file
3
scripts/utils/now
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
date '+%d.%m.%Y %H:%M:%S'
|
||||
13
scripts/utils/pasta
Executable file
13
scripts/utils/pasta
Executable file
@@ -0,0 +1,13 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
set -u
|
||||
|
||||
if hash pbpaste 2>/dev/null; then
|
||||
exec pbpaste
|
||||
elif hash xclip 2>/dev/null; then
|
||||
exec xclip -selection clipboard -o
|
||||
elif [[ -e /tmp/clipboard ]]; then
|
||||
exec cat /tmp/clipboard
|
||||
else
|
||||
echo ''
|
||||
fi
|
||||
13
scripts/utils/running
Executable file
13
scripts/utils/running
Executable file
@@ -0,0 +1,13 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
set -u
|
||||
|
||||
process_list="$(ps -eo 'pid command')"
|
||||
if [[ $# != 0 ]]; then
|
||||
process_list="$(echo "$process_list" | grep -Fiw "$@")"
|
||||
fi
|
||||
|
||||
echo "$process_list" |
|
||||
grep -Fv "${BASH_SOURCE[0]}" |
|
||||
grep -Fv grep |
|
||||
GREP_COLORS='mt=00;35' grep -E --colour=auto '^\s*[[:digit:]]+'
|
||||
8
scripts/utils/scratch
Executable file
8
scripts/utils/scratch
Executable file
@@ -0,0 +1,8 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
set -u
|
||||
set -o pipefail
|
||||
|
||||
file="$(mktemp)"
|
||||
echo "Editing $file"
|
||||
exec "$EDITOR" "$file"
|
||||
25
scripts/utils/serve
Executable file
25
scripts/utils/serve
Executable file
@@ -0,0 +1,25 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
set -u
|
||||
set -o pipefail
|
||||
|
||||
port='8888'
|
||||
if [ $# -eq 1 ]; then
|
||||
port="$1"
|
||||
fi
|
||||
|
||||
if hash php 2>/dev/null; then
|
||||
exec php -S "localhost:$port"
|
||||
elif hash python3 2>/dev/null; then
|
||||
exec python3 -m http.server "$port"
|
||||
elif hash python 2>/dev/null; then
|
||||
major_version="$(python -c 'import platform as p;print(p.python_version_tuple()[0])')"
|
||||
if [[ "$major_version" == '3' ]]; then
|
||||
exec python -m http.server "$port"
|
||||
else
|
||||
exec python -m SimpleHTTPServer "$port"
|
||||
fi
|
||||
else
|
||||
echo 'unable to start HTTP server' 1>&2
|
||||
exit 1
|
||||
fi
|
||||
11
scripts/utils/timer
Executable file
11
scripts/utils/timer
Executable file
@@ -0,0 +1,11 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
set -u
|
||||
set -o pipefail
|
||||
|
||||
sleep "$1"
|
||||
notify-send 'Timer complete!' \
|
||||
-u normal \
|
||||
-t 10000 \
|
||||
-i clock \
|
||||
-a 'Timer script'
|
||||
6
scripts/utils/trash
Executable file
6
scripts/utils/trash
Executable file
@@ -0,0 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
set -u
|
||||
set -o pipefail
|
||||
|
||||
gio trash "$@"
|
||||
8
scripts/utils/tryna
Executable file
8
scripts/utils/tryna
Executable file
@@ -0,0 +1,8 @@
|
||||
#!/usr/bin/env bash
|
||||
set -u
|
||||
|
||||
"$@"
|
||||
while [[ ! "$?" -eq 0 ]]; do
|
||||
sleep 0.5
|
||||
"$@"
|
||||
done
|
||||
8
scripts/utils/trynafail
Executable file
8
scripts/utils/trynafail
Executable file
@@ -0,0 +1,8 @@
|
||||
#!/usr/bin/env bash
|
||||
set -u
|
||||
|
||||
"$@"
|
||||
while [[ "$?" -eq 0 ]]; do
|
||||
sleep 0.5
|
||||
"$@"
|
||||
done
|
||||
14
scripts/utils/url2md
Executable file
14
scripts/utils/url2md
Executable file
@@ -0,0 +1,14 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
set -u
|
||||
set -o pipefail
|
||||
|
||||
curl "https://r.jina.ai/$1" \
|
||||
-sS \
|
||||
-H "DNT: 1" \
|
||||
-H "X-Base: final" \
|
||||
-H "X-Engine: direct" \
|
||||
-H "X-Md-Em-Delimiter: *" \
|
||||
-H "X-Md-Heading-Style: setext" \
|
||||
-H "X-Md-Link-Reference-Style: collapsed" \
|
||||
-H "X-Md-Link-Style: referenced"
|
||||
13
scripts/utils/waitfor
Executable file
13
scripts/utils/waitfor
Executable file
@@ -0,0 +1,13 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
set -u
|
||||
set -o pipefail
|
||||
|
||||
if hash systemd-inhibit 2>/dev/null; then
|
||||
systemd-inhibit \
|
||||
--who=waitfor \
|
||||
--why="Awaiting PID $1" \
|
||||
tail --pid="$1" -f /dev/null
|
||||
else
|
||||
tail --pid="$1" -f /dev/null
|
||||
fi
|
||||
115
tools/frkn.sh
115
tools/frkn.sh
@@ -1,115 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
function disconnect() {
|
||||
echo "Disconnecting: $1"
|
||||
sudo wg-quick down "$1"
|
||||
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
|
||||
echo
|
||||
}
|
||||
|
||||
function connect() {
|
||||
echo "Connecting: frkn-$1"
|
||||
sudo sysctl -w net.ipv6.conf.all.disable_ipv6=0
|
||||
sudo sysctl -w net.ipv6.conf.default.disable_ipv6=0
|
||||
sudo sysctl -w net.ipv6.conf.lo.disable_ipv6=0
|
||||
sudo wg-quick up "frkn-$1"
|
||||
echo
|
||||
}
|
||||
|
||||
function in_array() {
|
||||
local find=$1
|
||||
shift
|
||||
for e in "$@"; do
|
||||
[[ "$e" == "$find" ]] && return 0
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
function update_wg() {
|
||||
sudo apt install -y wireguard jq && wg --version
|
||||
}
|
||||
|
||||
function update_frkn() {
|
||||
local countries=(uk ru nl nl2 ch)
|
||||
for idx in ${!countries[@]}; do
|
||||
country=${countries[idx]}
|
||||
echo "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 mv -f ./frkn-*.conf /etc/wireguard/
|
||||
}
|
||||
|
||||
command="$1"
|
||||
countries=()
|
||||
current=$(sudo wg show | head -n 1 | awk '{print $2}')
|
||||
|
||||
for file in /etc/wireguard/*.conf; do
|
||||
filename=${file/\/etc\/wireguard\/frkn-}
|
||||
code=${filename/.conf/}
|
||||
countries+=($code)
|
||||
done
|
||||
|
||||
correct=-1
|
||||
if [ -z "$command" ] ; then
|
||||
while [ $correct -lt 0 ]; do
|
||||
read -rp "Entry on of country code (${countries[*]}): " command
|
||||
if in_array "$command" ${countries[@]}; then
|
||||
correct=1
|
||||
else
|
||||
echo "Неверный код страны!"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
case "$command" in
|
||||
"update" )
|
||||
if update_wg && update_frkn; then
|
||||
echo "Wireguard and FRKN updated"
|
||||
else
|
||||
echo "Something went wrong"
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
|
||||
"down" )
|
||||
if [ -n "$current" ]; then
|
||||
disconnect "$current"
|
||||
fi
|
||||
;;
|
||||
|
||||
"show" )
|
||||
sudo wg show
|
||||
;;
|
||||
|
||||
* )
|
||||
if [ -n "$current" ]; then
|
||||
disconnect "$current"
|
||||
fi
|
||||
connect "$command"
|
||||
;;
|
||||
esac
|
||||
@@ -1,10 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
##makedesc: Uninstall apache2
|
||||
source "$( dirname $(readlink -e -- "${BASH_SOURCE}"))/../helpers.sh" || exit 255
|
||||
|
||||
title
|
||||
|
||||
apt_remove apache2
|
||||
|
||||
success "apache2 removed!"
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
##makedesc: Uninstall Canon Pixma MG2500 + ppa
|
||||
source "$( dirname $(readlink -e -- "${BASH_SOURCE}"))/../helpers.sh" || exit 255
|
||||
|
||||
title
|
||||
|
||||
apt_ppa_remove ppa:thierry-f/fork-michael-gruz
|
||||
|
||||
dpkg_remove cnijfilter-mg2500series
|
||||
dpkg_remove cnijfilter-common
|
||||
dpkg_remove scangearmp-mg2500series
|
||||
dpkg_remove scangearmp-common
|
||||
|
||||
success "Drivers for Canon Pixma MG2500 removed!"
|
||||
|
||||
Reference in New Issue
Block a user