added .ownrc
This commit is contained in:
		
							
								
								
									
										248
									
								
								.ownrc
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										248
									
								
								.ownrc
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,248 @@
 | 
				
			|||||||
 | 
					#!/bin/bash
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# PS1 shell color
 | 
				
			||||||
 | 
					# based on: https://www.cyberciti.biz/faq/bash-shell-change-the-color-of-my-shell-prompt-under-linux-or-unix/
 | 
				
			||||||
 | 
					#export PS1="\e[1;33m[\u@\h \W]\$ \e[m"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# get current branch in git repo
 | 
				
			||||||
 | 
					function parse_git_branch() {
 | 
				
			||||||
 | 
						BRANCH=`git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'`
 | 
				
			||||||
 | 
						if [ ! "${BRANCH}" == "" ]
 | 
				
			||||||
 | 
						then
 | 
				
			||||||
 | 
							STAT=`parse_git_dirty`
 | 
				
			||||||
 | 
							echo "[${BRANCH}${STAT}]"
 | 
				
			||||||
 | 
						else
 | 
				
			||||||
 | 
							echo ""
 | 
				
			||||||
 | 
						fi
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# get current status of git repo
 | 
				
			||||||
 | 
					function parse_git_dirty { status=`git status 2>&1 | tee`
 | 
				
			||||||
 | 
						dirty=`echo -n "${status}" 2> /dev/null | grep "modified:" &> /dev/null; echo "$?"`
 | 
				
			||||||
 | 
						untracked=`echo -n "${status}" 2> /dev/null | grep "Untracked files" &> /dev/null; echo "$?"`
 | 
				
			||||||
 | 
						ahead=`echo -n "${status}" 2> /dev/null | grep "Your branch is ahead of" &> /dev/null; echo "$?"`
 | 
				
			||||||
 | 
						newfile=`echo -n "${status}" 2> /dev/null | grep "new file:" &> /dev/null; echo "$?"`
 | 
				
			||||||
 | 
						renamed=`echo -n "${status}" 2> /dev/null | grep "renamed:" &> /dev/null; echo "$?"`
 | 
				
			||||||
 | 
						deleted=`echo -n "${status}" 2> /dev/null | grep "deleted:" &> /dev/null; echo "$?"`
 | 
				
			||||||
 | 
						bits=''
 | 
				
			||||||
 | 
						if [ "${renamed}" == "0" ]; then
 | 
				
			||||||
 | 
							bits=">${bits}"
 | 
				
			||||||
 | 
						fi
 | 
				
			||||||
 | 
						if [ "${ahead}" == "0" ]; then
 | 
				
			||||||
 | 
							bits="*${bits}"
 | 
				
			||||||
 | 
						fi
 | 
				
			||||||
 | 
						if [ "${newfile}" == "0" ]; then
 | 
				
			||||||
 | 
							bits="+${bits}"
 | 
				
			||||||
 | 
						fi
 | 
				
			||||||
 | 
						if [ "${untracked}" == "0" ]; then
 | 
				
			||||||
 | 
							bits="?${bits}"
 | 
				
			||||||
 | 
						fi
 | 
				
			||||||
 | 
						if [ "${deleted}" == "0" ]; then
 | 
				
			||||||
 | 
							bits="x${bits}"
 | 
				
			||||||
 | 
						fi
 | 
				
			||||||
 | 
						if [ "${dirty}" == "0" ]; then
 | 
				
			||||||
 | 
							bits="!${bits}"
 | 
				
			||||||
 | 
						fi
 | 
				
			||||||
 | 
						if [ ! "${bits}" == "" ]; then
 | 
				
			||||||
 | 
							echo " ${bits}"
 | 
				
			||||||
 | 
						else
 | 
				
			||||||
 | 
							echo ""
 | 
				
			||||||
 | 
						fi
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export PS1="\[\e[36m\][\[\e[m\]\[\e[36m\]\u\[\e[m\]\[\e[36m\]@\[\e[m\]\[\e[36m\]\h\[\e[m\]\[\e[36m\] \[\e[m\]\[\e[36m\]\W\[\e[m\]\[\e[36m\]]\[\e[m\]\[\e[32;40m\]\`parse_git_branch\`\[\e[m\]\[\e[36m\]\\$\[\e[m\] "
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function convertm() {
 | 
				
			||||||
 | 
					  for f in *.jpg; do
 | 
				
			||||||
 | 
					    convert ./"$f" ./"${f%.}.pdf"
 | 
				
			||||||
 | 
					  done
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Create new directory and descend into it
 | 
				
			||||||
 | 
					function mkcd() { mkdir -p "$@" && cd "$@"; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Extract function
 | 
				
			||||||
 | 
					extract () {
 | 
				
			||||||
 | 
					    if [ -f $1 ] ; then
 | 
				
			||||||
 | 
					        case $1 in
 | 
				
			||||||
 | 
					         *.tar.bz2)      tar xvjf $1 ;;
 | 
				
			||||||
 | 
					         *.tar.gz)       tar xvzf $1 ;;
 | 
				
			||||||
 | 
					         *.tar.xz)       tar Jxvf $1 ;;
 | 
				
			||||||
 | 
					         *.bz2)          bunzip2 $1 ;;
 | 
				
			||||||
 | 
					         *.rar)          unrar-free x $1 ;;
 | 
				
			||||||
 | 
					         *.gz)           gunzip $1 ;;
 | 
				
			||||||
 | 
					         *.tar)          tar xvf $1 ;;
 | 
				
			||||||
 | 
					         *.tbz2)         tar xvjf $1 ;;
 | 
				
			||||||
 | 
					         *.tgz)          tar xvzf $1 ;;
 | 
				
			||||||
 | 
					         *.zip)          unzip $1 ;;
 | 
				
			||||||
 | 
					         *.Z)            uncompress $1 ;;
 | 
				
			||||||
 | 
					         *.7z)           7z x $1 ;;
 | 
				
			||||||
 | 
					         *)              echo "don't know how to extract '$1'..." ;;
 | 
				
			||||||
 | 
					        esac
 | 
				
			||||||
 | 
					    else
 | 
				
			||||||
 | 
					        echo "'$1' is not a valid file!"
 | 
				
			||||||
 | 
					    fi
 | 
				
			||||||
 | 
					 }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Kill all that use port
 | 
				
			||||||
 | 
					killport () {
 | 
				
			||||||
 | 
					  kill $(lsof -t -i:"$1")
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function sv-enable () {
 | 
				
			||||||
 | 
					  if test -e /etc/sv/$1; then
 | 
				
			||||||
 | 
					    doas ln -sv /etc/sv/$1 /var/service/
 | 
				
			||||||
 | 
					  else
 | 
				
			||||||
 | 
					    echo "Error: /etc/sv/$1 does not exist"
 | 
				
			||||||
 | 
					  fi
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function xkb-switch () {
 | 
				
			||||||
 | 
					LAYOUT=$(setxkbmap -query | grep layout | awk '{print $2}')
 | 
				
			||||||
 | 
					  if [[ $LAYOUT == "us" ]]; then
 | 
				
			||||||
 | 
						  setxkbmap cz qwerty
 | 
				
			||||||
 | 
					  else
 | 
				
			||||||
 | 
						  setxkbmap us
 | 
				
			||||||
 | 
					  fi
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function dorepeat() {
 | 
				
			||||||
 | 
						while true; do
 | 
				
			||||||
 | 
							"$@"
 | 
				
			||||||
 | 
							sleep 1
 | 
				
			||||||
 | 
							echo
 | 
				
			||||||
 | 
						done
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function genpasswd() {
 | 
				
			||||||
 | 
						local l=$1
 | 
				
			||||||
 | 
						[ -n "$l" ] || l=16
 | 
				
			||||||
 | 
						tr -dc A-Za-z0-9_ < /dev/urandom \
 | 
				
			||||||
 | 
							| head -c "$l" | xargs
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					# Run JetBrains IDEs from terminal in detached mode
 | 
				
			||||||
 | 
					phpstorm()  {
 | 
				
			||||||
 | 
					  ~/.local/bin/phpstorm "$1" > /dev/null 2>&1 &
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					webstorm() {
 | 
				
			||||||
 | 
					 ~/.local/bin/webstorm "$1" > /dev/null 2>&1 &
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					m3u8-download() {
 | 
				
			||||||
 | 
					  youtube-dl --list-formats "$1"
 | 
				
			||||||
 | 
					  echo "enter format code:"
 | 
				
			||||||
 | 
					  read format_code
 | 
				
			||||||
 | 
					  youtube-dl -f $format_code --hls-prefer-native "$1"
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#function subl() {
 | 
				
			||||||
 | 
					#  flatpak run com.sublimetext.three "$1" /dev/null 2>&1 &
 | 
				
			||||||
 | 
					#}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Intel Graphics Optimus screen tearing
 | 
				
			||||||
 | 
					#xrandr --output eDP-1-1 --set 'PRIME Synchronization' '1' 
 | 
				
			||||||
 | 
					# by: https://www.reddit.com/r/linux_gaming/comments/aoh5be/guide_hybrid_graphics_on_linux_nvidia_optimus/
 | 
				
			||||||
 | 
					# make /etc/init.d/startup.sh and put that command in
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# thefuck app alias
 | 
				
			||||||
 | 
					#eval "$(thefuck --alias)"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Aliases and Exports
 | 
				
			||||||
 | 
					## utility
 | 
				
			||||||
 | 
					alias cal="cal -m"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## shell
 | 
				
			||||||
 | 
					set -o vi # vim keybinding in terminal
 | 
				
			||||||
 | 
					EDITOR=vim # prefered editor
 | 
				
			||||||
 | 
					alias ls="ls --color=auto"
 | 
				
			||||||
 | 
					alias ll="ls -lFh"
 | 
				
			||||||
 | 
					alias la="ls -alh"
 | 
				
			||||||
 | 
					alias l="ls -CF"
 | 
				
			||||||
 | 
					alias ld="ls -d -F */"
 | 
				
			||||||
 | 
					alias lda="ls -l -d -p */"
 | 
				
			||||||
 | 
					stty -ixon # reverse i search bash 
 | 
				
			||||||
 | 
					alias xclip="xclip -selection c"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## network
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## shortcuts
 | 
				
			||||||
 | 
					alias lgfr="cd ~/git/filiprojek/"
 | 
				
			||||||
 | 
					alias lgfw="cd ~/git/fofrweb/"
 | 
				
			||||||
 | 
					alias lbc="cd ~/git/fr/pedf/bc"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## programs
 | 
				
			||||||
 | 
					alias r="ranger"
 | 
				
			||||||
 | 
					alias feh="feh --scale-down"
 | 
				
			||||||
 | 
					alias dragon="dragon-drop"
 | 
				
			||||||
 | 
					alias passmenu="passmenu -l 10"
 | 
				
			||||||
 | 
					alias speedtest="speedtest-cli"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## random
 | 
				
			||||||
 | 
					#alias vim="nvim"
 | 
				
			||||||
 | 
					function touchpaddisable () {
 | 
				
			||||||
 | 
					xinput set-prop $1 'Device Enabled' 0
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					function touchpadenable () {
 | 
				
			||||||
 | 
					xinput set-prop $1 'Device Enabled' 1
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					alias todo="vim ~/_todo.md"
 | 
				
			||||||
 | 
					alias schm="~/.screenlayout/home.sh"
 | 
				
			||||||
 | 
					alias sclp="~/.screenlayout/laptop.sh"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## downloaders
 | 
				
			||||||
 | 
					alias ytdl-mp3="yt-dlp-f bestaudio --extract-audio --audio-format mp3 --audio-quality 0"
 | 
				
			||||||
 | 
					alias ytmp3="yt-dlp -x --audio-quality 0 --audio-format mp3"
 | 
				
			||||||
 | 
					alias ytmp4-best="yt-dlp -f best"
 | 
				
			||||||
 | 
					alias uloztodl="ulozto-downloader --auto-captcha --parts 40"
 | 
				
			||||||
 | 
					alias wgetall="wget -r --no-parent"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## short scripts
 | 
				
			||||||
 | 
					alias wttr="curl -s wttr.in/Prague?q0M"
 | 
				
			||||||
 | 
					alias wttrfull="curl -s wttr.in/Prague?qM"
 | 
				
			||||||
 | 
					alias whatsmyip="dig +short myip.opendns.com @resolver1.opendns.com"
 | 
				
			||||||
 | 
					#alias logout="gnome-session-quit"
 | 
				
			||||||
 | 
					alias batstat="(upower -i `upower -e | grep BAT0` && upower -i `upower -e | grep BAT1`) | grep -e percentage -e 'time to empty' -e state"
 | 
				
			||||||
 | 
					#alias volstat="amixer sget Master"
 | 
				
			||||||
 | 
					alias htmlvlna="vlna -s -r -x 266E6273703B"
 | 
				
			||||||
 | 
					alias sudo="doas"
 | 
				
			||||||
 | 
					alias fuck='doas $(history -p \!\!)'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## void xbps aliases
 | 
				
			||||||
 | 
					alias xi="doas xbps-install"
 | 
				
			||||||
 | 
					alias xq="doas xbps-query -Rs"
 | 
				
			||||||
 | 
					alias xr="doas xbps-remove"
 | 
				
			||||||
 | 
					alias xrd="doas xbps-remove -R" # remove all dependencies
 | 
				
			||||||
 | 
					alias xu="doas xbps-install -Suv" # update
 | 
				
			||||||
 | 
					alias xreinstall="doas xbps-install -f"
 | 
				
			||||||
 | 
					alias xlu="xbps-install -Suvn" # list packages requiring updates
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					alias untar="tar -xvf"
 | 
				
			||||||
 | 
					alias norklhbin="node /home/filiprojek/git/filiprojek/nork/dist/app.js"
 | 
				
			||||||
 | 
					alias norklh="ts-node /home/filiprojek/git/filiprojek/nork/src/app.ts"
 | 
				
			||||||
 | 
					alias docsgnlh="nodemon /home/filiprojek/git/filiprojek/docsgn/src/app.ts"
 | 
				
			||||||
 | 
					alias "cd.."="cd .."
 | 
				
			||||||
 | 
					#alias docker-compose="docker compose"
 | 
				
			||||||
 | 
					export PATH="$PATH:/home/filiprojek/.cargo/bin"
 | 
				
			||||||
 | 
					export PATH="$PATH:/home/filiprojek/.local/bin"
 | 
				
			||||||
 | 
					export PATH="$PATH:/home/filiprojek/git/filiprojek/linux-stuff/scripts"
 | 
				
			||||||
 | 
					export PATH="$PATH:/var/lib/flatpak/exports/bin"
 | 
				
			||||||
 | 
					export PATH="$PATH:~/.local/share/flatpak/exports/bin"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# GnuPG TUI
 | 
				
			||||||
 | 
					#export GPG_TTY=$(tty)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# autologin on tty1
 | 
				
			||||||
 | 
					 if [ -z "$DISPLAY" ] && [ "$(fgconsole)" -eq 1 ]; then
 | 
				
			||||||
 | 
					 	exec startx
 | 
				
			||||||
 | 
					 fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 export $(dbus-launch)
 | 
				
			||||||
		Reference in New Issue
	
	Block a user