From 356fd7667162705fa354cb27df51db60c808c2f1 Mon Sep 17 00:00:00 2001 From: Quentin Godefroid Date: Thu, 3 May 2018 15:21:02 +0200 Subject: [PATCH] add hasteadd gw01 --- .bashrc | 9 +- .zshrc | 276 ++++++++++++++++++++++++++++++++++++++++++++++ Makefile.docker | 2 +- bash/bash_aliases | 5 +- bin/haste | 4 + 5 files changed, 293 insertions(+), 3 deletions(-) create mode 100644 .zshrc create mode 100755 bin/haste diff --git a/.bashrc b/.bashrc index b527098..2d3b316 100644 --- a/.bashrc +++ b/.bashrc @@ -12,4 +12,11 @@ fi for _FILE in $(ls ~/dotfiles/bash/); do source ~/dotfiles/bash/$_FILE -done \ No newline at end of file +done + +#source ~/ovhrc +PATH="/home/qgodefro/perl5/bin${PATH:+:${PATH}}"; export PATH; +PERL5LIB="/home/qgodefro/perl5/lib/perl5${PERL5LIB:+:${PERL5LIB}}"; export PERL5LIB; +PERL_LOCAL_LIB_ROOT="/home/qgodefro/perl5${PERL_LOCAL_LIB_ROOT:+:${PERL_LOCAL_LIB_ROOT}}"; export PERL_LOCAL_LIB_ROOT; +PERL_MB_OPT="--install_base \"/home/qgodefro/perl5\""; export PERL_MB_OPT; +PERL_MM_OPT="INSTALL_BASE=/home/qgodefro/perl5"; export PERL_MM_OPT; diff --git a/.zshrc b/.zshrc new file mode 100644 index 0000000..b9c286d --- /dev/null +++ b/.zshrc @@ -0,0 +1,276 @@ +export PATH="/sbin:/usr/local/bin:/usr/bin:/bin:/usr/games:~/bin:~/toolbox:~/hosting-run-scripts/rc-files" + +export TERM=rxvt-unicode-256color + +# completion +autoload -U compinit +compinit + +# correction +setopt correct + +#history +HISTFILE="$HOME/.zshistory" +HISTSIZE=20000 +SAVEHIST=10000 +alias hist='history -D -E' +setopt hist_ignore_dups + +#autocd +setopt autocd + +#extended wildcards +setopt extendedglob + +#color adn format def +local black="%{"$'\033[00;30m'"%}" +local green="%{"$'\033[00;32m'"%}" +local red="%{"$'\033[00;31m'"%}" +local yellow="%{"$'\033[00;33m'"%}" +local blue="%{"$'\033[00;34m'"%}" +local dblue="%{"$'\033[00;34m'"%}" +local magenta="%{"$'\033[00;35m'"%}" +local cyan="%{"$'\033[00;36m'"%}" + +local bgreen="%{"$'\033[03;32m'"%}" +local bcyan="%{"$'\033[03;36m'"%}" + +local bold="%{"$'\033[01;39m'"%}" +local norm="%{"$'\033[00m'"%}" + +setopt PROMPT_SUBST +autoload -Uz add-zsh-hook + +#source /home/qgodefro/dotfiles/zshrc.sh +source ~/hosting-run-scripts/rc-files/ovhrc + +export PS1="${bold}${bgreen}%n${yellow} â—‹ ${bcyan}%m ${norm}[${magenta}%~${norm}]${norm}${norm} %# ${norm}" +export RPROMPT='$(git_super_status) ${norm}(%*) (%(?.${green}0.${red}%?)${norm})${norm}' + +## don't ask me 'do you wish to see all XX possibilities' before menu selection +LISTPROMPT='' + +## SPROMPT - the spelling prompt +SPROMPT='zsh: correct '%R' to '%r' ? ([Y]es/[N]o/[E]dit/[A]bort) ' + +########################################################################### + +#known hosts completion +hosts=( $(cat /etc/hosts | grep -v "^#" | awk '{print $1}'| cut -d"," -f1), $(cat $HOME/.ssh/known_hosts | awk '{print $1}'| cut -d"," -f1)) +zstyle ':completion:*' hosts $hosts + +## add colors to completions +zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS} + +## find all suid files +suidfind () +{ ls -l /**/*(su0x) } + +# Push the former directory in the pile when we use 'cd' +setopt auto_pushd +# Ignore repetition in the pile +setopt pushd_ignore_dups +# Do not display pile after a 'pushd' or 'popd' +setopt pushd_silent +# 'pushd' without given arguments = 'pushd $HOME' +setopt pushd_to_home + +# Ask confirmation when mass deleting +unsetopt rm_star_silent + +eval "$(dircolors -b $HOME/.myenv/dircolors.256dark)" + +### DIRCOLORS ### +# enable color support of ls and also add handy aliases +if [ "$TERM" != "dumb" ]; then + [ -e "$HOME/.myenv/dircolors" ] && DIR_COLORS="$HOME/.myenv/dircolors" + [ -e "$DIR_COLORS" ] || DIR_COLORS="" + eval "`dircolors -b $DIR_COLORS`" +fi + + +########################################################################## +#Alias alias ... + +# alias expend +alias sudo='sudo ' + +alias ls='ls --classify --tabsize=0 --literal --color=auto --show-control-chars --human-readable' +alias l='ls' +alias ll='ls -ahl' + +# autocorrect +alias sl='ls' +alias ms='ls' +alias lq='ls' +#alias sm='ls' +alias ql='ls' + +alias xs='cd' +alias vf='cd' + +############ + +alias h='history' + +#upgrading piss me off +alias upgrade='apt-get update && apt-get upgrade && apt-get clean' + +alias man='man -P most' + +# changing keymap quickly +alias fr='setxkbmap fr' +alias us='setxkbmap us' +alias 1='fr' +alias 2='us' +alias 3='ru' + +# Command to compress/uncompress files to/from tar.gz quickly +alias ctz='tar cfvz' +alias xtz='tar zxvf' +alias xtj='tar jxvf' + +alias df='df --human-readable' +alias du='du --human-readable' + +alias rwin='rdesktop -g 1400x900 windesk' + +alias sr='ssh -l root' +#alias ssh='ssh -2 -C -c blowfish' +alias cgrep="grep -n --color" +alias show="ls | grep --color $1" + +alias p='popd' + +#Opening specific files with adapted software +alias -s tex=vim +alias -s c=vim +alias -s com=w3m +alias -s fr=w3m +alias -s org=w3m +alias -s html=w3m + +alias er="shred -u -z -n 25 " +alias more=less +# Special functions +################################################### + +needed() { + objdump -p $1 | grep NEEDED | awk '{print $2;};' +} + +status() { + print "" + print "Date..: "$(date "+%Y-%m-%d %H:%M:%S")"" + print "Shell.: Zsh $ZSH_VERSION (PID = $$, $SHLVL nests)" + print "Term..: $TTY ($TERM), $BAUD bauds, $COLUMNS x $LINES cars" + print "Login.: $LOGNAME (UID = $EUID) on $HOST" + print "System: $(cat /etc/[A-Za-z]*[_-][rv]e[lr]*)" + print "Uptime:$(uptime)" + print "" +} + +# searching piss me off too +s(){ + apt-cache search $1 $2 $3 +} + +# See below... +i(){ + apt-get install $1 $2 $3 +} + +z0() { + export TERM=xterm ; ssh qgodefro@z3.ovh.net -t -- root@$1 ; export TERM=rxvt-unicode +} + +z3() { + ssh qgodefro@z3.ovh.net -t -- qgodefro@$1 +} + +mongs() { + ssh qgodefro@z3.ovh.net -t -- root@mon-gs.ovh.net +} + +mongs2() { + ssh qgodefro@z3.ovh.net -t -- qgodefro@mon-gs2.ovh.net +} + +mutu71() { + ssh qgodefro@z3.ovh.net -t -- root@mutubackup71-10g-rbx.ovh.net +} + +mutu64() { + ssh qgodefro@z3.ovh.net -t -- root@mutubackup64-10g-rbx.ovh.net +} + +qgodefro() { + ssh root@gw01.admings.net -p 10106 +} + +mpsgw() { + ssh root@5.135.111.53 +} + +sm() { + ssh -i /home/qgodefro/.ssh/id_rsa_sm qgodefro@213.186.33.101 -t -- +} + +ptsapi() { + export TERM=xterm ; ssh -i /home/qgodefro/.ssh/id_rsa_sm qgodefro@213.186.33.101 -t -- gs@10.15.21.1 ; export TERM=rxvt-unicode-256color +} + +ptsmozg() { + export TERM=xterm ; ssh -i /home/qgodefro/.ssh/id_rsa_sm qgodefro@213.186.33.101 -t -- robot-gs@10.15.21.13 ; export TERM=rxvt-unicode-256color +} + +meltingpot() { + export TERM=xterm ; ssh -i /home/qgodefro/.ssh/id_rsa_sm qgodefro@213.186.33.101 -t -- gs@mozg-meltingpot ; export TERM=rxvt-unicode-256color +} + +sdev() { + export TERM=xterm ; ssh -i /home/qgodefro/.ssh/id_rsa_sm qgodefro@213.186.33.101 -t -- qgodefro@qgodefro.sdev ; export TERM=rxvt-unicode-256color + +} + +bigdata() { + export TERM=xterm ; ssh -i /home/qgodefro/.ssh/id_rsa_sm qgodefro@213.186.33.101 -t -- bigdata@mozg-bigdata ; export TERM=rxvt-unicode-256color +} + +alias prestaadminca='z0 192.99.134.113' +alias prestaadminfr='z0 178.32.71.66' + +alias ws='python -m SimpleHTTPServer 1024' + +alias recordscreen='ffmpeg -video_size 1920x1080 -framerate 25 -f x11grab -i :0.0+1280,0' + +alias meteo='curl -4 http://wttr.in/Lyon' + +goo() { + Q="$@"; + GOOG_URL="http://www.google.com/search?q="; + AGENT="Mozilla/4.0"; + stream=$(curl -A "$AGENT" -skLm 10 "${GOOG_URL}\"${Q/\ /+}\"" | grep -oP '\/url\?q=.+?&' | sed 's/\/url?q=//;s/&//'); echo -e "$ + {stream//\%/\x}" +} + +prettynetstat() { + netstat -an | grep ESTABLISHED | awk '{print $5}' | awk -F: '{print $1}' | sort | uniq -c | awk '{ printf("%s\t%s\t",$2,$1) ; for (i =0; i < $1; i++) {printf("*")}; print "" }' +} + +prettyroute() { + route -Cn | grep eth0 | awk '{print $2}' | awk -F: '{print $1}' | sort | uniq -c | awk '{ printf("%s\t%s\t",$2,$1) ; for (i = 0; i < $1; i++) {printf("*")}; print "" }' +} + +established() { + for i in `netstat -an | grep ESTABLISHED | awk '{print $5}' | awk -F: '{print $1}' | sort | uniq`; + do + whois $i | grep -i netname | awk '{printf("%s : ",$2)}' + echo $i + done +} + +rfc () { curl -s http://www.ietf.org/rfc/rfc$1.txt | less } + +bindkey '^[[3~' delete-char # Del + diff --git a/Makefile.docker b/Makefile.docker index a3dd385..c9cdc89 100644 --- a/Makefile.docker +++ b/Makefile.docker @@ -8,7 +8,7 @@ build: Dockerfile run: docker run --rm -ti $IMAGE:$VERSION - + push: Dockerfile docker push $IMAGE:$VERSION diff --git a/bash/bash_aliases b/bash/bash_aliases index da36db8..e500bbd 100644 --- a/bash/bash_aliases +++ b/bash/bash_aliases @@ -14,10 +14,13 @@ alias flip="shuf -i 0-1 -n 1 | sed -e 's/1/Pile/' -e 's/0/Face/'" alias dl="wget -r -k -T 5 -t 2 -U 'Mozilla/5.0 (X11; Linux x86_64; rv:35.0) Gecko/20100101 Firefox/35.0' " alias paste="pastebin -m -n Hactar" alias pass="tr -dc A-Za-z0-9_ < /dev/urandom | head -c 20 | xargs" -alias os="openstack" alias oss="openstack server" alias osc="openstack console log show" alias public="z3 root@public01.infra.gs.ovh.net" alias melt="sm3 gs@mozg-meltingpot.ovh.ha.ovh.net" alias hr-admin="z3 root@hr-admin.rungs.ovh" alias mis="sm3 mozg-mis.ovh.ha.ovh.net" +alias thot_reseller-robot-preprod='thot '\''wss://thot.ovh.com/tail/?tk=e4bdf746-d041-41d3-81a5-7e4629d3e507'\' +alias thot_cloudweb-robot-preprod='thot '\''wss://thot.ovh.com/tail/?tk=c89ec346-ce0d-4504-b69b-b3c216e91385'\' +alias m5='sm3 ovh@mozg-mutu5.ovh.ha.ovh.net' +alias gw01='z3 gw01.infra.mps.gs.ovh.net' diff --git a/bin/haste b/bin/haste new file mode 100755 index 0000000..bb1a5f9 --- /dev/null +++ b/bin/haste @@ -0,0 +1,4 @@ +#!/bin/bash +_SERVER="https://paste.cresi.be" +a=$(cat); +curl -X POST -s -d "$a" ${_SERVER}/documents | awk -F '"' '{print "'${_SERVER}'/"$4}'; \ No newline at end of file