function setCurrentTabName () { | |
WID=$(xprop -root | grep "_NET_ACTIVE_WINDOW(WINDOW)"| awk '{print $5}') | |
xdotool windowfocus $WID | |
xdotool key ctrl+i | |
xdotool key BackSpace | |
xdotool type $1 | |
xdotool key Return | |
} | |
function maybeCreateNewTab() { | |
for a in $@; do | |
# echo $a | |
if [[ $a == 'tab' || $a == '+' ]]; then | |
WID=$(xprop -root | grep "_NET_ACTIVE_WINDOW(WINDOW)"| awk '{print $5}') | |
xdotool windowfocus $WID | |
xdotool key ctrl+shift+t | |
fi | |
done | |
} | |
function update { | |
sudo apt-get update | |
sudo apt-get upgrade | |
echo "Yohoo jeg er oppdatert" | |
} | |
function reloadBash { | |
curPATH=$(pwd) | |
cd /home/$USER | |
. .bashrc | |
cd $curPATH | |
} | |
function color () { | |
echo -e "${Black}Black${NC}" | |
echo -e "${Dark_Gray}Dark_Gray${NC}" | |
echo -e "${Blue}Blue${NC}" | |
echo -e "${Light_Blue}Light_Blue${NC}" | |
echo -e "${Green}Green${NC}" | |
echo -e "${Light_Green}Light_Green${NC}" | |
echo -e "${Cyan}Cyan${NC}" | |
echo -e "${Light_Cyan}Light_Cyan${NC}" | |
echo -e "${Red}Red${NC}" | |
echo -e "${Light_Red}Light_Red${NC}" | |
echo -e "${Purple}Purple${NC}" | |
echo -e "${Light_Purple}Light_Purple${NC}" | |
echo -e "${Brown_Orange}Brown_Orange${NC}" | |
echo -e "${Yellow}Yellow${NC}" | |
echo -e "${Light_Gray}Light_Gray${NC}" | |
echo -e "${White}White${NC}" | |
} | |
function echo_red_text { | |
echo -e ${Red}$1${NC} $2 | |
} | |
function echo_blue_text { | |
echo -e ${Blue}$1${NC} $2 | |
} | |
function echo_yellow_text { | |
echo -e "${Yellow}$1${NC} $2" | |
} | |
function echo_ligth_blue_text { | |
echo -e "${Light_Blue}$1${NC} $2" | |
} | |
function parse_yaml { | |
local prefix=$2 | |
local s='[[:space:]]*' w='[a-zA-Z0-9_]*' fs=$(echo @|tr @ '\034') | |
sed -ne "s|^\($s\):|\1|" \ | |
-e "s|^\($s\)\($w\)$s:$s[\"']\(.*\)[\"']$s\$|\1$fs\2$fs\3|p" \ | |
-e "s|^\($s\)\($w\)$s:$s\(.*\)$s\$|\1$fs\2$fs\3|p" $1 | | |
awk -F$fs '{ | |
indent = length($1)/2; | |
vname[indent] = $2; | |
for (i in vname) {if (i > indent) {delete vname[i]}} | |
if (length($3) > 0) { | |
vn=""; for (i=0; i<indent; i++) {vn=(vn)(vname[i])("_")} | |
printf("%s%s%s=\"%s\"\n", "'$prefix'",vn, $2, $3); | |
} | |
}' | |
} | |
Black='\e[0;30m' | |
Dark_Gray='\e[1;30m' | |
Blue='\e[0;34m' | |
Light_Blue='\e[1;34m' | |
Green='\e[0;32m' | |
Light_Green='\e[1;32m' | |
Cyan='\e[0;36m' | |
Light_Cyan='\e[1;36m' | |
Red='\e[0;31m' | |
Light_Red='\e[1;31m' | |
Purple='\e[0;35m' | |
Light_Purple='\e[1;35m' | |
Brown_Orange='\e[0;33m' | |
Yellow='\e[1;33m' | |
Light_Gray='\e[0;37m' | |
White='\e[1;37m' | |
NC='\e[0m' | |
function load_all_extra_fils { | |
startPATH=`pwd` | |
cd /home/simon/.bash | |
if [[ -f fakturabank_function.sh ]]; then | |
source fakturabank_function.sh | |
fi | |
if [[ -f toivo_line.sh ]]; then | |
source toivo_line.sh | |
fi | |
if [[ -f awsome_git_voodoo.sh ]]; then | |
source awsome_git_voodoo.sh | |
fi | |
if [[ -f alias.sh ]]; then | |
source alias.sh | |
fi | |
notify-send -i info 'Du er klar for alt, alle filer er lastet, Det er nye eventyr i dag' | |
cd $startPATH | |
} | |
function trim_files { | |
sed -i '' -e 's/[[:space:]]*$//' $@ | |
} | |
function trim_folder { | |
if [[ -n $1 ]]; then | |
read -p "do you realy want to trim $1? " | |
if [[ $REPLY =~ ^[Yy]$ || $REPLY == yes ]]; then | |
# echo heloo | |
for file in `find $1`; do | |
if [[ -f $file && ! $file =~ \.png$ && ! $file =~ \.gif$ ]]; then | |
trim_files $file | |
fi | |
done | |
fi | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment