From 23471b1c220a481021647be137733a5c7aa3563a Mon Sep 17 00:00:00 2001 From: Sheppy Date: Sun, 8 Oct 2017 00:30:31 +0200 Subject: [PATCH 1/8] Refactoring --- zshrc | 371 ++++++++++++++++++++++++++++++---------------------------- 1 file changed, 195 insertions(+), 176 deletions(-) diff --git a/zshrc b/zshrc index 354ab5b..0c2e344 100644 --- a/zshrc +++ b/zshrc @@ -1,14 +1,22 @@ -### COLOR STDERR ### -NO_LDPRELOAD=false +######################################################################################################## +########################################### COLOR STDERR################################################ +######################################################################################################## + +## see https://ruderich.org/simon/#coloredstderr +COLOR_STDERR=true + +## disable for some hosts if [[ $HOST == "squarez" ]]; then - NO_LDPRELOAD=true + COLOR_STDERR=true fi -if [[ $NO_LDPRELOAD == false ]]; then + +if [[ $COLOR_STDERR == true ]]; then LD_PRELOAD="$HOME/.config/libcoloredstderr.so" COLORED_STDERR_FDS=2, export LD_PRELOAD COLORED_STDERR_FDS fi +## this is a little hack to make zsh-error output to also appear as red if [[ $FIRST_RUN == "FALSE" ]]; then ; else @@ -17,87 +25,187 @@ else exec zsh fi -#### ZSH-INTERNAL #### -### HISTORY ### -STSIZE=20000 -SAVEHIST=20000 -HISTFILE=~/.config/zshhistory.log +######################################################################################################## +############################################## PROMT ################################################### +######################################################################################################## - - -### PROMT ### +## colors ## +SEPERATOR_LINE_COLOR="green" MAIN_PROMT_COLOR="green" USER_COLOR="yellow" -if [[ $HOST == "squarez" ]]; then - USER_COLOR="cyan" -fi +USER_HOST_SEPERATOR_COLOR="red" +HOST_COLOR="yellow" +HOST_PATH_SEPERATOR_COLOR="red" +PATH_COLOR="cyan" +PATH_INPUT_SEPERATOR_COLOR="green" + +## different color for root ## if [[ $USER == "root" ]]; then USER_COLOR="red" MAIN_PROMT_COLOR="red" fi -setopt promptsubst -CMD_START=$'%F{$MAIN_PROMT_COLOR}--->%f ' -PS1=$'%F{$USER_COLOR}%m%f%F{red}:%f%F{cyan}%~%f\n'$CMD_START #promt -if [[ ( $USER != 'sheppy') && ( $USER != 'ik15ydit') && ( $USER != 'root' ) ]]; then - PS1='%F{cyan}%n%f%F{red}@%f'$PS1 +## different color for certain hosts ## +if [[ $HOST == "squarez" ]]; then + USER_COLOR="cyan" fi -PS1=%F{$MAIN_PROMT_COLOR}$'${(r:$COLUMNS::\u2500:)}'%f$PS1 +## seperators ## +USER_HOST_SEPERATOR="@" +HOST_PATH_SEPERATOR=":" +PATH_INPUT_SEPERATOR="--->" +PATH_INPUT_NEWLINE=true -### STYLE ### +## build all parts ## +SEPERATOR_LINE=%F{$SEPERATOR_LINE_COLOR}$'${(r:$COLUMNS::\u2500:)}'%f +USER_NAME="%F{$USER_COLOR}%n%f" +USER_HOST_SEPERATOR="%F{$USER_HOST_SEPERATOR_COLOR}${USER_HOST_SEPERATOR}%f" +HOSTNAME="%F{$HOST_COLOR}%m%f" +HOST_PATH_SEPERATOR="%F{$HOST_PATH_SEPERATOR_COLOR}:%f" +PATH_STR="%F{$PATH_COLOR}%~%f" +PATH_INPUT_SEPERATOR="%F{$SEPERATOR_LINE_COLOR}${PATH_INPUT_SEPERATOR} %f" +if [[ $PATH_INPUT_NEWLINE == "true" ]]; then + PATH_INPUT_SEPERATOR=" +${PATH_INPUT_SEPERATOR}" +fi + +## no usernames for my default accounts ## +if [[ $USER == 'sheppy' || $USER == 'ik15ydit' || $USER == 'root' ]]; then + USER_NAME="" + USER_HOST_SEPERATOR="" +fi + +## build the complete promt ## +PS1="${SEPERATOR_LINE}${USER_NAME}${USER_HOST_SEPERATOR}${HOSTNAME}${HOST_PATH_SEPERATOR}${PATH_STR}${PATH_INPUT_SEPERATOR}" + +## replace the magic values, i.e. %m with hostname ## +setopt promptsubst #enable the promt + +## chromium and bash don't like LD_PRELOAD ## +alias chromium="export TMP_PRELD=$LD_PRELOAD && unset LD_PRELOAD && chromium && export LD_PRELOAD=$TMP_PRELD" +alias bash="export TMP_PRELD=$LD_PRELOAD && unset LD_PRELOAD && bash && export LD_PRELOAD=$TMP_PRELD" + +######################################################################################################## +######################################## OPTIONS ####################################################### +######################################################################################################## + +## show list of tab-completing options zstyle ':completion:*:default' list-prompt '%p' -zstyle ':completion:*' use-cache yes; zstyle ':completion:*' cache-path #~/.zsh/cache (~/.zsh muss existieren) -zstyle ':completion:::::' completer _expand _complete _prefix _ignored _approximate # _expand expandiert dinge wie $FOO, _complete ist -#das normale completion, _prefix ignoriert alles nach dem Cursor (für complete_in_word) _ignored ignoriered gewisse matches, ist mit -#_approximate wichtig, damit nicht falsche dinge completet werden, _approximate sucht nach ähnlichen Dingen -zstyle -e ':completion:*:approximate:*' max-errors 'reply=( $(( ($#PREFIX + $#SUFFIX) / 5 )) )' # maximal alle 3 zeichen ein fehler + +## cache completion for re-use (path must exist) +zstyle ':completion:*' use-cache yes; zstyle ':completion:*' cache-path + +## _complete -> completiong +## _expand -> expand variables +## _prefix -> ignore everything behind cursor +## _approximate -> fuzzy completion +## _ignore -> ignore some matches (i.e. directories when doing cd) +zstyle ':completion:::::' completer _expand _complete _prefix _ignored _approximate + +## one wrong character every X characters is corrected +## X = 5 is a reasonable default +zstyle -e ':completion:*:approximate:*' max-errors 'reply=( $(( ($#PREFIX + $#SUFFIX) / 5 )) )' + +## correct lowercase to uppercase zstyle ':completion:*:(^approximate):*' matcher-list 'm:{a-z}={A-Z}' # Kleinschreibung automatisch zu Großschreibung korrigieren. + +## keep magic prefixes like '~' when expanding zstyle ':completion:*:expand:*' keep-prefix yes #halt praefix behalten, HOME nicht zu cip/home blablabla expandierekn -zstyle ':completion:*' list-suffixes yes # completet a/b/c zu abc/bcd/coo -zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS} # dircolors für completion -zstyle ':completion:*' menu select -### OPTIONS ### -setopt noclobber #keine datein ueberscheiben mit > -setopt appendhistory; setopt incappendhistory # history immer sofort -setopt histignoredups #keine duplikate -setopt histignorespace #keine dinge mit leerzeichen in history -setopt nolistambiguous # sofort alle Möglichkeiten anzeigen -setopt completeinword # in Wörtern completen, braucht der _prefix completer +## compelte a/b/c zu abc/bcd/coo +zstyle ':completion:*' list-suffixes yes -### GENERAL ### -#bindkey '^R' history-incremental-pattern-search-backward -zmodload zsh/complist #bessere listen +## colors in completion menu ## +zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS} + +## allow autocomplete-navigation with arrowkeys +zstyle ':completion:*' menu select #enable a menu which can be browsed with arrow keys + +## do not overwrite files with '>' " +setopt noclobber + +## write command to historyfile imediatelly +setopt appendhistory; setopt incappendhistory + +## max size and location of history-savefile +STSIZE=20000 +SAVEHIST=20000 +HISTFILE=~/.config/zshhistory.log + +## no duplicated commands +setopt histignoredups + +## no emptylines +setopt histignorespace + +## tab completion after pressing tab once (default is twice) +setopt nolistambiguous + +## allow in word completion +setopt completeinword + +## i forgot what this does but completion doesnt work without it autoload -Uz compinit; compinit #completioni -### SSH-AGENT ### -if [ -f $HOME/.config/agent_socket ]; then - export SSH_AUTH_SOCK=/tmp/ssh-$(cat $HOME/.config/agent_socket) -fi - ### UMASK ### umask 077 -#### ZSH ALIASES #### -## BASIC ## -alias -g E='2>&1' -alias -g N='>/dev/null' -alias -g EN='2>/dev/null' -alias -g L='2>&1 | less' -alias -g G='| grep' -alias -g S='| sort' -alias -g ...='../..' +## ask before overwriting files with mv/cp alias mv='mv -i' alias cp='cp -i' -alias ..='cd ..' -## Anti-LD-Preload Chromium Wrapper ## -alias chromium="export TMP_PRELD=$LD_PRELOAD && /bin/bash -c 'unset LD_PRELOAD && chromium' && export LD_PRELOAD=$TMP_PRELD" +## color scheme for LS ## +LS_COLORS=$LS_COLORS:'di=0;35:'; export LS_COLORS + +## A -> show hidden files, but not . and .. +## a -> show hidden files +## l -> show additional information for files +## h -> show human readable file-size (1M instead of 1000000 bytes) +## --color=auto color output with $LS_COLORS +alias la="ls -lah --color=auto" +alias ll="ls -llh --color=auto" +alias ls="ls --color=auto" +alias l="ls -lh --color=auto" +alias ..='cd ..' +alias ...='cd ../../' + +#### SEARCH HISTORYFILE #### +if ! [ -x "$(command -v peco)" ]; then + bindkey '^R' history-incremental-pattern-search-backward +else + ## bind peco to ctrl-R as a better reverse search than the buitin if it is availible + reverse_search(){print -z "$(tac ${HISTFILE} | peco)"} + zle -N rs_peco reverse_search + bindkey ^R rs_peco + PECO=/usr/bin/ +fi + +### USEFULL CIP STUFF ### + +## disable messages to tty's since it's used for trolling in university way too often +if [[ $HOST =~ faui* || $HOST =~ ircbox ]]; then + mesg n +fi + +## Connect to ircbox and attach tmux +alias irc="ssh ircbox.cs.fau.de -t 'command; tmux a'" + +## lock screen but still let people read it +alias transparent_xlock="xlock -mode blank -geometry 1x1" + + +###################################################### END OF BASIC CONFIG ###################################################### + ## Start thunderbird with correct time-format ## alias thunderbird="LC_ALL=en_DK.utf8 && export LC_ALL && thunderbird" +## DIRECT TO CONFIG ## +alias hlconf="vim ~/.config/herbstluftwm/autostart" +alias zshconf="vim ~/.zshrc" +alias vimconf="vim ~/.vimrc" +alias sshconf="vim ~/.ssh/config" + ## GIT ## alias gstat="git status" alias gpull="git pull" @@ -105,46 +213,13 @@ alias gpush="git push" alias gcom="git commit -a" alias gadd="git add" -## LOCKS ## -if [[ $HOST =~ atlantis* ]]; then - alias i3lock="i3lock --image=/home/ik15ydit/.config/i3lock/bg.png" - alias hlock="i3lock --image=/home/ik15ydit/.config/i3lock/bg.png -t" - alias -g sq="sheppy@squarez.fauiwg.de" - alias -g pine="sheppy@sheppy.chickenkiller.com" -else - alias transparent_xlock="xlock -mode blank -geometry 1x1" -fi +## REMOTE HOSTS ## +alias -g sq="sheppy@squarez.fauiwg.de" +alias -g pine="sheppy@sheppy.chickenkiller.com" ## PACKAGE MANAGEMENT ## alias psearch="apt-cache search" -## GENERAL SHORTCUTS ## -if [[ $HOST =~ atlantis* ]]; then - #alias gedit="gedit 2&>/dev/null &" - alias kpaint="kolourpaint 2&>/dev/null &" - alias telegram='ssh telegram-sheppy@atlantishq.de -t "~/tg/bin/telegram-cli"' - alias telegram-plain='ssh uni -t "/proj/ciptmp/ik15ydit/Zeug/Telegram/tg/bin/telegram-cli --disable-colors --disable-readline -k tg-server.pub"' - - alias x='exec startx' - alias vpn='sudo /usr/bin/openvpn_cip.sh' -else - alias burp=/home/cip/2013/ik15ydit/ciptmp/reps/WebScan/burpsuite/BurpSuiteFree -fi -alias rehash="source ~/.config/zshrc" -function qfind { - find . -name "$1" -} -alias pcolor='for i in {0..255} ; do printf "\x1b[38;5;${i}mcolour${i} "; if [[ $(((($i+3)/6)*6)) -eq $(($i+3)) ]]; then echo; fi; done' -alias "ipconf"="ip addr show" -alias 'vpn?'='ps -ef | grep openvpn | grep -v grep' - -## General ## -if [[ $HOST =~ atlantis* ]]; then - alias -g jpg2png="echo 'use convert [file_in.jpg] [file_out.png]'" - alias mpc-curses='ncmpc --host 10.100.4.22' - alias wgplayer='ncmpc --host 10.100.4.22' -fi - ## Pathing ## CIP_MOUNTPOINT="$HOME/mountpoints/cip_root" FS_PREFIX="" @@ -152,7 +227,6 @@ CIPTMP="/proj/ciptmp/$USER" if [[ $HOST =~ atlantis* ]]; then FS_PREFIX=$CIP_MOUNTPOINT fi -alias ct="cd $FS_PREFIX$CIPTMP" alias tutoren="cd $FS_PREFIX$CIPTMP/reps/tutorenShare" ## MARKINGBIRD ## @@ -161,87 +235,55 @@ if [[ $HOST == faui* ]]; then alias mabird="/proj/ciptmp/ik15ydit/reps/MarkingBird/MarkingBird.py" fi -## PATHS ## -if [[ $HOST =~ faui* ]]; then - export JAVA_HOME="/local/java-1.8" -fi - ## CONNECT UNI ## -alias irc="ssh ircbox.cs.fau.de -t 'command; tmux a'" alias -g uni="ik15ydit@faui06c.cs.fau.de" alias cipkey="ssh-add ~/.ssh/ciplogin" alias cipra="xpra start ssh:ik15ydit@faui00n.cs.fau.de:100 --start-child urxvt" alias mountcip="sshfs ik15ydit@faui00n.cs.fau.de:/ -o reconnect,idmap=user $CIP_MOUNTPOINT" alias umountcip="fusermount -u $CIP_MOUNTPOINT" -## CONNECT Locally ## -#alias -g atlantislaptop="ik15ydit@atlantislaptop.local" -#alias -g atlantismedion="ik15ydit@atlantismedion.local" - -## DIRECT TO CONFIG ## -alias hlconf="vim ~/.config/herbstluftwm/autostart" -alias zshconf="vim ~/.zshrc" -alias vimconf="vim ~/.vimrc" -alias sshconf="vim ~/.ssh/config" - ## CIP SHORTCUTS ## if [[ $HOST =~ faui* ]]; then alias iceweasel="bash -c 'cp -f --recursive .mozilla/firefox/d9m0msa0.test /var/tmp && chmod 700 --recursive /var/tmp/d9m0msa0.test/ && iceweasel --profile /var/tmp/d9m0msa0.test && rm -rf /var/tmp/d9m0msa0.test'" - alias mpstubs="cd /proj/ciptmp/ik15ydit/reps/mpstubs/" - alias reps="cd /proj/ciptmp/ik15ydit/reps/" alias rudipub='cd /home/cip/2010/he29heri/pub/' alias sudo="echo THIS IS THE CIP NOT YOUR COMPUTER!!!!! >&2" alias su="echo THIS IS THE CIP NOT YOUR COMPUTER!!!!! >&2" fi -## MOUNTABLE CIP-SHORTCUTS ## -if [[ $HOST =~ atlantis* ]]; then - alias -g ciptmp="~/mountpoints/cip_root/proj/ciptmp/ik15ydit/" - alias -g ciphome="~/mountpoints/cip_root/home/cip/2013/ik15ydit/" -fi -## DIPLAY CONTROL ## +## ATLANTIS* ## if [[ $HOST =~ atlantis* ]]; then - alias dual="xrandr --output DVI-I-2 --right-of DVI-I-1" alias shutown="/sbin/poweroff" alias s2disk="sudo /usr/sbin/s2disk" + alias -g ciptmp="~/mountpoints/cip_root/proj/ciptmp/ik15ydit/" + alias -g ciphome="~/mountpoints/cip_root/home/cip/2013/ik15ydit/" + alias mpc-curses='ncmpc --host 10.100.4.22' + alias wgplayer='ncmpc --host 10.100.4.22' fi if [[ $HOST == "atlantislaptop" ]]; then alias backlightctl="tee /sys/class/backlight/intel_backlight/brightness <<< $1" - alias nodisplayoff='xset s off' fi -## JAVA ## +## /dev/zsh/random ## +alias nodisplayoff='xset s off' alias javac-all-test4='javac -cp .:/usr/share/java/junit4.jar *.java' alias java-test4='java -cp .:/usr/share/java/junit4.jar' - -## /zsh/random ## -alias spc='gcc -std=c99 -pedantic -Wall -Werror -D_XOPEN_SOURCE=700 -o' -alias woist='ssh ircbox nc localhost 1339 | grep -B1 " in .zshrci' -alias logins='nc localhost 1339 | grep -B1' alias cltex="rm *.log *.aux *.fdb_latexmk *.fls" alias wordcount="find . -type f -exec cat {} + | wc -w" alias bv="urxvt -e vim $1" alias v="vim $1" -alias chrome_with_proxy="unset LD_PRELOAD && /usr/bin/chromium --proxy-server="127.0.0.1:8080" --user-data-dir=/proj/ciptmp/ik15ydit/SymlinksLocationsBurpChrome" - -## LS ## -LS_COLORS=$LS_COLORS:'di=0;35:'; export LS_COLORS -alias la="ls -lAh --color=auto" -alias ll="ls -llh --color=auto" -alias ls="ls --color=auto" -alias l="ls -lh --color=auto" - -## SSH-KEYS ## -gitssh=~/.ssh/gitrsa -alias gitkey="ssh-add $gitssh" - -## ROOT ## -alias udev_reload="udevadm control --reload-rules && udevadm trigger" #reload all udevrules on the fly - -### DISABLE MESSAGES ### -if [[ $HOST =~ faui* ]]; then - mesg n -fi +alias hgrep="cat ~/.config/zshhistory.log | grep" +alias hq="ssh -4 root@atlantishq.de" +alias sync-atlantishq="rsync -avz -r -P root@atlantishq.de:/home/home_backup/ /home/sheppy/archive" +alias -g public_ip='wget --timeout=3 -O- --quiet https://atlantishq.de/ipcheck' +alias gitkey="ssh-add ~/.ssh/gitrsa" +alias pcolor='for i in {0..255} ; do printf "\x1b[38;5;${i}mcolour${i} "; if [[ $(((($i+3)/6)*6)) -eq $(($i+3)) ]]; then echo; fi; done' +alias 'vpn?'='ps -ef | grep openvpn | grep -v grep' +alias telegram='\ssh telegram-sheppy@atlantishq.de -t "~/tg/bin/telegram-cli"' +alias x='exec startx' +whateverprovides(){ + apt-file search --regexp "bin/$1""$" +} +export whateverprovide ### COLOR SSH ### alias unfuck="printf '\033]708;black\007'" @@ -252,34 +294,11 @@ ssh_func(){ } alias ssh="ssh_func" - -### REVERSE SEARCH ### -if ! [ -x "$(command -v peco)" ]; then - PECO=~/.config/bin/ -else - PECO=/usr/bin/ -fi - -alias cfind='print -z $(g/zshhistory.log | $PECO/peco)' -hhs(){print -z "$(cat ~/.config/zshhistory.log | $PECO/peco)"} -zle -N hhstest hhs -bindkey ^R hhstest - -### LD PRELOAD FOR ZSH ### -if [[ $FIRST_RUN == "FALSE" ]]; then - ; -else - FIRST_RUN="FALSE" - export FIRST_RUN - exec zsh -fi - -alias hgrep="cat ~/.config/zshhistory.log | grep" -alias hq="ssh -4 root@atlantishq.de" -alias sync-atlantishq="rsync -avz -r -P root@atlantishq.de:/home/home_backup/ /home/sheppy/archive" - -## APT ## -whateverprovides(){ - apt-file search --regexp "bin/$1""$" +### EXPERIMENTAL ### +genocide(){ + while IFS='' read -r line || [[ -n "$line" ]]; do + $(ssh $line) + done < "$HOME/.config/logins" } -export whateverprovide +export genocide +alias insurgency_status="ssh insurgency@atlantishq.de -t /usr/local/bin/insurgency_rcon status" From 5907e9bf6508f0e58a8b2be8a925874f3f12fa5b Mon Sep 17 00:00:00 2001 From: Sheppy Date: Sun, 8 Oct 2017 00:31:49 +0200 Subject: [PATCH 2/8] xlock addtions --- xconf/Xresources | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/xconf/Xresources b/xconf/Xresources index 38901ac..2d69a75 100755 --- a/xconf/Xresources +++ b/xconf/Xresources @@ -10,3 +10,14 @@ URxvt.perl-ext-common: selection-to-clipboard !URxvt*borderLess: false !URxvt*internalBorder: 5 !URxvt*borderColor: red + +XLock*mode: image +XLock*image.bitmap: ~/.xlock.xpm +XLock*image.count: 1 +XLock*image.erasedelay: 0 +XLock*erasedelay: 0 +XLock*icongeometry: 180x180 +XLock*background: Black +XLock*foreground: White +XLock*description: off +XLock*info: From 8482b67b8b267eecc76827ab7cfd81902e786eeb Mon Sep 17 00:00:00 2001 From: atlantispc_sheppy Date: Fri, 13 Oct 2017 19:18:13 +0200 Subject: [PATCH 3/8] telegram fixed --- herbstluftwm/autostart | 2 +- ssh/config | 1 + zshrc | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/herbstluftwm/autostart b/herbstluftwm/autostart index 3ca2110..cb9256d 100755 --- a/herbstluftwm/autostart +++ b/herbstluftwm/autostart @@ -75,7 +75,7 @@ hc keybind $Mod-p spawn pavucontrol hc keybind $Mod-Shift-l spawn libreoffice hc keybind $Mod-t spawn /bin/bash -c "LC_ALL=en_DK.utf8 && export LC_ALL && thunderbird" hc keybind $Mod-Shift-i spawn urxvt -e ssh ik15ydit@ircbox.cs.fau.de -t 'tmux a -d' -hc keybind $Mod-Shift-t spawn urxvt -e ssh telegram-sheppy@atlantishq.de -t "/home/telegram-sheppy/tg/bin/telegram-cli" +hc keybind $Mod-Shift-t spawn urxvt -e ssh telegram-sheppy@atlantishq.de -i ~/.ssh/telegram -t "/home/telegram-sheppy/tg/bin/telegram-cli" hc keybind $Mod-j spawn /bin/bash -c "rm $HOME/.config/herbstluftwm/irc.log && herbstclient spawn urxvt -e 'exit'" hc keybind $Mod-e spawn rofi -combi-mode window,run -show combi -modi combi hc keybind $Mod-Shift-e spawn rofi -show run diff --git a/ssh/config b/ssh/config index 8a4664f..4b4a4c5 100644 --- a/ssh/config +++ b/ssh/config @@ -6,4 +6,5 @@ Host *.fauiwg.de User sheppy IdentityFile ~/.ssh/wg Host *.cs.fau.de + User ik15ydit IdentityFile ~/.ssh/cipkey diff --git a/zshrc b/zshrc index 0c2e344..69e88c1 100644 --- a/zshrc +++ b/zshrc @@ -278,7 +278,7 @@ alias -g public_ip='wget --timeout=3 -O- --quiet https://atlantishq.de/ipcheck' alias gitkey="ssh-add ~/.ssh/gitrsa" alias pcolor='for i in {0..255} ; do printf "\x1b[38;5;${i}mcolour${i} "; if [[ $(((($i+3)/6)*6)) -eq $(($i+3)) ]]; then echo; fi; done' alias 'vpn?'='ps -ef | grep openvpn | grep -v grep' -alias telegram='\ssh telegram-sheppy@atlantishq.de -t "~/tg/bin/telegram-cli"' +alias telegram='\ssh telegram-sheppy@atlantishq.de -i ~/.ssh/telegram -t "~/tg/bin/telegram-cli"' alias x='exec startx' whateverprovides(){ apt-file search --regexp "bin/$1""$" From c68e07ad5dc2f71db67277c310b6e520b1b23462 Mon Sep 17 00:00:00 2001 From: Sheppy Date: Mon, 23 Oct 2017 00:07:57 +0200 Subject: [PATCH 4/8] green xlock --- herbstluftwm/autostart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/herbstluftwm/autostart b/herbstluftwm/autostart index 3ca2110..d0c168f 100755 --- a/herbstluftwm/autostart +++ b/herbstluftwm/autostart @@ -67,7 +67,7 @@ hc keybind $Mod-i spawn urxvt -e nohup zsh -c "chromium &" #need to reliably use if [[ $HOST =~ atlantis* ]]; then hc keybind $Mod-l spawn i3lock -i ~/.config/i3lock/bg.png -t else - hc keybind $Mod-l spawn xlock + hc keybind $Mod-l spawn xlock -fg green hc keybind $Mod-Shift-x spawn xlock -mode blank -geometry 1x1 hc keybind $Mod-x spawn xlock -mode blank -geometry 1x1 fi From 4d181e7322dc5289e25696c0637bb22acab3d7be Mon Sep 17 00:00:00 2001 From: Sheppy Date: Mon, 23 Oct 2017 00:08:34 +0200 Subject: [PATCH 5/8] set autocd --- zshrc | 1 + 1 file changed, 1 insertion(+) diff --git a/zshrc b/zshrc index 0c2e344..523bc7e 100644 --- a/zshrc +++ b/zshrc @@ -302,3 +302,4 @@ genocide(){ } export genocide alias insurgency_status="ssh insurgency@atlantishq.de -t /usr/local/bin/insurgency_rcon status" +setopt autocd From 601498aec303b6a25da96764942db0418b4567a6 Mon Sep 17 00:00:00 2001 From: Sheppy Date: Mon, 23 Oct 2017 00:09:18 +0200 Subject: [PATCH 6/8] burpsuite --- herbstluftwm/autostart | 1 - 1 file changed, 1 deletion(-) diff --git a/herbstluftwm/autostart b/herbstluftwm/autostart index f80c061..9b3d701 100755 --- a/herbstluftwm/autostart +++ b/herbstluftwm/autostart @@ -79,7 +79,6 @@ hc keybind $Mod-Shift-t spawn urxvt -e ssh telegram-sheppy@atlantishq.de -i ~/.s hc keybind $Mod-j spawn /bin/bash -c "rm $HOME/.config/herbstluftwm/irc.log && herbstclient spawn urxvt -e 'exit'" hc keybind $Mod-e spawn rofi -combi-mode window,run -show combi -modi combi hc keybind $Mod-Shift-e spawn rofi -show run -hc keybind $Mod-b spawn /home/cip/2013/ik15ydit/ciptmp/reps/WebScan/burpsuite/BurpSuiteFree # basic movement # focusing clients From ca6d8e581d8675f45798e16fbbb1b4ed1a4c70de Mon Sep 17 00:00:00 2001 From: Sheppy Date: Mon, 23 Oct 2017 03:23:23 +0200 Subject: [PATCH 7/8] small changes --- herbstluftwm/autostart | 3 +++ xconf/.xinitrc | 0 zshrc | 12 +++++++++--- 3 files changed, 12 insertions(+), 3 deletions(-) mode change 100644 => 100755 xconf/.xinitrc diff --git a/herbstluftwm/autostart b/herbstluftwm/autostart index 9b3d701..858e4cc 100755 --- a/herbstluftwm/autostart +++ b/herbstluftwm/autostart @@ -245,3 +245,6 @@ for monitor in $(herbstclient list_monitors | cut -d: -f1) ; do # start it on each monitor "$panel" $monitor & done + +touch ~/.config/cip_logins +echo $HOST >> ~/.config/cip_logins diff --git a/xconf/.xinitrc b/xconf/.xinitrc old mode 100644 new mode 100755 diff --git a/zshrc b/zshrc index bb72c46..09d2c8e 100644 --- a/zshrc +++ b/zshrc @@ -144,6 +144,9 @@ setopt nolistambiguous ## allow in word completion setopt completeinword +## allow ommition of cd to change directory, use with caution ## +setopt autocd + ## i forgot what this does but completion doesnt work without it autoload -Uz compinit; compinit #completioni @@ -295,11 +298,14 @@ ssh_func(){ alias ssh="ssh_func" ### EXPERIMENTAL ### +## kill all cip sessions except this pc ## genocide(){ while IFS='' read -r line || [[ -n "$line" ]]; do - $(ssh $line) - done < "$HOME/.config/logins" + if [[ $line != $HOST ]]; then + ssh -q $line -t "pkill -u ik15ydit" + fi + done < "$HOME/.config/cip_logins" + #truncate -s 0 ~/.config/cip_logins } export genocide alias insurgency_status="ssh insurgency@atlantishq.de -t /usr/local/bin/insurgency_rcon status" -setopt autocd From e68b0efceceff66e0b6f6390d342f9c925005134 Mon Sep 17 00:00:00 2001 From: Sheppy Date: Mon, 23 Oct 2017 05:28:46 +0200 Subject: [PATCH 8/8] genocide --- herbstluftwm/autostart | 3 --- herbstluftwm/hl_status_deamon.py | 16 +++++++++++++--- herbstluftwm/test_cal.py | 11 ----------- 3 files changed, 13 insertions(+), 17 deletions(-) delete mode 100644 herbstluftwm/test_cal.py diff --git a/herbstluftwm/autostart b/herbstluftwm/autostart index 858e4cc..9b3d701 100755 --- a/herbstluftwm/autostart +++ b/herbstluftwm/autostart @@ -245,6 +245,3 @@ for monitor in $(herbstclient list_monitors | cut -d: -f1) ; do # start it on each monitor "$panel" $monitor & done - -touch ~/.config/cip_logins -echo $HOST >> ~/.config/cip_logins diff --git a/herbstluftwm/hl_status_deamon.py b/herbstluftwm/hl_status_deamon.py index d09cd24..fe6f0b5 100755 --- a/herbstluftwm/hl_status_deamon.py +++ b/herbstluftwm/hl_status_deamon.py @@ -4,9 +4,11 @@ import sys import time import sys import subprocess +from datetime import datetime from hl_panel_content import color_panel, get_color from hl_utils import error, is_cip, shexec, color_remove, hlpath, is_laptop import re +import socket RED = 0xff0000 GREEN = 0x32CD32 @@ -71,7 +73,7 @@ def battery(): return color_panel(str(e),RED) def battery_status(): - if is_laptop: + if is_laptop(): with open(hlpath("battery.log"),'w') as g: g.write(battery()) @@ -85,6 +87,15 @@ def ip_status(): g.write(tmp) +def trace_login(): + if is_cip(): + try: + tmp = shexec("wget --timeout=3 -O- --quiet 'https://atlantishq.de/ciplog/"+socket.gethostname()+"&active&"+str(datetime.now())+"'") + except: + tmp = "Service Unreachable" + with open(hlpath("cip_logins.log"),'w') as f: + f.write(tmp) + if __name__ == '__main__': #print('"'+sys.argv[-1]+'"') while(True): @@ -92,8 +103,7 @@ if __name__ == '__main__': pr_acct_status() battery_status() ip_status() + trace_login() if sys.argv[-1]=='--refresh': break time.sleep(30) - - diff --git a/herbstluftwm/test_cal.py b/herbstluftwm/test_cal.py deleted file mode 100644 index c697d43..0000000 --- a/herbstluftwm/test_cal.py +++ /dev/null @@ -1,11 +0,0 @@ -import urllib3 -import socket - -http = urllib3.PoolManager() -socket.setdefaulttimeout(5) -url = 'https://squarez.fauiwg.de:7001/radicale/testuser/cal.ics/' -headers = urllib3.util.make_headers(basic_auth='testuser:test') -r = http.request('GET', url, headers=headers) -f = open(test.log,'w') -f.write(r) -f.close()