My #vimrc

" Configuration file for vim
set modelines=0        " CVE-2007-2438

" Normally we use vim-extensions. If you want true vi-compatibility
" remove change the following statements
set nocompatible   " Use Vim defaults instead of 100% vi compatibility
set backspace=2        " more powerful backspacing

" Don't write backup file if vim is being called by "crontab -e"
au BufWrite /private/tmp/crontab.* set nowritebackup nobackup
" Don't write backup file if vim is being called by "chpass"
au BufWrite /private/etc/pw.* set nowritebackup nobackup


"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => VIM user interface
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Set 7 lines to the cursor - when moving vertically using j/k
set so=7

" Turn on the WiLd menu
set wildmenu

" Ignore compiled files
set wildignore=*.o,*~,*.pyc

"Always show current position
set ruler
" When searching try to be smart about cases 
set smartcase

" Highlight search results
set hlsearch

" Makes search act like search in modern browsers
set incsearch

" Don't redraw while executing macros (good performance config)
set lazyredraw

" For regular expressions turn magic on
set magic

" Show matching brackets when text indicator is over them
set showmatch
" How many tenths of a second to blink when matching brackets
set mat=2

" No annoying sound on errors
set noerrorbells
set novisualbell
set t_vb=
set tm=500
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Colors and Fonts
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Enable syntax highlighting
syntax enable

colorscheme desert
set background=dark

" Set extra options when running in GUI mode
if has("gui_running")
    set guioptions-=T
    set guioptions+=e
    set t_Co=256
    set guitablabel=%M\ %t
endif

" Set utf8 as standard encoding and en_US as the standard language
set encoding=utf8
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Text, tab and indent related
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Use spaces instead of tabs
set expandtab

" Be smart when using tabs 😉
set smarttab

" 1 tab == 4 spaces
set shiftwidth=2
set tabstop=2

" Linebreak on 500 characters
set lbr
set tw=500

#Jenkins and #fabric script to execute commands remotely

tee /tmp/fabfile.py <<EOF
from fabric.api import *
import wget

env.hosts     = open('hostfile', 'r').readlines()
env.user      = open('userfile', 'r').readline().strip()
env.password  = open('passwordfile', 'r').readline().strip()


def vm_run_cmd(cmd, priv=True):
    if priv is True:
        sudo(cmd)
    else:
        run(cmd)


def vm_exec_remote_script(uri, privt=False):
        temp_f = wget.download(uri)
        inf = open(temp_f)
        vm_run_cmd(inf.read().replace('\n', ' '), privt)
        inf.close()
EOF

tee /tmp/hostfile <<EOF
localhost
EOF

tee /tmp/userfile <<EOF
xxxxxx
EOF

tee /tmp/passwordfile <<EOF
xxxxxx
EOF

cd /tmp/
virtualenv venv
source venv/bin/activate
fab vm_exec_remote_script:'https://raw.githubusercontent.com/Flukas88/CodeUtils/master/hello.bash',privt=$sa
fab vm_run_cmd:"$cmdline",priv=$sa
deactivate

#Packer and #VirtualBox for #Vagrant: the easy life

{
    "variables": {
        "ssh_name": "test",
        "ssh_pass": "test",
        "hostname": "testbox"
    },

    "builders": [{
        "type": "virtualbox-iso",
        "guest_os_type": "Ubuntu_64",

        "vboxmanage": [
            ["modifyvm", "{{.Name}}", "--vram", "32"], 
        ],

        "disk_size" : 15000,

        "iso_url": "",
        "iso_checksum": "",
        "iso_checksum_type": "md5",

        "ssh_username": "{{user `ssh_name`}}",
        "ssh_password": "{{user `ssh_pass`}}",
        "ssh_wait_timeout": "20m",

        "shutdown_command": "echo {{user `ssh_pass`}} | sudo -S shutdown -P now",

        "boot_command" : [
            "<esc><esc><enter><wait>",
            "/install/vmlinuz noapic ",
            "preseed/url=https://raw.githubusercontent.com/Flukas88/CodeUtils/master/preseed.cfg ",
            "debian-installer=en_US auto locale=en_US kbd-chooser/method=us ",
            "hostname={{user `hostname`}} ",
            "fb=false debconf/frontend=noninteractive ",
            "keyboard-configuration/modelcode=SKIP keyboard-configuration/layout=USA ",
            "keyboard-configuration/variant=USA console-setup/ask_detect=false ",
            "initrd=/install/initrd.gz -- <enter>"
        ]
    }]
 ,
  "post-processors": [
    "vagrant"
]
}

#Redis and connected clients

#!/bin/bash

HOST=$1
PORT=$2
PGNAME=`basename $0`

if (( $# < 2)); then
    echo "usage: $PGNAME host port"
    exit 55
fi

for hostn in echo $(redis-cli -h $HOST -p $PORT client list | cut -d ' ' -f2 | cut -d'=' -f 2 |  cut -d':' -f 1 | sort -u); 
do     
    echo "$hostn is $(host $hostn | cut -d' ' -f5)" ; 
done | grep -v NXDOMAIN | cut -d ' ' -f 1 | egrep -v '[0-9]{1,4}.[0-9]{1,4}.[0-9]{1,4}.[0-9]{1,4}' | sort -u

#Google-Fu

site:
inurl:
allinurl:
intitle:
allintitle:
cache:
filetype:
link:
related:
info:
intext:

#Zimbra and strong ciphers

zmprov mcf zimbraReverseProxySSLCiphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128:AES256:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!MD5:!PSK:!RC4'