Skip to content

Instantly share code, notes, and snippets.

Yann ILAS StrangeBubble

View GitHub Profile
View gist:1137a17fb769eb9caee8b4b913cbeb2d
# -*- encoding: utf-8; py-indent-offset: 4 -*-
# vim: :set ts=8 et sw=4 sts=4
import glob, sys
def CleanTmpDir():
folder = '/tmp'
import os
for the_file in os.listdir(folder):
View Divers
## sed fichier /etc/hosts
sed -n '/HostsBegin/,/HostsEnd/p' /etc/hosts|\
egrep -v '^[[:space:]]*$|^#' |\
while read ipaddr hn x; do
if ! ping -c 2 -W 2 $ipaddr >/dev/null 2>&1; then
echo $ipaddr $hn unreachable
StrangeBubble / VPN_IPsec_PSK_noNAT.markdown
Created Feb 24, 2016
VPN IPsec PSK between 2 VM separated by a router
View VPN_IPsec_PSK_noNAT.markdown
[root@vm-2-100 ~]# cat /etc/ipsec.conf
# /etc/ipsec.conf - Openswan IPsec configuration file
# Manual:     ipsec.conf.5
# Please place your own config files in /etc/ipsec.d/ ending in .conf

version 2.0     # conforms to second version of ipsec.conf specification
View tmux_cheatsheet.markdown

tmux cheatsheet

As configured in my dotfiles.

start new:


start new with session name:

View parse csv, json, xml
# csv
import csv
file_csv = ''
csvfile = open(file_csv, 'rb')
reader = csv.reader(csvfile)
for row in reader:
print row
import csv
import os
scsi = os.popen('lsscsi').read().rstrip().split('\n')
for l in [s.split() for s in scsi]:
print l[0], l[-1]
View reconstruct_volid
==== IAAS / Q5 ====
ca = i.config.cloudApiConnection.find('main')
volid = 'c0a12a612e5946ea'
ca.disk.find(id = volid)
volguid = ca.disk.find(id = volid)['result'][0]
View restart_storage_node
## Before restart
mkdir /opt/data/ramdisk_backup
rsync -av /mnt/dss/ramdisk/scocache /opt/data/ramdisk_backup
rsync -av /mnt/dss/ramdisk/tlogs /opt/data/ramdisk_backup
## Reboot
## After restart
rsync -av /opt/data/ramdisk_backup/scocache /mnt/dss/ramdisk
You can’t perform that action at this time.