Skip to content

Instantly share code, notes, and snippets.

View omaciel's full-sized avatar
🎯
Learning

Og Maciel omaciel

🎯
Learning
View GitHub Profile
@omaciel
omaciel / travis.yml
Created October 26, 2017 16:22
Example for using Google Chrome via Travis for UI testing
language: python
python:
- 3.5
services:
- postgresql
addons:
postgresql: '9.4'
chrome: stable
before_install:
- wget https://chromedriver.storage.googleapis.com/2.33/chromedriver_linux64.zip
@omaciel
omaciel / README.md
Created May 11, 2017 18:19
Script that updates a Bugzilla flag for issues that have been closed.
$ python update_flags.py
Updating Bugzilla: 1192486
Updating Bugzilla: 1253941
Updating Bugzilla: 1296242
Updating Bugzilla: 1437719
Updating Bugzilla: 1440955
Updating Bugzilla: 1358176
Updating Bugzilla: 1277063
Updating Bugzilla: 1192245
@omaciel
omaciel / notes.rst
Last active January 17, 2017 22:07
Notes so I don't forget stuff

Notes

Emacs

Weird characters displayed on terminal inside Emacs

First add the following lines to your .emacs file:

@JacobCallahan
JacobCallahan / genvirt.py
Last active February 4, 2021 16:27
generate virt-who esx json data
import argparse
import json
import uuid
def gen_json(hypervisors, guests):
virtwho = {}
hypervisor_list = []
for i in range(hypervisors):
guest_list = []
@omaciel
omaciel / update_approval.py
Last active April 28, 2019 10:25
Scripts that use Pylarion
import multiprocessing
import ssl
from pylarion.work_item import TestCase
# Avoid SSL errors
ssl._create_default_https_context = ssl._create_unverified_context
items = TestCase.query('project.id:RHSAT6', fields=['status', 'author', 'approvals'])
@elyezer
elyezer / sample_file.py
Created January 5, 2016 15:34
Using Python memory_profiler
$ pip install memory_profiler psutil
$ python -m memory_profiler sample_file.py
@omaciel
omaciel / virtualenv.rst
Last active July 27, 2016 20:22
How to create and use Python virtual environments for development

Creating a Python Virtual Environment

Install virtualenv and virtualenvwrapper

$ sudo pip install virtualenv virtualenvwrapper

Add the following lines to your $HOME/.bashrc

@omaciel
omaciel / install_pulp.sh
Created September 24, 2015 18:43
Script to install and configure a Pulp Server onto a RHEL 6/7 x86_64 system.
# Script to install and configure a Pulp Server onto a RHEL 6/7 x86_64 system.
# The official documentation can be found here:
# https://pulp.readthedocs.org/en/latest/user-guide/installation.html
export USER_NAME=""
export USER_PASSWORD=""
export POOLID=""
# Handles system services according to the operating system version
function handle_service {
@omaciel
omaciel / httpie_pulp.md
Last active September 19, 2015 22:18
Playing with HTTPIE and the Pulp Rest API

Using HTTPIE with Pulp

Make sure to install httpie

Create a new repository named animals:

http --verify=no -a admin:admin POST https://localhost/pulp/api/v2/repositories/ id=animals
HTTP/1.1 201 Created
Connection: Keep-Alive
@omaciel
omaciel / tips_and_tricks.md
Last active August 31, 2021 14:54
A collection of Python tips and tricks

Flatten a dictionary

  In [1]: k = {'name': 'Og Maciel', 'age': 40, 'mansions': '', 'kids': 3}
  In [2]: ' '.join("--{!s}={!r}".format(key,val) for (key,val) in k.iteritems())
  "--age=40 --kids=3 --name='Og Maciel' --mansions=''"

Run Unittest TestCase from IPython