Update css/js + few configs

This commit is contained in:
2021-01-01 20:12:34 +01:00
parent 2cfa706a42
commit 85e9caebe4
95 changed files with 15754 additions and 16561 deletions

136
bash.org
View File

@@ -1,36 +1,21 @@
#+TITLE: Bash Configuration
:DRAWER:
#+STARTUP: overview
#+SETUPFILE: ./setup/org-setup-file.org
#+LANGUAGE: en
#+EMAIL: dehaeze.thomas@gmail.com
#+AUTHOR: Dehaeze Thomas
#+HTML_LINK_HOME: ./index.html
#+HTML_LINK_UP: ./index.html
#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="./css/htmlize.css"/>
#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="./css/readtheorg.css"/>
#+HTML_HEAD: <script type="text/javascript" src="./js/jquery.min.js"></script>
#+HTML_HEAD: <script type="text/javascript" src="./js/bootstrap.min.js"></script>
#+HTML_HEAD: <script type="text/javascript" src="./js/jquery.stickytableheaders.min.js"></script>
#+HTML_HEAD: <script type="text/javascript" src="./js/readtheorg.js"></script>
:END:
* Bashrc
* =~/.bashrc=
:PROPERTIES:
:header-args:bash: :tangle ~/.bashrc
:header-args:bash+: :comments both :mkdirp yes
:CUSTOM_ID: bashrc
:END:
** What does that do?
** If not running interactively, don't do anything
#+BEGIN_SRC bash
[[ $- != *i* ]] && return
[[ $- != *i* ]] && return
#+END_SRC
** Bash Completion
#+BEGIN_SRC bash
[ -r /usr/share/bash-completion/bash_completion ] && . /usr/share/bash-completion/bash_completion
[ -r /usr/share/bash-completion/bash_completion ] && . /usr/share/bash-completion/bash_completion
#+END_SRC
** FZF
@@ -38,68 +23,32 @@
source /usr/share/fzf/key-bindings.bash
#+end_src
** Ignore case for autocompletion
** Ignore case for auto-completion
#+BEGIN_SRC bash
bind "set completion-ignore-case on"
bind "set show-all-if-ambiguous on"
bind "set completion-ignore-case on"
bind "set show-all-if-ambiguous on"
#+END_SRC
** Use Color
#+BEGIN_SRC bash
use_color=true
alias ls='ls -hN --color=auto --group-directories-first'
alias grep='grep --colour=auto'
#+END_SRC
** Set colorful PS1 only on colorful terminals.
dircolors --print-database uses its own built-in database instead of using /etc/DIR_COLORS. Try to use the external file first to take advantage of user additions. Use internal bash globbing instead of external grep binary.
#+BEGIN_SRC bash
safe_term=${TERM//[^[:alnum:]]/?} # sanitize TERM
match_lhs=""
[[ -f ~/.dir_colors ]] && match_lhs="${match_lhs}$(<~/.dir_colors)"
[[ -f /etc/DIR_COLORS ]] && match_lhs="${match_lhs}$(</etc/DIR_COLORS)"
[[ -z ${match_lhs} ]] \
&& type -P dircolors >/dev/null \
&& match_lhs=$(dircolors --print-database)
[[ $'\n'${match_lhs} == *$'\n'"TERM "${safe_term}* ]] && use_color=true
if ${use_color} ; then
# Enable colors for ls, etc. Prefer ~/.dir_colors #64489
if type -P dircolors >/dev/null ; then
if [[ -f ~/.dir_colors ]] ; then
eval $(dircolors -b ~/.dir_colors)
elif [[ -f /etc/DIR_COLORS ]] ; then
eval $(dircolors -b /etc/DIR_COLORS)
fi
fi
if [[ ${EUID} == 0 ]] ; then
PS1='\[\033[01;31m\][\h\[\033[01;36m\] \W\[\033[01;31m\]]\$\[\033[00m\] '
else
PS1='\[\033[01;32m\][\u@\h\[\033[01;37m\] \W\[\033[01;32m\]]\$\[\033[00m\] '
fi
else
if [[ ${EUID} == 0 ]] ; then
# show root@ when we don't have colors
PS1='\u@\h \W \$ '
else
PS1='\u@\h \w \$ '
fi
fi
#+END_SRC
** Some config
#+BEGIN_SRC bash
# Unset some variables
unset use_color safe_term match_lhs sh
# Allow local processes with root privileges to connect to the locally running X server
xhost +local:root > /dev/null 2>&1
# Autocomplete sudo commands
complete -cf sudo
# Line wrap on window resize
shopt -s checkwinsize
# Expand Aliases
shopt -s expand_aliases
# Auto "cd" when entering just a path
@@ -109,7 +58,7 @@ dircolors --print-database uses its own built-in database instead of using /etc/
shopt -s histappend
#+END_SRC
** Prompt
** Prompt - =PS1=
#+BEGIN_SRC bash
export PS1="\[$(tput bold)\]\[$(tput setaf 1)\][\[$(tput setaf 3)\]\u\[$(tput setaf 2)\]@\[$(tput setaf 4)\]\h \[$(tput setaf 5)\]\W\[$(tput setaf 1)\]]\[$(tput setaf 7)\]\\$ \[$(tput sgr0)\]"
#+END_SRC
@@ -123,6 +72,8 @@ dircolors --print-database uses its own built-in database instead of using /etc/
** Aliases
*** Better defaults for some commands
#+BEGIN_SRC bash
alias ls='ls -hN --color=auto --group-directories-first'
alias grep='grep --colour=auto'
alias cp="cp -i" # confirm before overwriting something
alias df='df -h' # human-readable sizes
alias free='free -m' # show sizes in MB
@@ -138,9 +89,7 @@ dircolors --print-database uses its own built-in database instead of using /etc/
alias sv='sudo -E nvim'
alias g="git"
alias m="neomutt"
alias y="yadm"
alias o="xdg-open"
alias x="sxiv -ft *"
#+END_SRC
*** Neovim
@@ -148,17 +97,6 @@ dircolors --print-database uses its own built-in database instead of using /etc/
command -v nvim >/dev/null && alias vim="nvim" vimdiff="nvim -d" # Use neovim for vim if present.
#+end_src
*** Magit
#+BEGIN_SRC bash
# alias magit="emacsclient -create-frame --alternate-editor=\"\" --eval '(magit-status)'"
alias magit="nvim -c MagitOnly"
#+END_SRC
*** Homelab Relative
#+begin_src bash
alias dlab="aria2p --port 6800 --host http://dl.tdehaeze.xyz --secret $(pass dl.tdehaeze.xyz/tdehaeze | sed -n 1p)"
#+end_src
*** Vim-like
#+BEGIN_SRC bash
alias :q=exit
@@ -171,7 +109,7 @@ dircolors --print-database uses its own built-in database instead of using /etc/
#+END_SRC
** Functions
*** Display colors
*** =colors= - Display colors
#+BEGIN_SRC bash
colors() {
local fgc bgc vals seq0
@@ -201,7 +139,7 @@ dircolors --print-database uses its own built-in database instead of using /etc/
}
#+END_SRC
*** Tree display
*** =tre= - Tree display
=tre= is a shorthand for =tree= with hidden files and color enabled, ignoring
the =.git= directory, listing directories first. The output gets piped into
=less= with options to preserve color and line numbers, unless the output is
@@ -213,14 +151,14 @@ small enough for one screen.
}
#+END_SRC
*** Create a new directory and enter it
*** =mkd= - Create a new directory and enter it
#+BEGIN_SRC bash
function mkd() {
mkdir -p "$@" && cd "$_";
}
#+END_SRC
*** Filesize of directory
*** =fs= - Filesize of directory
#+BEGIN_SRC bash
function fs() {
if du -b /dev/null > /dev/null 2>&1; then
@@ -236,16 +174,17 @@ small enough for one screen.
}
#+END_SRC
*** Redirect both standard output and standard error, as well as sending to background
*** =nullify= - Redirect both standard output and standard error, as well as sending to background
#+BEGIN_SRC bash
function nullify() {
"$@" >/dev/null 2>&1
}
#+END_SRC
*** Send SMS
*** =sms= - Send SMS
https://doronbehar.com/articles/using-kdeconnect-to-comfortably-send-sms-messages-from-the-shell/#kdeconnects-builtin-sms-interface
#+begin_src bash
#+begin_src bash :tangle no
sms(){
local args="$@"
# local phone_number name phone_type
@@ -255,14 +194,12 @@ https://doronbehar.com/articles/using-kdeconnect-to-comfortably-send-sms-message
echo No recipient was chosen >&2
return
else
# echo "${name}"$'\t'"${phone_number}"$'\t'"${phone_type}" > ${_KDECONNECT_SMS_LAST_RECIPIENT}
kdeconnect-cli --send-sms "${args}" --destination "${phone_number}" --device 4de3b5de2264a17c
# kdeconnect-cli --device ${_KDECONNECT_DEFAULT_DEVICE} --send-sms "${args}" --destination "${phone_number}" && \
# echo sent sms message to ${name} | fribidi
fi
}
#+end_src
** Bash History
Undocumented feature which sets the size to "unlimited". http://stackoverflow.com/questions/9457233/unlimited-bash-history
@@ -284,10 +221,11 @@ Force prompt to write history after every command. http://superuser.com/question
PROMPT_COMMAND="history -a; $PROMPT_COMMAND"
#+END_SRC
* Bash Profile
* =~/.bash_profile=
:PROPERTIES:
:header-args:bash: :tangle ~/.bash_profile
:header-args:bash+: :comments both :mkdirp yes
:CUSTOM_ID: bash_profile
:END:
#+BEGIN_SRC bash
@@ -295,10 +233,11 @@ Force prompt to write history after every command. http://superuser.com/question
[[ -f ~/.bashrc ]] && . ~/.bashrc
#+END_SRC
* Profile
* =~/.profile=
:PROPERTIES:
:header-args:bash: :tangle ~/.profile
:header-args:bash+: :comments both :mkdirp yes
:CUSTOM_ID: profile
:END:
** QT And GTK Themes
@@ -313,6 +252,7 @@ Force prompt to write history after every command. http://superuser.com/question
#+END_SRC
** Gnome Keyring Daemon
Enable the keyring for applications run through the terminal
#+begin_src bash
if [ -n "$DESKTOP_SESSION" ];then
eval $(gnome-keyring-daemon --start)
@@ -320,7 +260,7 @@ Force prompt to write history after every command. http://superuser.com/question
fi
#+end_src
** Default
** Export some default applications
#+begin_src bash
export EDITOR="nvim"
export TERMINAL="termite"
@@ -341,11 +281,6 @@ This is important for termite to work when sshing in remote machines.
export XDG_CONFIG_HOME="$HOME/.config"
#+end_src
*** Better yaourt colors
#+begin_src bash
export YAOURT_COLORS="nb=1:pkg=1:ver=1;32:lver=1;45:installed=1;42:grp=1;34:od=1;41;5:votes=1;44:dsc=0:other=1;35"
#+end_src
*** Use Ripgrep for FZF
#+begin_src bash
export FZF_DEFAULT_COMMAND='rg --files --no-ignore --hidden --follow --glob "!.git/*"'
@@ -367,12 +302,16 @@ This is important for termite to work when sshing in remote machines.
export BW_SESSION="HH0yycfocRSuGtq/iW1e6v13PQ1sShMXbMhdb/En94S6OcIXFnJlLEyU+dySsmf2YShY4CImoB5FrxgdPsY9Qw=="
#+end_src
*** Python Path
#+begin_src bash
export PYTHONPATH="${PYTHONPATH}:/usr/lib/python3.9/site-packages/configobj"
#+end_src
** Path
#+begin_src bash
PATH=$HOME/appimages:$PATH
PATH=$HOME/.gem/ruby/2.5.0/bin:$PATH
PATH=$GOPATH:$GOPATH/bin:$PATH
PATH=~/.local/bin:$PATH
PATH=~/.emacs.d/bin:$PATH
export PATH
#+END_SRC
@@ -384,10 +323,11 @@ This is important for termite to work when sshing in remote machines.
fi
#+end_src
* Input
* =~/.inputrc=
:PROPERTIES:
:header-args: :tangle ~/.inputrc
:header-args+: :comments both :mkdirp yes
:CUSTOM_ID: inputrc
:END:
Completion: