Created
September 24, 2018 20:07
-
-
Save Joshua2504/e625344bf9df2b16343e3a3eb0cabbb5 to your computer and use it in GitHub Desktop.
This file contains 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 characters
# If not running interactively, don't do anything | |
case $- in | |
*i*) ;; | |
*) return;; | |
esac | |
# port-freigabe: iptables -I INPUT -p tcp -s 0.0.0.0/0 --dport 8080 -j ACCEPT | |
# custom eternal .bash_history: # https://stackoverflow.com/a/19533853/3779853 + https://github.com/dvorka/hstr | |
export HISTFILESIZE= # | |
export HISTSIZE= | |
export HISTTIMEFORMAT="[%F %T] " | |
export HISTFILE=~/.bash_eternal_history | |
# PROMPT_COMMAND="history -a; $PROMPT_COMMAND" .. unten | |
shopt -s histappend # append to the history file, don't overwrite it | |
export HH_CONFIG=hicolor # get more colors | |
export HISTCONTROL=ignorespace # leading space hides commands from history # HISTCONTROL=ignoreboth # don't put duplicate lines or lines starting with space in the history. | |
bind '"\C-r": "\C-a hh -- \C-j"' # bind hh to Ctrl-r (for Vi mode check doc) | |
shopt -s checkwinsize # check the window size after each command and, if necessary, update the values of LINES and COLUMNS. | |
shopt -s globstar # have ** be recursive. 20170613 | |
set -b # Cause the status of terminated background jobs to be reported immediately, rather than before printing the next primary prompt. | |
# s.a. https://github.com/mrzool/bash-sensible/blob/master/sensible.bash: | |
set -C # Prevent output redirection using ‘>’, ‘>&’, and ‘<>’ from overwriting existing files. # Use `>|` to force redirection to an existing file | |
PROMPT_DIRTRIM=3 # Automatically trim long paths in the prompt (requires Bash 4.x) | |
bind "set completion-ignore-case on" # Perform file completion in a case insensitive fashion | |
bind "set show-all-if-ambiguous on" # Display matches for ambiguous patterns at first tab press | |
bind "set mark-symlinked-directories on" # Immediately add a trailing slash when autocompleting symlinks to directories | |
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)" # make less more friendly for non-text input files, see lesspipe(1) | |
[ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ] && debian_chroot=$(cat /etc/debian_chroot) # set variable identifying the chroot you work in (used in the prompt below) | |
export TERM=xterm | |
# set variable identifying the chroot you work in (used in the prompt below) | |
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then | |
debian_chroot=$(cat /etc/debian_chroot) | |
fi | |
export COLOR_RED="$(tput setaf 1)" | |
export COLOR_GREEN="$(tput setaf 2)" | |
export COLOR_BLUE="$(tput setaf 4)" | |
export COLOR_BOLD="$(tput bold)" | |
export COLOR_DIM="$(tput dim)" | |
export COLOR_RESET="$(tput sgr0)" | |
# NO \[ or \] ( https://stackoverflow.com/a/24840720/3779853 ) | |
ps1_esc_start='\001' && ps1_esc_end='\002' | |
RED_ps1="${ps1_esc_start}${COLOR_RED}${ps1_esc_end}" | |
GREEN_ps1="${ps1_esc_start}${COLOR_GREEN}${ps1_esc_end}" | |
BLUE_ps1="${ps1_esc_start}${COLOR_BLUE}${ps1_esc_end}" | |
BOLD_ps1="${ps1_esc_start}${COLOR_BOLD}${ps1_esc_end}" | |
RESET_ps1="${ps1_esc_start}${COLOR_RESET}${ps1_esc_end}" | |
DIM_ps1="${ps1_esc_start}${COLOR_DIM}${ps1_esc_end}" | |
unset ps1_esc_start ps1_esc_end | |
exitstatus() { | |
if [[ $? != 0 ]]; then | |
echo -e "${RED_ps1}:(${RESET_ps1}" | |
else | |
echo -e "${GREEN_ps1}:)${RESET_ps1}" | |
fi | |
} | |
gitstatus() { | |
if git branch &>/dev/null; then | |
echo -e "${DIM_ps1} [git:"$(git branch 2>/dev/null | grep \* | cut -d " " -f 2)"]${RESET_ps1}" | |
fi | |
} | |
# no function call before $(existatus)! | |
export PS1="${DIM_ps1}[\t]${RESET_ps1} ${debian_chroot:+($debian_chroot)}${BOLD_ps1}${GREEN_ps1}\u@\h${BLUE_ps1}\w\$${RESET_ps1} \$(exitstatus)\$(gitstatus) " | |
BEFORE_PS1() { | |
# history -a # s.o. | |
history -a; history -n # mem/file sync # s.o. | |
} | |
export PROMPT_COMMAND=BEFORE_PS1 | |
# unset RED_ps1 GREEN_ps1 BLUE_ps1 BOLD_ps1 RESET_ps1 DIM_ps1 | |
#PATH=$PATH":$HOME/bin" | |
#JAVA_HOME=/usr/java/jdk1.8.0_73 | |
#MAVEN_HOME=$HOME/bin/maven #untested | |
#PATH="$PATH:$JAVA_HOME/bin" | |
################ | |
################ | |
alias ls='ls --color=auto' | |
alias grep='grep --color=auto' | |
alias fgrep='fgrep --color=auto' | |
alias egrep='egrep --color=auto' | |
# Alias definitions. | |
# You may want to put all your additions into a separate file like | |
# ~/.bash_aliases, instead of adding them here directly. | |
# See /usr/share/doc/bash-doc/examples in the bash-doc package. | |
if [ -f ~/.bash_aliases ]; then | |
. ~/.bash_aliases | |
fi | |
# 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 | |
############################ | |
############################ | |
PATH=$PATH":$HOME/bin" | |
#JAVA_HOME=/usr/java/jdk1.8.0_73 | |
#MAVEN_HOME=$HOME/bin/maven #untested | |
#PATH="$PATH:$JAVA_HOME/bin" | |
export JAVA_HOME | |
export PATH | |
############# datumm hi ####### hiiiiiiiiiiii | |
############################### | |
tiv() { /usr/local/bin/tiv -256 "$@" ;} | |
l() { ls -hal "$@" ;} | |
inst() { apt-get install "$@";} | |
uninst() { apt-get --purge autoremove "$@";} | |
compress_img() { | |
echo "compress jpg $1..." | |
jpegoptim -m40 "$1" > /dev/null 2>&1 && return 0 | |
echo "converting to jpg first..." | |
convert "$1" "$1.jpg" | |
echo "compress jpg..." | |
jpegoptim -m40 "$1.jpg" && rm "$1" | |
} | |
alias rm='rm -I' | |
ta() { tmux attach -t "$@" ;} | |
c() { | |
cd "$@" | |
l | |
} | |
mv_no_override() { | |
local dir file ext base num | |
if [ -d "$2" ]; then | |
dir=$2 | |
file=$(basename "$1") | |
else | |
dir=$(dirname "$2") | |
file=$(basename "$2") | |
fi | |
ext="$(sed -r 's/.+(\..+)|.*/\1/' <<<"$file")" | |
base="$(sed -r 's/(.+)\..+|(.*)/\1\2/' <<<"$file")" | |
while [ -e "$dir/$base$num$ext" ]; do | |
(( num++ )) | |
done | |
mv "$1" "$dir/$base$num$ext" | |
} | |
cpu_limit() { | |
#sudo cpufreq-set -u 0.8Ghz # minimum. check cpufreq-info |grep limits | |
echo "check cpufreq-info |grep limits for limits.." | |
echo "set cpu limit to 800 MHz" | |
} | |
cpu_limit_free() { | |
#sudo cpufreq-set -u 3.5Ghz # maximum | |
echo "check cpufreq-info |grep limits for limits.." | |
echo "set cpu limit to 3500 MHz" | |
} | |
screenfetch |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment