tmux Start a new session
tmux attach Re-attach a detached session
tmux attach -d Re-attach a detached session (and detach it from elsewhere)
Pane Control
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 |
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 |
# 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 |
#!/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 |
#!/bin/bash -e | |
# allow change to pass-in display argument | |
DISPLAY=$1 | |
: ${DISPLAY:=:1} | |
export DISPLAY | |
echo "Starting VNC server" | |
vncserver ${DISPLAY} -geometry 1280x1024 |
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') |
# 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(...) |
How to configure a jenkins slave. On the slave setup a jenkins
user and add the master SSH public key on the authorized_keys
file.
useradd -m jenkins
su - jenkins -c "mkdir /home/jenkins/.ssh"
su - jenkins -c "chmod 700 ~/.ssh"
su - jenkins -c "chmod 600 ~/.ssh/*"
su - jenkins -c "restorecon -R -v ~/.ssh"
su - jenkins -c "vim /home/jenkins/.ssh/authorized_keys"
#!/bin/bash | |
export SELENIUM_HOST=ondemand.saucelabs.com | |
export SELENIUM_PORT=4444 | |
export SELENIUM_PLATFORM=Linux | |
export SELENIUM_BROWSER=firefox | |
export SELENIUM_VERSION=23 | |
export SAUCE_USER_NAME=<username> | |
export SAUCE_API_KEY=<api_key> | |
export SELENIUM_DRIVER="sauce-ondemand:?os=$SELENIUM_PLATFORM&browser=$SELENIUM_BROWSER&browser-version=$SELENIUM_VERSION&username=$SAUCE_USER_NAME&access-key=$SAUCE_API_KEY" |