Last active
June 15, 2024 09:04
-
-
Save moqmar/28dde796bb924dd6bfb1eafbe0d265e8 to your computer and use it in GitHub Desktop.
Revisions
-
moqmar revised this gist
Mar 25, 2021 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -77,9 +77,6 @@ shopt -s checkwinsize # match all files and zero or more directories and subdirectories. shopt -s globstar #################################################################### ## Type :W in vim (or :WQ respectively) to save a file using sudo ## #################################################################### @@ -147,6 +144,9 @@ alias yq="python3 -c 'import sys, yaml, json; json.dump(yaml.load(sys.stdin), sy # A really simple password generator alias pw='bash -c '"'"'echo `tr -dc $([ $# -gt 1 ] && echo $2 || echo "A-Za-z0-9") < /dev/urandom | head -c $([ $# -gt 0 ] && echo $1 || echo 30)`'"'"' --' # View pressure stall information alias pressure="grep -n '[^ ]*=' /proc/pressure/*" ########################### ## Ubuntu-specific stuff ## ########################### -
moqmar revised this gist
Jan 13, 2021 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -173,7 +173,7 @@ fi ################## # I have a few environment variables (paths for Go & node.js) set in environment.d - I'd like to also use them in the terminal. if [ "$(ls ~/.config/environment.d/ 2>/dev/null)" != "" ]; then for f in ~/.config/environment.d/*; do source "$f" done -
moqmar revised this gist
Jan 13, 2021 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -6,7 +6,7 @@ # https://choosealicense.com/licenses/unlicense/ # # # # Simple installation: # # wget https://go.momar.de/bashrc -O ~/.bashrc # ################################################################################################### # If not running interactively, don't do anything -
moqmar revised this gist
Jan 13, 2021 . 1 changed file with 12 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -77,6 +77,9 @@ shopt -s checkwinsize # match all files and zero or more directories and subdirectories. shopt -s globstar # Write & read history after every command (reduces problems with multiple terminal sessions) PROMPT_COMMAND="history -a; history -n" #################################################################### ## Type :W in vim (or :WQ respectively) to save a file using sudo ## #################################################################### @@ -163,16 +166,22 @@ if ! shopt -oq posix; then fi # Ubuntu already had an "fd" package, so the one I'd like to use is called "fdfind". ! which fdfind >/dev/null || alias fd=fdfind ################## ## Custom stuff ## ################## # I have a few environment variables (paths for Go & node.js) set in environment.d - I'd like to also use them in the terminal. if [ "$(ls ~/.config/environment.d)" != "" ]; then for f in ~/.config/environment.d/*; do source "$f" done fi # I'm using Tilix, which requires sourcing this script if [ $TILIX_ID ] || [ $VTE_VERSION ]; then if [ -e /etc/profile.d/vte.sh ]; then source /etc/profile.d/vte.sh fi fi -
moqmar revised this gist
May 15, 2020 . 1 changed file with 5 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -171,3 +171,8 @@ alias fd=fdfind # I have a few environment variables (paths for Go & node.js) set in environment.d - I'd like to also use them in the terminal. for f in ~/.config/environment.d/*; do source "$f"; done # I'm using Tilix, which requires sourcing this script if [ $TILIX_ID ] || [ $VTE_VERSION ]; then source /etc/profile.d/vte.sh fi -
moqmar revised this gist
May 7, 2020 . 1 changed file with 63 additions and 9 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -9,6 +9,12 @@ # wget https://go.momar.io/bashrc -O ~/.bashrc # ################################################################################################### # If not running interactively, don't do anything case $- in *i*) ;; *) return;; esac ########### ## Color ## ########### @@ -25,14 +31,14 @@ export PS1='\[\e[1;38;5;244m\]\t \[\e[1;36m\]\u@\H \[\e[1;33m\]\w \[\e[1;36m\]\$ # Minimal without path to working directory (~ $) # export PS1='\[\e[1;33m\]\W \[\e[1;36m\]\$ \[\e[0m\]' ################################## ## ls, exa & more colored stuff ## ################################## if which exa >/dev/null; then # exa is a modern ls replacement with Git integration: https://the.exa.website alias ls="exa --git-ignore" alias ll="exa --git-ignore --git -l --group" alias la="exa --git -la" else alias ls="ls --color=always" @@ -41,13 +47,36 @@ else fi for alias in lsl sls lsls sl l s; do alias $alias=ls; done # colored GCC warnings and errors export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01' ######################################## ## Cool bash features nobody knows of ## ######################################## # search through history with up/down arrows bind '"\e[A": history-search-backward' 2>/dev/null bind '"\e[B": history-search-forward' 2>/dev/null # 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 #################################################################### ## Type :W in vim (or :WQ respectively) to save a file using sudo ## #################################################################### @@ -115,5 +144,30 @@ alias yq="python3 -c 'import sys, yaml, json; json.dump(yaml.load(sys.stdin), sy # A really simple password generator alias pw='bash -c '"'"'echo `tr -dc $([ $# -gt 1 ] && echo $2 || echo "A-Za-z0-9") < /dev/urandom | head -c $([ $# -gt 0 ] && echo $1 || echo 30)`'"'"' --' ########################### ## Ubuntu-specific stuff ## ########################### # make less more friendly for non-text input files, see lesspipe(1) [ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)" # 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 # Ubuntu already had an "fd" package, so the one I'd like to use is called "fdfind". alias fd=fdfind ################## ## Custom stuff ## ################## # I have a few environment variables (paths for Go & node.js) set in environment.d - I'd like to also use them in the terminal. for f in ~/.config/environment.d/*; do source "$f"; done -
Moritz Marquardt revised this gist
Nov 16, 2019 . 1 changed file with 20 additions and 20 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -25,25 +25,6 @@ export PS1='\[\e[1;38;5;244m\]\t \[\e[1;36m\]\u@\H \[\e[1;33m\]\w \[\e[1;36m\]\$ # Minimal without path to working directory (~ $) # export PS1='\[\e[1;33m\]\W \[\e[1;36m\]\$ \[\e[0m\]' ############## ## ls & exa ## ############## @@ -71,7 +52,7 @@ bind '"\e[B": history-search-forward' 2>/dev/null ## Type :W in vim (or :WQ respectively) to save a file using sudo ## #################################################################### if which vim >/dev/null && ! grep '^command W ' ~/.vimrc >/dev/null 2>&1 && ! [ `id -u` -eq 0 ]; then echo "command W :execute ':silent w !sudo tee % > /dev/null' | :if v:shell_error | :edit! | :endif" >> ~/.vimrc fi @@ -89,6 +70,25 @@ if [ `id -u` -eq 0 ]; then printf "\n" fi ######################### ## Path & Applications ## ######################### # Setup GOPATH export GOPATH="$HOME/.local/lib/go" export PATH="$GOPATH/bin:$PATH" # Setup npm global installs without sudo export NPMPATH="$HOME/.local/lib/npm" export PATH="$NPMPATH/bin:$PATH" [ -f ~/.npmrc ] || ! which npm >/dev/null || echo "prefix=$NPMPATH" > ~/.npmrc # Setup git author [ -f ~/.gitconfig ] || ! which git >/dev/null || git config --global --edit # Add ~/.local/bin to $PATH export PATH="$HOME/.local/bin:$PATH" ############################# ## Awesome online services ## ############################# -
Moritz Marquardt revised this gist
Nov 16, 2019 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -39,7 +39,7 @@ export PATH="$NPMPATH/bin:$PATH" [ -f ~/.npmrc ] || ! which npm >/dev/null || echo "prefix=$NPMPATH" > ~/.npmrc # Setup git author [ -f ~/.gitconfig ] || ! which git >/dev/null || git config --global --edit # Add ~/.local/bin to $PATH export PATH="$HOME/.local/bin:$PATH" -
Moritz Marquardt revised this gist
Nov 16, 2019 . 1 changed file with 2 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -71,9 +71,8 @@ bind '"\e[B": history-search-forward' 2>/dev/null ## Type :W in vim (or :WQ respectively) to save a file using sudo ## #################################################################### if which vim >/dev/null && ! grep '^command W ' ~/.vimrc >/dev/null 2>&1; then echo "command W :execute ':silent w !sudo tee % > /dev/null' | :if v:shell_error | :edit! | :endif" >> ~/.vimrc fi ############################# -
Moritz Marquardt revised this gist
Nov 16, 2019 . 1 changed file with 19 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -25,6 +25,25 @@ export PS1='\[\e[1;38;5;244m\]\t \[\e[1;36m\]\u@\H \[\e[1;33m\]\w \[\e[1;36m\]\$ # Minimal without path to working directory (~ $) # export PS1='\[\e[1;33m\]\W \[\e[1;36m\]\$ \[\e[0m\]' ######################### ## Path & Applications ## ######################### # Setup GOPATH export GOPATH="$HOME/.local/lib/go" export PATH="$GOPATH/bin:$PATH" # Setup npm global installs without sudo export NPMPATH="$HOME/.local/lib/npm" export PATH="$NPMPATH/bin:$PATH" [ -f ~/.npmrc ] || ! which npm >/dev/null || echo "prefix=$NPMPATH" > ~/.npmrc # Setup git author [ -f ~/.gitconfig] || ! which git >/dev/null || git config --global --edit # Add ~/.local/bin to $PATH export PATH="$HOME/.local/bin:$PATH" ############## ## ls & exa ## ############## -
Moritz Marquardt revised this gist
Nov 16, 2019 . 1 changed file with 8 additions and 8 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -61,14 +61,14 @@ fi ## Warn about root shells! ## ############################# if [ `id -u` -eq 0 ]; then start="\033[1;37;41m" end="\033[0m" printf "\n" printf " $start $end\n" printf " $start WARNING: You are in a root shell. This is probably a very bad idea. $end\n" printf " $start $end\n" printf "\n" fi ############################# -
Moritz Marquardt revised this gist
Nov 16, 2019 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -14,10 +14,10 @@ ########### # Normal Bash export PS1='\[\e[1;38;5;244m\]\t \[\e[1;36m\]\u@\H \[\e[1;33m\]\w \[\e[1;36m\]\$ \[\e[0m\]' # Alpine Linux / ash # export PS1='\[\e[1;38;5;244m\]$(date +%H:%M:%S) \[\e[1;36m\]\u@\H \[\e[1;33m\]\w \[\e[1;36m\]\$ \[\e[0m\]' # Termux (without user@host) # export PS1='\[\e[1;38;5;244m\]\t \[\e[1;33m\]\w \[\e[1;36m\]\$ \[\e[0m\]' -
Moritz Marquardt revised this gist
Nov 16, 2019 . 1 changed file with 33 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -12,7 +12,18 @@ ########### ## Color ## ########### # Normal Bash export PS1='\[\e[1;38;5;244m\]\t \[\e[1;36m\]\u@\h \[\e[1;33m\]\w \[\e[1;36m\]\$ \[\e[0m\]' # Alpine Linux / ash # export PS1='\[\e[1;38;5;244m\]$(date +%H:%M:%S) \[\e[1;36m\]\u@\h \[\e[1;33m\]\w \[\e[1;36m\]\$ \[\e[0m\]' # Termux (without user@host) # export PS1='\[\e[1;38;5;244m\]\t \[\e[1;33m\]\w \[\e[1;36m\]\$ \[\e[0m\]' # Minimal without path to working directory (~ $) # export PS1='\[\e[1;33m\]\W \[\e[1;36m\]\$ \[\e[0m\]' ############## ## ls & exa ## @@ -33,14 +44,32 @@ for alias in lsl sls lsls sl l s; do alias $alias=ls; done ####################################### ## Search history with arrow up/down ## ####################################### bind '"\e[A": history-search-backward' 2>/dev/null bind '"\e[B": history-search-forward' 2>/dev/null #################################################################### ## Type :W in vim (or :WQ respectively) to save a file using sudo ## #################################################################### if which vim >/dev/null; then mkdir -p ~/.vim echo "command W :execute ':silent w !sudo tee % > /dev/null' | :if v:shell_error | :edit! | :endif" > ~/.vim/sudo.vim fi ############################# ## Warn about root shells! ## ############################# if [ $(id -u) -eq 0 ]; then start=$(tput setab 1; tput setaf 7; tput bold) end=$(tput setab 9; tput setaf 9; tput sgr0) echo echo " $start $end" echo " $start WARNING: You are in a root shell. This is probably a very bad idea. $end" echo " $start $end" echo fi ############################# ## Awesome online services ## -
Moritz Marquardt revised this gist
Nov 15, 2019 . 1 changed file with 3 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,9 @@ ################################################################################################### # This is a very simple .bashrc file that I'm using on a daily basis. # # It completely replaced my zsh setup, and should be relatively simple to understand and modify. # # # # Built by Moritz (mo-mar.de) - just do whatever you want with it, according to the Unlicense: # # https://choosealicense.com/licenses/unlicense/ # # # # Simple installation: # # wget https://go.momar.io/bashrc -O ~/.bashrc # -
Moritz Marquardt revised this gist
Nov 15, 2019 . 1 changed file with 22 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,12 @@ ################################################################################################### # This is a very simple .bashrc file that I'm using on a daily basis. # # It completely replaced my zsh setup, and should be relatively simple to understand and modify. # # Built by Moritz (mo-mar.de). Feel free to do whatever you want with it, according to the WTFPL: # # # # Simple installation: # # wget https://go.momar.io/bashrc -O ~/.bashrc # ################################################################################################### ########### ## Color ## ########### @@ -8,7 +17,7 @@ export PS1='\[\e[1;38;5;244m\]\t \[\e[1;36m\]\u@\h \[\e[1;33m\]\w \[\e[1;36m\]\$ ############## if which exa >/dev/null; then # exa is a modern ls replacement with Git integration: https://the.exa.website alias ls="exa --git-ignore" alias ll="exa --git-ignore --git -l" alias la="exa --git -la" @@ -19,6 +28,18 @@ else fi for alias in lsl sls lsls sl l s; do alias $alias=ls; done ####################################### ## Search history with arrow up/down ## ####################################### bind '"\e[A": history-search-backward' bind '"\e[B": history-search-forward' #################################################################### ## Type :W in vim (or :WQ respectively) to save a file using sudo ## #################################################################### grep '^command W ' .vimrc >/dev/null 2>&1 || echo "command W :execute ':silent w !sudo tee % > /dev/null' | :if v:shell_error | :edit! | :endif" >> .vimrc ############################# ## Awesome online services ## ############################# -
Moritz Marquardt created this gist
Nov 15, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,49 @@ ########### ## Color ## ########### export PS1='\[\e[1;38;5;244m\]\t \[\e[1;36m\]\u@\h \[\e[1;33m\]\w \[\e[1;36m\]\$ \[\e[0m\]' ############## ## ls & exa ## ############## if which exa >/dev/null; then # exa is a modern ls replacement with Git integration: https://the.exa.website alias ls="exa --git-ignore" alias ll="exa --git-ignore --git -l" alias la="exa --git -la" else alias ls="ls --color=always" alias ll="ls -l" alias la="ls -lA" fi for alias in lsl sls lsls sl l s; do alias $alias=ls; done ############################# ## Awesome online services ## ############################# # Send command output to qbin.io for quick & easy sharing (stored for 14 days) # Usage: echo "Hello World" | qbin alias qbin="curl https://qbin.io -s -T -" # Upload bigger & binary files to transfer.sh (stored for 14 days) # transfer anything.tar.gz transfer() { if [ $# -eq 0 ]; then echo -e "No arguments specified. Usage:\necho transfer /tmp/test.md\ncat /tmp/test.md | transfer test.md"; return 1; fi; tmpfile=$( mktemp -t transferXXX ); if tty -s; then basefile=$(basename "$1" | sed -e 's/[^a-zA-Z0-9._-]/-/g'); curl --progress-bar --upload-file "$1" "https://transfer.sh/$basefile" >> $tmpfile; else curl --progress-bar --upload-file "-" "https://transfer.sh/$1" >> $tmpfile ; fi; cat $tmpfile; rm -f $tmpfile; } ########################### ## Other helpful aliases ## ########################### # If ag is not installed, alias it to "grep -rn" (and generally force color for grep) alias grep="grep --color=always" which ag >/dev/null || alias ag="grep -rn" # Provide a yq command to use jq with YAML files alias yq="python3 -c 'import sys, yaml, json; json.dump(yaml.load(sys.stdin), sys.stdout, indent=4)' | jq" # A really simple password generator alias pw='bash -c '"'"'echo `tr -dc $([ $# -gt 1 ] && echo $2 || echo "A-Za-z0-9") < /dev/urandom | head -c $([ $# -gt 0 ] && echo $1 || echo 30)`'"'"' --' # Make docker-compose shorter alias docom="docker-compose"