Update new scripts

This commit is contained in:
caskd 2019-10-27 03:47:42 +01:00
parent 68fce791c1
commit 205d677e2f
No known key found for this signature in database
GPG Key ID: 4D0C454CCA5DF3B6
8 changed files with 186 additions and 63 deletions

20
conf/.custom.zsh~ Normal file
View File

@ -0,0 +1,20 @@
# Check if running in TTY
if [ -z ${SSH_CONNECTION} ]; then
export TERM="xterm";
ZSH_THEME="dpoggi"; source $ZSHCONF/resources/dpoggi-timestamp.zsh-theme;
else
case $(tty) in
/dev/tty[2-9])
export TERM="xterm";
ZSH_THEME="dpoggi"; source $ZSHCONF/resources/dpoggi-timestamp.zsh-theme;
;;
/dev/pts/*)
export TERM="xterm-256color";
ZSH_THEME="powerlevel9k/powerlevel9k"; source $ZSHCONF/resources/powerlevel9k/powerlevel9k.zsh-theme;
#ZSH_THEME="spaceship"; source $ZSHCONF/resources/spaceship-prompt/spaceship.zsh-theme;
;;
*)
echo "We did not recognize the terminal type you are currently using!"
;;
esac
fi

69
conf/.plugins.zsh~ Normal file
View File

@ -0,0 +1,69 @@
plugins=(
cp
docker
docker-compose
git
golang
history
perms
sudo
systemadmin
systemd
)
case $(uname -rv) in
*Ubuntu*)
plugins+=(
ubuntu
)
;;
*)
plugins+=(
archlinux
)
;;
esac
function docker-all {
for ((i=0;i<=4;i++)); do
docker -H ssh://fra-n${i} $@
done
}
function build-n-push {
docker build ${1} --tag=localhost:5000/${2} && docker push localhost:5000/${2}
}
function manpdf {
man -Tpdf $1 | okular - &
disown
}
function gitsubrepo {
find . -maxdepth 1 -mindepth 1 -type d -exec sh -c '(echo {} && cd {} && git status -s && echo)' \;
}
function gitcom {
git add -A && git commit -am "$1" && git push
# git diff HEAD^ --compact-summary | while read LINE; do echo "$LINE"; done
}
function osutab {
xinput set-prop 'UGTABLET 6 inch PenTablet Pen (0)' --type=float 153 3.5 0 -0.5 0 2.9 0 0 0 1
}
function ignorekate {
printf ".*~\n*.kate-swp" >> .gitignore
}
function tonullpointer {
if [ -z ${1} ]; then
RANDFN=${RANDOM}
> /tmp/${RANDFN}
curl -F"file=@/tmp/${RANDFN}" http://0x0.st
rm /tmp/${RANDFN}
else
curl -F"file=@${1}" http://0x0.st
fi
}
function convert2gif {
ffmpeg -hwaccel vdpau -i $1 -r 60 -vf "scale=480:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" -loop 0 ${1%.*}.gif
}
function youtube2gif {
if [ -z ${1} ] || [ -z ${2} ] || [ -z ${3} ]; then
echo "Usage: youtube2gif <url> <start position> <lenght> [resolution] [framerate] [bitrate]";
else
ffmpeg -ss ${2} -t ${3} -hwaccel vdpau -i $(youtube-dl -gf "bestvideo[height<=${4-360}]" ${1}) -r ${5-60} -vf "scale=${4-360}:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" -b:v ${6-1000} -loop 0 -f gif -;
fi
}

6
conf/.vars.zsh~ Normal file
View File

@ -0,0 +1,6 @@
export PATH=$HOME/bin:$HOME/.local/bin:/usr/local/bin:$PATH
export LD_LIBRARY_PATH=/usr/lib:/usr/lib32:$HOME/.steam/bin/:$LD_LIBRARY_PATH
export ZSH="/home/caskd/.oh-my-zsh"
export LANG="en_US.UTF-8"
export AURHELPER=yay
export DOCKER_HOST=ssh://fra-n0

View File

@ -1,23 +1,20 @@
# Aliases
alias dc="docker-compose"
alias node0="ssh root@104.248.138.85"
alias node1="ssh root@104.248.240.59"
alias node3="ssh root@104.248.35.86"
alias vtop="vtop --theme brew"
# Check if running in TTY
case $(tty) in
/dev/tty[2-9])
export TERM="xterm";
ZSH_THEME="dpoggi"; source $ZSHCONF/resources/dpoggi-timestamp.zsh-theme;
;;
/dev/pts/*)
export TERM="xterm-256color";
ZSH_THEME="powerlevel9k/powerlevel9k"; source $ZSHCONF/resources/powerlevel9k/powerlevel9k.zsh-theme;
#ZSH_THEME="spaceship"; source $ZSHCONF/resources/spaceship-prompt/spaceship.zsh-theme;
neofetch
;;
*)
echo "We did not recognize the terminal type you are currently using!"
;;
esac
if [ -z ${SSH_CONNECTION} ]; then
case $(tty) in
/dev/tty[2-9])
export TERM="xterm";
ZSH_THEME="dpoggi"; source $ZSHCONF/resources/dpoggi-timestamp.zsh-theme;
;;
/dev/pts/*)
export TERM="xterm-256color";
ZSH_THEME="powerlevel9k/powerlevel9k"; source $ZSHCONF/resources/powerlevel9k/powerlevel9k.zsh-theme;
#ZSH_THEME="spaceship"; source $ZSHCONF/resources/spaceship-prompt/spaceship.zsh-theme;
;;
*)
echo "We did not recognize the terminal type you are currently using!"
;;
esac
else
export TERM="xterm";
ZSH_THEME="dpoggi"; source $ZSHCONF/resources/dpoggi-timestamp.zsh-theme;
fi

View File

@ -1,4 +1,5 @@
plugins=(
cp
docker
docker-compose
git
@ -8,21 +9,62 @@ plugins=(
sudo
systemadmin
systemd
zsh-completions
zsh-syntax-highlighting
)
case $(uname -rv) in
*ARCH*)
plugins+=(
archlinux
)
;;
*Ubuntu*)
plugins+=(
ubuntu
)
;;
*)
echo "Unknown distribution, loading general plugins only"
;;
esac
*Ubuntu*)
plugins+=(
ubuntu
)
;;
*)
plugins+=(
archlinux
)
;;
esac
function docker-all {
for ((i=0;i<=4;i++)); do
docker -H ssh://fra-n${i} $@
done
}
function build-n-push {
docker build ${1} --tag=localhost:5000/${2} && docker push localhost:5000/${2}
}
function manpdf {
man -Tpdf $1 | okular - &
disown
}
function gitsubrepo {
find . -maxdepth 1 -mindepth 1 -type d -exec sh -c '(echo {} && cd {} && git status -s && echo)' \;
}
function gitcom {
git add -A && git commit -am "$1" && git push
# git diff HEAD^ --compact-summary | while read LINE; do echo "$LINE"; done
}
function osutab {
xinput set-prop 'UGTABLET 6 inch PenTablet Pen (0)' --type=float 153 3.5 0 -0.5 0 2.9 0 0 0 1
}
function ignorekate {
printf ".*~\n*.kate-swp" >> .gitignore
}
function tonullpointer {
if [ -z ${1} ]; then
RANDFN=${RANDOM}
> /tmp/${RANDFN}
curl -F"file=@/tmp/${RANDFN}" http://0x0.st
rm /tmp/${RANDFN}
else
curl -F"file=@${1}" http://0x0.st
fi
}
function convert2gif {
ffmpeg -hwaccel vdpau -i $1 -r 60 -vf "scale=480:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" -loop 0 ${1%.*}.gif
}
function youtube2gif {
if [ -z ${1} ] || [ -z ${2} ] || [ -z ${3} ]; then
echo "Usage: youtube2gif <url> <start position> <lenght> [resolution] [framerate] [bitrate]";
else
ffmpeg -ss ${2} -t ${3} -hwaccel vdpau -i $(youtube-dl -gf "bestvideo[height<=${4-360}]" ${1}) -r ${5-60} -vf "scale=${4-360}:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" -b:v ${6-1000} -loop 0 -f gif -;
fi
}

View File

@ -1,14 +1,12 @@
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(
context
ssh
dir
dir_writable
vcs
)
POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(
status
root_indicator
background_jobs
load
ram
command_execution_time
time
)

View File

@ -1,5 +1,6 @@
export PATH=$HOME/bin:/usr/local/bin:$PATH
export LD_LIBRARY_PATH=/usr/lib:/usr/lib32:$LD_LIBRARY_PATH
export PATH=$HOME/bin:$HOME/.local/bin:/usr/local/bin:$PATH
export LD_LIBRARY_PATH=/usr/lib:/usr/lib32:$HOME/.steam/bin/:$LD_LIBRARY_PATH
export ZSH="/home/caskd/.oh-my-zsh"
export LANG="en_US.UTF-8"
export AURHELPER=yay
export AURHELPER=yay
export DOCKER_HOST=ssh://fra-n1

View File

@ -1,19 +1,9 @@
export ZSHCONF="/home/caskd/ZSHFiles/conf" # Root
# Load required stuff only, skip configs if tty1
case $(tty) in
/dev/tty1)
startx || echo "Mom, cancel my meetings! X got screwed by the package manager again."; # Start X server automatically if tty1
;;
*)
# Variables
source $ZSHCONF/vars.zsh # Enviroment variables
source $ZSHCONF/themevars.zsh # Theme variables
source $ZSHCONF/plugins.zsh # Plugins
source $ZSHCONF/external.zsh # External Sources
source $ZSHCONF/custom.zsh # Custom commands at end
echo -e "Theme: $ZSH_THEME"
echo "Plugins: ${plugins[@]}"
;;
esac
if [ $(tty) = "/dev/tty1" ]; then
startx; # Start X server automatically if tty1
fi
source $ZSHCONF/vars.zsh # Enviroment variables
source $ZSHCONF/themevars.zsh # Theme variables
source $ZSHCONF/plugins.zsh # Plugins
source $ZSHCONF/external.zsh # External Sources
source $ZSHCONF/custom.zsh # Custom commands at end