Skip to content

Instantly share code, notes, and snippets.

View joubertredrat's full-sized avatar

Joubert RedRat joubertredrat

View GitHub Profile
2015-01-07 01:42:45.747+0000: starting up
LC_ALL=C PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin QEMU_AUDIO_DRV=none /usr/libexec/qemu-kvm -name instance-00000006 -S -machine pc-i440fx-rhel7.0.0,accel=kvm,usb=off -cpu SandyBridge,+erms,+smep,+fsgsbase,+rdrand,+f16c,+osxsave,+pcid,+pdcm,+xtpr,+tm2,+est,+smx,+vmx,+ds_cpl,+monitor,+dtes64,+pbe,+tm,+ht,+ss,+acpi,+ds,+vme -m 512 -realtime mlock=off -smp 1,sockets=1,cores=1,threads=1 -uuid 74076b2b-b195-4506-8b89-b86023e390c6 -smbios type=1,manufacturer=Fedora Project,product=OpenStack Nova,version=2014.2.1-1.el7.centos,serial=2d406ad2-c45e-4e1b-86f1-1fa56e394d32,uuid=74076b2b-b195-4506-8b89-b86023e390c6 -no-user-config -nodefaults -chardev socket,id=charmonitor,path=/var/lib/libvirt/qemu/instance-00000006.monitor,server,nowait -mon chardev=charmonitor,id=monitor,mode=control -rtc base=utc,driftfix=slew -no-kvm-pit-reinjection -no-hpet -no-shutdown -boot strict=on -device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 -drive file=/var/lib/nova/instances/7407
@joubertredrat
joubertredrat / default.conf
Created January 8, 2015 19:52
Default apache to access Horizon internal
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
ProxyPassMatch ^/static/(.*)$ http://10.0.3.152/static/$1
ProxyPass / http://10.0.3.152/horizon/
ProxyPassReverse / http://10.0.3.152/horizon/
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
@joubertredrat
joubertredrat / owa_tracker.php
Created January 12, 2015 13:17
Owa test tracking by image
<?php
/*
Example usage: <img src="http://owa.yourdomain.com/owa_tracker.php?id=6f2a0582ec2512421a91b2ce26164c3b" alt="owa tracker">
*/
if (isset($_GET['id']))
{
require_once(__DIR__.'owa_php.php');
$owa = new owa_php();
$owa->setSiteId($_GET['id']);
#!/bin/sh
# Clean file and dirs more than 3 days old in /tmp nightly
# http://askubuntu.com/questions/20783/how-is-the-tmp-directory-cleaned-up
/usr/bin/find /tmp -type f -atime +2 -mtime +2 |xargs /bin/rm -f &&
/usr/bin/find /tmp -type d -mtime +2 -exec /bin/rm -rf '{}' \; &&
/usr/bin/find /tmp -type l -ctime +2 |xargs /bin/rm -f &&
/usr/bin/find -L /tmp -mtime +2 -print -exec rm -f {} \;
<?php
/**
* Valida os tipos de dados recebidos no método __set().
*
* @param mixed $valor Valor a ser validado.
* @param string $tipo Tipo de dado a ser validado.
* @return bool Retorna true caso seja um tipo válido ou false caso contra.
*/
public static function validarTipo($valor, $tipo)
{
@joubertredrat
joubertredrat / Usuarios.class.php
Created January 13, 2015 16:51
sohMoleza test
<?php
/**
* Classe de manipulação da tabela usuarios.
*
* @author Joubert <me+github@redrat.com.br>
* @author SohMoleza, revisão $LastChangedRevision:$ <sohmoleza@redrat.com.br>
* @package Core
* @subpackage Classes
* @copyright Copyright (c) 2015, RedRat
* @link https://github.com/joubertredrat/sohmoleza
@joubertredrat
joubertredrat / gist:89532cdf48ba4be86a3e
Last active August 29, 2015 14:14
I don't know if this works, is only a mental mind
mysql listen on 127.0.0.1:13306
mariadb listen on 127.0.0.1:13307
localhost is 127.0.0.1
mysqlhost is 127.0.0.1
mariadbhost is 127.0.0.1
request if localhost:3306 OR 127.0.0.1:3306 = DROP or REFUSE
request if mysqlhost:3306 = REDIRECT or FORWARD to 0.0.0.0:13306
## Loopback for mysql and mariadb
ifconfig lo:1 127.0.0.10 up
ifconfig lo:2 127.0.0.20 up
## Edit /etc/hosts
127.0.0.10 mysqlhost
127.0.0.20 mariadbhost
## Change listen on mysql and mariadb
mysql listen on 127.0.0.1:13306
<RedRat> bom dia a todos
<RedRat> eu sou devel php a pelo menos 6 anos e a mais de 10 sou especialista em infra
<RedRat> vejo que muitos que são sysadmin usa python além do bash para scripting
<RedRat> isto despertou meu interesse para a linguagem, porém, não tenho a mínima ideia de por onde começar
<RedRat> o que seria melhor no meu caso para eu poder começar a estudar com python?
<Rudolf> RedRat: google?
<Rudolf> RedRat: tem muitas aulas no youtube também
<RedRat> Rudolf, sim, porém, neste caso eu gosto de perguntar a pessoas que já são do meio porque elas podem passar informações mais confiáveis
<Rudolf> RedRat: confiabilidade está em www.python.org
<Rudolf> RedRat: a documentação é bem extensa
@joubertredrat
joubertredrat / gist:f27a2bbeed9af217da51
Last active August 29, 2015 14:15
Disk IO benchmark desk
dd if=/dev/zero of=test bs=64k count=16k conv=fdatasync
dd if=/dev/zero of=test bs=1M count=1024 conv=fdatasync
time (dd if=/dev/zero of=/tmp/test bs=64k count=128k > /dev/null; sync)
bonnie++ -d /tmp -r 2048 -u root
fio --randrepeat=1 --ioengine=libaio --direct=1 --gtod_reduce=1 --name=test --filename=test --bs=4k --iodepth=64 --size=4G --readwrite=randrw --rwmixread=75