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 / 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

@omaciel
omaciel / books.json
Last active October 6, 2015 00:15
Helper to generate a RST-formatted article stub for my monthly blog post about books.
{
"2015": {
"october": {
"read": [
{
"author": "John Steinbeck",
"title": "The Moon Is Down"
}
],
"reading": [
@omaciel
omaciel / Reset.md
Created June 15, 2015 12:45
Resetting Mac OS X
  • reboot the system while holding the command and s keys together.
  • once you're dropped to a shell prompt, type the two commands displayed on the screen.
  • Still using the command prompt, type rm /var/db/.applesetupdone and press the return key
  • Reboot the system by typing rebootand press the return key
@omaciel
omaciel / populate.py
Last active April 9, 2018 11:55
Populate a Satellite 6 with NailGun.
import random
import re
from nailgun import client
from nailgun import entity_mixins
from nailgun.config import ServerConfig
from nailgun.entities import (
ActivationKey,
ContentView,
ContentViewVersion,
@omaciel
omaciel / keybase.md
Created February 28, 2015 18:27
keybase.md

Keybase proof

I hereby claim:

  • I am omaciel on github.
  • I am omaciel (https://keybase.io/omaciel) on keybase.
  • I have a public key whose fingerprint is 6A90 A6E5 00C9 DBEA E8D8 D49C 8CE0 B539 CD03 D583

To claim this, I am signing this object:

@omaciel
omaciel / install_sam.sh
Last active August 29, 2015 14:13
Install SAM on EC2
#!/usr/bin/env sh
# Install SAM on to an Amazon EC2 instance. Make sure to set the variables
# in the head of this script.
set -o errexit -o nounset
# Default user for EC2 images is "ec2-user", so switch to "root"
sudo su -
# By default the EC2 instance's hostname matches its internal hostname. The
@omaciel
omaciel / install_satellite6.sh
Last active November 12, 2020 07:14
Install Satellite 6 on EC2
#!/usr/bin/env sh
# Install Satellite 6 on to an Amazon EC2 instance. Make sure to set the variables
# in the head of this script.
set -o errexit -o nounset
# Default user for EC2 images is "ec2-user", so switch to "root"
sudo su -
# By default the EC2 instance's hostname matches its internal hostname. The