mirror of
https://github.com/edu4rdshl/linuxscripts.git
synced 2026-07-18 07:34:45 +00:00
Update
This commit is contained in:
parent
6051a13eb0
commit
c25dfdffe2
3 changed files with 103 additions and 99 deletions
|
|
@ -6,7 +6,7 @@
|
||||||
# Autor: Eduard Toloza
|
# Autor: Eduard Toloza
|
||||||
|
|
||||||
# Define variables
|
# Define variables
|
||||||
services='systemd-networkd systemd-resolved randomvpn' # iwd
|
services='systemd-networkd systemd-resolved randomvpn' #enable-processor-performance iwd
|
||||||
bond_active=$(ip -o link show type bond | awk -F': ' '{print $2}')
|
bond_active=$(ip -o link show type bond | awk -F': ' '{print $2}')
|
||||||
|
|
||||||
restart_network() {
|
restart_network() {
|
||||||
|
|
@ -15,7 +15,7 @@ restart_network() {
|
||||||
if command -v ping > /dev/null; then
|
if command -v ping > /dev/null; then
|
||||||
# Check internet connection and if not OK then restart all networking services
|
# Check internet connection and if not OK then restart all networking services
|
||||||
echo "Testing your connection..."
|
echo "Testing your connection..."
|
||||||
if ! ping -q -c 1 -W 1 9.9.9.9 > /dev/null; then
|
if ! ping -q -c 1 -W 1 9.9.9.9 > /dev/null || ! systemctl is-active openvpn-client@*.service > /dev/null; then
|
||||||
# Delete bond interfaces if they exists
|
# Delete bond interfaces if they exists
|
||||||
if [ ! -z "$bond_active" ] ; then
|
if [ ! -z "$bond_active" ] ; then
|
||||||
for bond_iface in "$bond_active"; do
|
for bond_iface in "$bond_active"; do
|
||||||
|
|
|
||||||
94
user-config/bash_aliases
Normal file
94
user-config/bash_aliases
Normal file
|
|
@ -0,0 +1,94 @@
|
||||||
|
### OWN ALIAS ###
|
||||||
|
|
||||||
|
#Pastes
|
||||||
|
alias rs="curl --data-binary @- https://paste.rs"
|
||||||
|
|
||||||
|
#Temperature
|
||||||
|
alias clima='curl wttr.in/bogota?lang=es'
|
||||||
|
|
||||||
|
# Youtube to MP3 and webistes videos to MP4
|
||||||
|
alias ytmp3="youtube-dl --output '~/Music/Downloaded/%(title)s.%(ext)s' --extract-audio --audio-format mp3"
|
||||||
|
alias vidtomp4="youtube-dl --output '~/Videos/Downloaded/%(title)s.%(ext)s' -f 'mp4'"
|
||||||
|
|
||||||
|
# Check permisions
|
||||||
|
alias pcheck='stat -c "%A %a %n"'
|
||||||
|
|
||||||
|
#Journalctl logs
|
||||||
|
alias jlogs='journalctl -b -p 4..1'
|
||||||
|
|
||||||
|
# Version for Git packages
|
||||||
|
alias gitver='echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)'
|
||||||
|
|
||||||
|
# Version for Git packages with tags
|
||||||
|
alias gitag="git describe --long | sed 's/\([^-]*-g\)/r\1/;s/-/./g'"
|
||||||
|
|
||||||
|
# Alias to get sha512sums
|
||||||
|
alias ssums='sha512sum'
|
||||||
|
|
||||||
|
# Print SRCINFO in AUR packages
|
||||||
|
alias srcinfo='makepkg --printsrcinfo > .SRCINFO'
|
||||||
|
|
||||||
|
# See the amount of memory and CPU used by applications
|
||||||
|
alias cmcheck='ps -eo pid,ppid,cmd,%mem,%cpu --sort=-%mem|head'
|
||||||
|
|
||||||
|
# Alias for git pull --rebase to prevent merging branchs
|
||||||
|
alias gpr='git pull --rebase'
|
||||||
|
|
||||||
|
# Alias for git clone
|
||||||
|
alias gclone='git clone'
|
||||||
|
|
||||||
|
# Alias for git push
|
||||||
|
alias gpush='git push'
|
||||||
|
|
||||||
|
# Alias for git pull
|
||||||
|
alias gpull='git pull'
|
||||||
|
|
||||||
|
# Alias for git commit -m
|
||||||
|
alias gcommit='git commit -m'
|
||||||
|
|
||||||
|
# Alias to kill Signal Private Messenger when crashed
|
||||||
|
alias ksignal='killall -9 signal-desktop'
|
||||||
|
|
||||||
|
# Alias to get information about CPU - please use i7z
|
||||||
|
# alias cpufreq='watch -n 0.01 grep \"cpu MHz\" /proc/cpuinfo'
|
||||||
|
# alias cputemp='watch -n 0.01 sensors'
|
||||||
|
|
||||||
|
# Alias to check what is my actual system IP using curl
|
||||||
|
alias wtfip='dig +short myip.opendns.com @resolver1.opendns.com'
|
||||||
|
|
||||||
|
# Alias to connect to ssh machines
|
||||||
|
alias assh='ssh vagrant@192.168.122.228'
|
||||||
|
alias bassh='ssh edu4rdshl@192.168.122.230'
|
||||||
|
alias dvwa='ssh dvwa@192.168.122.14'
|
||||||
|
|
||||||
|
# Alias to start VirtualBox Machines in Headless mode
|
||||||
|
# alias vbstart='VBoxHeadless -s'
|
||||||
|
|
||||||
|
# Alias for ip
|
||||||
|
alias ip='ip --color'
|
||||||
|
|
||||||
|
# Find the largest top 20 files and dirs in actual linux dir
|
||||||
|
alias longdirs='du -a ./ | sort -n -r | head -n 20'
|
||||||
|
alias longfiles="find ./ -printf '%s %p\n'| sort -nr | head -20"
|
||||||
|
|
||||||
|
# Alias for pacman
|
||||||
|
alias uparch='sudo pacman -Syu --noconfirm'
|
||||||
|
alias pss='pacman -Ss'
|
||||||
|
|
||||||
|
# Alias for pkgfile
|
||||||
|
alias pkgfile='pkgfile -v'
|
||||||
|
|
||||||
|
# Alias for power management
|
||||||
|
alias hibernate='systemctl hibernate'
|
||||||
|
alias shutdown='shutdown -n now'
|
||||||
|
|
||||||
|
# Alias for going to a temporal dir
|
||||||
|
alias cdtemp='cd $(mktemp -d)'
|
||||||
|
|
||||||
|
# Alias to show ip addresses in short and color
|
||||||
|
alias ipa='ip -c -br a'
|
||||||
|
|
||||||
|
# Avoid pip installing packages as root/sudo, execute the following line in your terminal or just delete the # at the begin
|
||||||
|
#install -Dm644 /dev/stdin ~/.config/pip/pip.conf <<< $'[install]\nuser = yes\n'
|
||||||
|
|
||||||
|
### END OWN ALIAS ###
|
||||||
|
|
@ -52,7 +52,7 @@ if [ -n "$force_color_prompt" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$color_prompt" = yes ]; then
|
if [ "$color_prompt" = yes ]; then
|
||||||
PS1='\[\e[1;31m\]\u@\h \w> \[\e[m\]'
|
PS1='\[\033[0;32m\]\u\[\033[0;36m\] @ \h \w\[\033[0;32m\]$(__git_ps1)\n└─ ▶\[\033[0m\] '
|
||||||
else
|
else
|
||||||
PS1='\u@\h:\w\$ '
|
PS1='\u@\h:\w\$ '
|
||||||
fi
|
fi
|
||||||
|
|
@ -107,101 +107,6 @@ if ! shopt -oq posix; then
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
### OWN ALIAS ###
|
|
||||||
|
|
||||||
#Pastes
|
|
||||||
alias rs="curl --data-binary @- https://paste.rs"
|
|
||||||
|
|
||||||
#Temperature
|
|
||||||
alias clima='curl wttr.in/bogota?lang=es'
|
|
||||||
|
|
||||||
# Youtube to MP3 and webistes videos to MP4
|
|
||||||
alias ytmp3="youtube-dl --output '~/Music/Downloaded/%(title)s.%(ext)s' --extract-audio --audio-format mp3"
|
|
||||||
alias vidtomp4="youtube-dl --output '~/Videos/Downloaded/%(title)s.%(ext)s' -f 'mp4'"
|
|
||||||
|
|
||||||
# Check permisions
|
|
||||||
alias pcheck='stat -c "%A %a %n"'
|
|
||||||
|
|
||||||
#Journalctl logs
|
|
||||||
alias jlogs='journalctl -b -p 4..1'
|
|
||||||
|
|
||||||
# Version for Git packages
|
|
||||||
alias gitver='echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)'
|
|
||||||
|
|
||||||
# Version for Git packages with tags
|
|
||||||
alias gitag="git describe --long | sed 's/\([^-]*-g\)/r\1/;s/-/./g'"
|
|
||||||
|
|
||||||
# Alias to get sha512sums
|
|
||||||
alias ssums='sha512sum'
|
|
||||||
|
|
||||||
# Print SRCINFO in AUR packages
|
|
||||||
alias srcinfo='makepkg --printsrcinfo > .SRCINFO'
|
|
||||||
|
|
||||||
# See the amount of memory and CPU used by applications
|
|
||||||
alias cmcheck='ps -eo pid,ppid,cmd,%mem,%cpu --sort=-%mem|head'
|
|
||||||
|
|
||||||
# Alias for git pull --rebase to prevent merging branchs
|
|
||||||
alias gpr='git pull --rebase'
|
|
||||||
|
|
||||||
# Alias for git clone
|
|
||||||
alias gclone='git clone'
|
|
||||||
|
|
||||||
# Alias for git push
|
|
||||||
alias gpush='git push'
|
|
||||||
|
|
||||||
# Alias for git pull
|
|
||||||
alias gpull='git pull'
|
|
||||||
|
|
||||||
# Alias for git commit -m
|
|
||||||
alias gcommit='git commit -m'
|
|
||||||
|
|
||||||
# Alias to kill Signal Private Messenger when crashed
|
|
||||||
alias ksignal='killall -9 signal-desktop'
|
|
||||||
|
|
||||||
# Alias to get information about CPU - please use i7z
|
|
||||||
# alias cpufreq='watch -n 0.01 grep \"cpu MHz\" /proc/cpuinfo'
|
|
||||||
# alias cputemp='watch -n 0.01 sensors'
|
|
||||||
|
|
||||||
# Alias to check what is my actual system IP using curl
|
|
||||||
alias wtfip='dig +short myip.opendns.com @resolver1.opendns.com'
|
|
||||||
|
|
||||||
# Alias to connect to ssh machines
|
|
||||||
alias assh='ssh vagrant@192.168.122.228'
|
|
||||||
alias bassh='ssh edu4rdshl@192.168.122.230'
|
|
||||||
alias dvwa='ssh dvwa@192.168.122.14'
|
|
||||||
|
|
||||||
# Alias to start VirtualBox Machines in Headless mode
|
|
||||||
# alias vbstart='VBoxHeadless -s'
|
|
||||||
|
|
||||||
# Alias for ip
|
|
||||||
alias ip='ip --color'
|
|
||||||
|
|
||||||
# Find the largest top 20 files and dirs in actual linux dir
|
|
||||||
alias longdirs='du -a ./ | sort -n -r | head -n 20'
|
|
||||||
alias longfiles="find ./ -printf '%s %p\n'| sort -nr | head -20"
|
|
||||||
|
|
||||||
# Alias for pacman
|
|
||||||
alias uparch='sudo pacman -Syu --noconfirm'
|
|
||||||
alias pss='pacman -Ss'
|
|
||||||
|
|
||||||
# Alias for pkgfile
|
|
||||||
alias pkgfile='pkgfile -v'
|
|
||||||
|
|
||||||
# Alias for power management
|
|
||||||
alias hibernate='systemctl hibernate'
|
|
||||||
alias shutdown='shutdown -n now'
|
|
||||||
|
|
||||||
# Alias for going to a temporal dir
|
|
||||||
alias cdtemp='cd $(mktemp -d)'
|
|
||||||
|
|
||||||
# Alias to show ip addresses in short and color
|
|
||||||
alias ipa='ip -c -br a'
|
|
||||||
|
|
||||||
# Avoid pip installing packages as root/sudo, execute the following line in your terminal or just delete the # at the begin
|
|
||||||
#install -Dm644 /dev/stdin ~/.config/pip/pip.conf <<< $'[install]\nuser = yes\n'
|
|
||||||
|
|
||||||
### END OWN ALIAS ###
|
|
||||||
|
|
||||||
### SOME LOCAL VARIABLES ###
|
### SOME LOCAL VARIABLES ###
|
||||||
|
|
||||||
# Editor
|
# Editor
|
||||||
|
|
@ -211,10 +116,15 @@ export EDITOR="nvim"
|
||||||
export VISUAL="nvim"
|
export VISUAL="nvim"
|
||||||
|
|
||||||
# Fix DIR
|
# Fix DIR
|
||||||
PATH="$(ruby -e 'print Gem.user_dir')/bin:$HOME/.local/bin:$HOME/.local/share/osxcross/target/bin:$PATH"
|
PATH="$(ruby -e 'print Gem.user_dir')/bin:$HOME/.local/bin:$HOME/.local/share/osxcross/target/bin:$HOME/.cargo/bin:$PATH"
|
||||||
|
|
||||||
### END OF SOME LOCAL VARIABBLES ###
|
### END OF SOME LOCAL VARIABBLES ###
|
||||||
|
|
||||||
|
### Source scripts ###
|
||||||
|
if [ -f ~/.local/bin/git-prompt.sh ]; then
|
||||||
|
source ~/.local/bin/git-prompt.sh
|
||||||
|
fi
|
||||||
|
|
||||||
# Autostart X at login
|
# Autostart X at login
|
||||||
if [[ ! $DISPLAY && $XDG_VTNR -eq 1 ]]; then
|
if [[ ! $DISPLAY && $XDG_VTNR -eq 1 ]]; then
|
||||||
exec sx
|
exec sx
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue