From a0d5904ece4381df402bfba99cd64c36b87f9f96 Mon Sep 17 00:00:00 2001 From: h7x4 Date: Fri, 28 May 2021 21:01:01 +0200 Subject: [PATCH] modify several aliases --- general/.aliases | 147 ++++++++++++------ general/.gitconfig | 12 +- general/.project-template-aliases/latex | 11 ++ .../latex-resources/.latexmkrc | 0 .../latex-resources/bibliography.bib | 0 .../latex-resources/main.tex | 0 general/.project-template-aliases/python | 9 ++ laptop/.aliases.laptop | 14 +- 8 files changed, 137 insertions(+), 56 deletions(-) create mode 100644 general/.project-template-aliases/latex create mode 100644 general/.project-template-aliases/latex-resources/.latexmkrc create mode 100644 general/.project-template-aliases/latex-resources/bibliography.bib create mode 100644 general/.project-template-aliases/latex-resources/main.tex create mode 100644 general/.project-template-aliases/python diff --git a/general/.aliases b/general/.aliases index 9a1e5ba..e409e9d 100755 --- a/general/.aliases +++ b/general/.aliases @@ -1,10 +1,13 @@ #!/usr/bin/env bash -export SCREENSHOT_DIR='~/pictures/screenshots' +# When using zsh, see also +# $HOME/.oh-my-zsh/lib -# ░█▀█░█▀▄░█▀█░█▀▀░█▀▄░█▀█░█▄█░█▀▀ -# ░█▀▀░█▀▄░█░█░█░█░█▀▄░█▀█░█░█░▀▀█ -# ░▀░░░▀░▀░▀▀▀░▀▀▀░▀░▀░▀░▀░▀░▀░▀▀▀ +export SCREENSHOT_DIR='$HOME/pictures/screenshots' + +# ░█▀▀░█░█░▀█▀░░░█▀▀░█▀█░█▀▀░▀█▀░█░█░█▀█░█▀▄░█▀▀ +# ░█▀▀░▄▀▄░░█░░░░▀▀█░█░█░█▀▀░░█░░█▄█░█▀█░█▀▄░█▀▀ +# ░▀▀▀░▀░▀░░▀░░░░▀▀▀░▀▀▀░▀░░░░▀░░▀░▀░▀░▀░▀░▀░▀▀▀ alias m="ncmpcpp" @@ -32,15 +35,17 @@ if command -v youtube-dl &> /dev/null; then fi if command -v maim &> /dev/null; then - alias skusho='maim -u -k $(echo $SCREENSHOT_DIR)/$(date +%s).png' + alias skusho='maim --hidecursor --nokeyboard $(echo $SCREENSHOT_DIR)/$(date +%s).png' if command -v xclip &> /dev/null; then - alias skushoclip='maim -k -s -u | xclip -selection clipboard -t image/png -i' + alias skushoclip='maim --hidecursor --nokeyboard --select | xclip -selection clipboard -target image/png -in' fi fi if command -v rsync &> /dev/null; then - alias cp='rsync --progress -h' + alias ccp='/usr/bin/cp' + alias cp='rsync --progress --human-readable' + alias cpr='rsync --progress --human-readable --recursive' fi if command -v bat &> /dev/null; then @@ -52,16 +57,29 @@ if command -v netstat &> /dev/null; then alias ports='sudo netstat -tulpn | grep LISTEN' fi +# alias tangle-doom-emacs='cd $HOME/.doom.d && $HOME/.emacs.d/bin/org-tangle config.org && cd -' + +if command -v xmonad &> /dev/null; then + alias xr='xmonad --recompile' + + # TODO: Update to paru + alias xmr='yay -S xmobar-git --answerclean A --answerdiff N' + alias xxmr='xr; xmr' +fi + +if [[ -f $HOME/.scripts/dropbox.py ]]; then + alias dp="python $HOME/.scripts/dropbox.py" +fi + # ░█▀▀░█▀█░█░░░█▀█░█▀▄ # ░█░░░█░█░█░░░█░█░█▀▄ # ░▀▀▀░▀▀▀░▀▀▀░▀▀▀░▀░▀ - if command -v exa &> /dev/null; then + alias lls='/usr/bin/ls' alias ls='exa' - alias ll='exa --long --header --git' - alias sl='exa -a --long --header --git' - alias la='exa -a' + alias sl='ls' + alias lsa='exa -lah --changed --time-style long-iso --git --group' else alias ls='ls --group-directories-first --color=auto' alias ll='ls -alFh --group-directories-first --color=auto' @@ -74,36 +92,12 @@ alias grep='grep --color=auto' alias fgrep='fgrep --color=auto' alias egrep='egrep --color=auto' -alias echo-colors='for x in 0 1 4 5 7 8; do for i in {30..37}; do for a in {40..47}; do echo -ne "\e[$x;$i;$a""m\\\e[$x;$i;$a""m\e[0;37;40m "; done; echo; done; done; echo "";' +# ░█▀▄░▀█▀░█▀▄░░░▀▀█░█░█░█▄█░█▀█░█▀▀ +# ░█░█░░█░░█▀▄░░░░░█░█░█░█░█░█▀▀░▀▀█ +# ░▀▀░░▀▀▀░▀░▀░░░▀▀░░▀▀▀░▀░▀░▀░░░▀▀▀ -# ░█▄█░▀█▀░█▀▀░█▀▀ -# ░█░█░░█░░▀▀█░█░░ -# ░▀░▀░▀▀▀░▀▀▀░▀▀▀ - -# Cd to git folder -alias gt='cd ~/git' - -# Make ftp server -alias makeftp='python -m pyftpdlib --directory=$HOME/ --port=2121' - -# Get current Fcitx mode -alias get-fcitx-mode='qdbus "org.fcitx.Fcitx" "/inputmethod" "GetCurrentIM"' - -c-file() { - nvim $($HOME/.scripts/rofi/config-selector.py) -} - -alias openfile='~/.scripts/rofi/config-selector.py | xargs nvim' - -# alias tangle-doom-emacs='cd $HOME/.doom.d && $HOME/.emacs.d/bin/org-tangle config.org && cd -' - -alias xr='xmonad --recompile' - -# TODO: Update to paru -alias xmr='yay -S xmobar-git --answerclean A --answerdiff N' -alias xxmr='xr; xmr' - -alias killall-tmux='tmux ls | awk '{print $1}' | sed 's/://g' | xargs -I{} tmux kill-session -t {}' +alias gt='cd $HOME/git' +alias tmp='cd /tmp' alias cd..='cd ..' alias ..='cd ..' @@ -112,24 +106,81 @@ alias ....='cd ../../..' alias .....='cd ../../../..' alias ......='cd ../../../../..' +# ░█▄█░▀█▀░█▀▀░█▀▀ +# ░█░█░░█░░▀▀█░█░░ +# ░▀░▀░▀▀▀░▀▀▀░▀▀▀ + +alias sz='du -sh' + +alias realias='source $HOME/.aliases' + +alias openfile='$HOME/.scripts/rofi/config-selector.py | xargs nvim' + alias q='exit' +alias rmr='rmdir' + +alias pagga='toilet -f pagga' + # Supposed to be used as a pipe: "cat file | rainbow" alias rainbow='toilet -f pagga | lolcat' -if [[ -f ~/.scripts/dropbox.py ]]; then - alias dp="python ~/.scripts/dropbox.py" +# ░█▀█░█▀█░█▀▀░█░░░▀█▀░█▀█░█▀▀░█▀▄░█▀▀ +# ░█░█░█░█░█▀▀░█░░░░█░░█░█░█▀▀░█▀▄░▀▀█ +# ░▀▀▀░▀░▀░▀▀▀░▀▀▀░▀▀▀░▀░▀░▀▀▀░▀░▀░▀▀ + +alias killall-tmux='tmux ls | awk '{print $1}' | sed 's/://g' | xargs -I{} tmux kill-session -t {}' + +# Get current Fcitx mode +alias get-fcitx-mode='qdbus "org.fcitx.Fcitx" "/inputmethod" "GetCurrentIM"' + +alias wcd='find . -type f -exec cat {} + | wc -l' + +# Make ftp server +alias makeftp='python -m pyftpdlib --directory=$HOME/ --port=2121' + +alias echo-colors='for x in 0 1 4 5 7 8; do for i in {30..37}; do for a in {40..47}; do echo -ne "\e[$x;$i;$a""m\\\e[$x;$i;$a""m\e[0;37;40m "; done; echo; done; done; echo "";' + +# ░█▀▀░█░█░█▀█░█▀▀░▀█▀░▀█▀░█▀█░█▀█░█▀▀ +# ░█▀▀░█░█░█░█░█░░░░█░░░█░░█░█░█░█░▀▀█ +# ░▀░░░▀▀▀░▀░▀░▀▀▀░░▀░░▀▀▀░▀▀▀░▀░▀░▀▀▀ + +gac(){ + git add $1 && git commit -a -m $2 +} + +c-file() { + nvim $($HOME/.scripts/rofi/config-selector.py) +} + +if command -v netstat &> /dev/null; then + # Usage: $ conn-ips 80 + conn-ips() { + netstat -tn 2>/dev/null | grep :$1 | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -nr | head + } fi -if [[ -f ~/.aliases.private ]]; then - source ~/.aliases.private + +# ░█▀▀░█▀█░█░█░█▀▄░█▀▀░█▀▀░█▀▀ +# ░▀▀█░█░█░█░█░█▀▄░█░░░█▀▀░▀▀█ +# ░▀▀▀░▀▀▀░▀▀▀░▀░▀░▀▀▀░▀▀▀░▀▀▀ + +if [[ -f $HOME/.aliases.private ]]; then + source $HOME/.aliases.private fi -if [[ -f ~/.aliases.desktop ]]; then - source ~/.aliases.desktop +if [[ -f $HOME/.aliases.desktop ]]; then + source $HOME/.aliases.desktop fi -if [[ -f ~/.aliases.laptop ]]; then - source ~/.aliases.laptop +if [[ -f $HOME/.aliases.laptop ]]; then + source $HOME/.aliases.laptop +fi + +if [[ -d "$HOME/.project-template-aliases" ]]; then + for f in $(find $HOME/.project-template-aliases/ -maxdepth 1 -type f) + do + source $f + done fi diff --git a/general/.gitconfig b/general/.gitconfig index c747940..0d8db2f 100644 --- a/general/.gitconfig +++ b/general/.gitconfig @@ -1,4 +1,10 @@ [alias] -graph = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all -graphv = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an%C(reset)' --all -g = !"git graph" + + graph = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all + + graphv = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an%C(reset)' --all + + g = !"git graph" + + uncommit = reset --soft HEAD^ + diff --git a/general/.project-template-aliases/latex b/general/.project-template-aliases/latex new file mode 100644 index 0000000..54c4c69 --- /dev/null +++ b/general/.project-template-aliases/latex @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +project-latex () { + mkdir $1 + cd $1 + mkdir graphics + mkdir scripts + cp $HOME/.project-template-aliases/latex-resources/main.tex . + cp $HOME/.project-template-aliases/latex-resources/.latexmkrc . + cp $HOME/.project-template-aliases/latex-resources/bibliography.bib . +} diff --git a/general/.project-template-aliases/latex-resources/.latexmkrc b/general/.project-template-aliases/latex-resources/.latexmkrc new file mode 100644 index 0000000..e69de29 diff --git a/general/.project-template-aliases/latex-resources/bibliography.bib b/general/.project-template-aliases/latex-resources/bibliography.bib new file mode 100644 index 0000000..e69de29 diff --git a/general/.project-template-aliases/latex-resources/main.tex b/general/.project-template-aliases/latex-resources/main.tex new file mode 100644 index 0000000..e69de29 diff --git a/general/.project-template-aliases/python b/general/.project-template-aliases/python new file mode 100644 index 0000000..8c79a0f --- /dev/null +++ b/general/.project-template-aliases/python @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +project-venv() { + mkdir $1 + cd $1 + python -m venv venv + echo venv > .gitignore + source venv/bin/activate +} diff --git a/laptop/.aliases.laptop b/laptop/.aliases.laptop index b4f5a3d..98771f7 100644 --- a/laptop/.aliases.laptop +++ b/laptop/.aliases.laptop @@ -1,9 +1,13 @@ #!/usr/bin/env bash #TODO: Fix dynamic disable and enable (16 was a one time occurence) -alias disable-touch="xinput set-prop 16 'Device Enabled' 0" -alias enable-touch="xinput set-prop 16 'Device Enabled' 1" +# alias disable-touch="xinput set-prop 16 'Device Enabled' 0" +# alias enable-touch ="xinput set-prop 16 'Device Enabled' 1" -alias singleScreen="xrandr --output DP-3 --off" -alias doubleScreen="xrandr --output DP-3 --mode 1920x1080" -alias extendScreen="xrandr --output DP-3 --mode 1920x1080 --right-of eDP-1" +alias turnOffScreenHDMI="xrandr --output DP-3 --off" +alias doubleScreenHDMI="xrandr --output DP-3 --mode 1920x1080" +alias extendScreenHDMI="xrandr --output DP-3 --mode 1920x1080 --right-of eDP-1" + +alias turnOffScreenUSBC="xrandr --output DP-1 --off" +alias doubleScreenUSBC="xrandr --output DP-1 --mode 1920x1080" +alias extendScreenUSBC="xrandr --output DP-1 --mode 1920x1080 --right-of eDP-1"