Skip to content

Instantly share code, notes, and snippets.

View sxd's full-sized avatar

Jonathan Gonzalez V. sxd

  • EnterpriseDB
  • Prato, Italy
  • X @sxd
View GitHub Profile
FILE1=$1
FILE2=$2
if [[ -z "$FILE1" ]] || [[ -z "$FILE2" ]] ; then
echo "Must add two different config files"
exit 1
fi
#!/bin/bash
set -e
HOST=$1
DEST=$2
DATE=`date +%Y-%m-%d`
influxd backup -host $HOST:8088 $DEST/$DATE/metadata/
if ($cookie_COOKIE-NAME ~ "value_1") {
# Do some crazy stuff here
}
if ($cookie_COOKIE-NAME ~ "value_2") {
# Do some other crazy stuff here
}
#!/bin.sh
# We get all de scrubs
function get_pg_scrub_dates {
ceph pg dump | awk '$1 ~ /[0-9a-f]+\.[0-9a-f]+/ {print $22, $23, $1}' | sort > /tmp/scrub_dates
}
# We start running the dep scrub
#!/bin/sh
NAME_CACHE=$1
function cache_activate {
RES=`touch /var/run/cache_activated`
if [ $? -eq 0 ]; then
#!/bin/bash
DOMAIN=$1
DNS_SERVERS=("8.8.8.8" "8.8.4.4")
for DNS in ${DNS_SERVERS[@]}; do
ANSWER=(`dig @$DNS A $DOMAIN | grep -A 1 "ANSWER SECTION" | grep $DOMAIN | awk '{print $2" "$5}'`)
echo $DNS" -> TTL "${ANSWER[0]}" -> "${ANSWER[1]}
done;

Keybase proof

I hereby claim:

  • I am sxd on github.
  • I am sxd (https://keybase.io/sxd) on keybase.
  • I have a public key ASAbTEMbk9g2AhKfXbZVdknc8cDSh7C6ua61fWaIG1YPdAo

To claim this, I am signing this object:

import os
import re
import subprocess
def size_suffix(bytes):
convertion = [
(1024 ** 5, 'P'),
(1024 ** 4, 'T'),
(1024 ** 3, 'G'),
(1024 ** 2, 'M'),
@sxd
sxd / gist:cea9b07e3514e9f5feb9
Created December 18, 2014 15:55
python convert
def size_suffix(bytes):
convertion = [
(1024 ** 5, 'P'),
(1024 ** 4, 'T'),
(1024 ** 3, 'G'),
(1024 ** 2, 'M'),
(1024 ** 1, 'K'),
(1024 ** 0, 'B'),
]
@sxd
sxd / iozone_tests
Last active August 29, 2015 14:04
iozone -a > output_iozone
cp /usr/share/doc/iozone3/examples/gengnuplot.sh .
cp /usr/share/doc/iozone3/examples/Generate_Graphs .
wget http://theshire.emacs.cl/~zeus/iozone/gnu3d.dem
bash Generate_Graphs output_iozone
mkdir iozone