Skip to content

Instantly share code, notes, and snippets.

View elyezer's full-sized avatar

Elyézer Rezende elyezer

View GitHub Profile
@elyezer
elyezer / vm_provisioning.py
Created August 15, 2014 19:20
Example of VM Provisioning API for Robottelo
# Test body
with VirtualMachine(ram=512, cpu=1, os='rhel7') as vm:
stdout, stderr = vm.command('echo "hellow world"')
vm.ip_addr
vm.hostname
# one vm for a test case
class ClientTestCase(UnitTest):
def setUp(self):
self.vm = VirtualMachine(...)
vm = VirtualMachine()
def create_mock():
vm._created = True
vm.ip_addr = '192.168.0.1'
with patch.object(vm, 'create', side_effect=create_mock):
vm.create()
vm.run('ls')
@elyezer
elyezer / start_vnc.sh
Last active August 29, 2015 14:06 — forked from dimacus/start_vnc.sh
#!/bin/bash -e
# allow change to pass-in display argument
DISPLAY=$1
: ${DISPLAY:=:1}
export DISPLAY
echo "Starting VNC server"
vncserver ${DISPLAY} -geometry 1280x1024
@elyezer
elyezer / stop_vnc.sh
Last active August 29, 2015 14:06 — forked from dimacus/stop_vnc.sh
#!/bin/bash +e
# allow change to pass-in display argument
DISPLAY=$1
: ${DISPLAY:=:1}
export DISPLAY
echo "=== network before $0 ==="
netstat -na | grep "LISTEN "
echo
# Without the improvements
test_something():
try:
entity = make_entity()
except CLIFactoryError as err:
self.fail(err)
result = Entity.list()
assert result.return_code == 0
assert len(result.stderr) == 0
import types
class HammerMeta(type):
def __new__(cls, name, bases, attrs):
for key, value in attrs.items():
if isinstance(value, HammerCommand):
value.__name__ = key # to correctly allow inspecting methods
if value.command is None:
# syntatic sugar to avoid repeating the command
import unicodedata
with file('unicode_catalog.txt', 'w') as f:
for i in xrange(int(0x10FFFF)):
try:
f.write('{}->{}\n'.format(hex(i), unicodedata.category(unichr(i))))
except:
pass

Keybase proof

I hereby claim:

  • I am elyezer on github.
  • I am elyezer (https://keybase.io/elyezer) on keybase.
  • I have a public key whose fingerprint is BDBA 6625 8F1F F560 0CB5 3552 09C2 A753 0DC5 EE4E

To claim this, I am signing this object:

import re
import subprocess
from robottelo.common.helpers import bz_bug_is_open
OUTPUT_REGEX = re.compile(r'.*:\s+@.*, (\d+)\)')
skip_count = 0
@elyezer
elyezer / virtualbox_kmod_sign.md
Last active September 4, 2015 22:51
VirtualBox in Secure Boot Linux

Create the certificate. Replace Org Name with something more appropriate.

mkdir ~/.certs
openssl req -new -x509 -newkey rsa:2048 -keyout ~/.certs/cert.key -outform DER -out ~/.certs/cert.der -nodes -days 36500 -subj "/CN=Org Name/"

After that import the certificate

sudo mokutil --import ~/.certs/cert.der