Skip to content

Instantly share code, notes, and snippets.

View sthirugn's full-sized avatar

sthirugn sthirugn

View GitHub Profile
@omaciel
omaciel / README.md
Last active January 22, 2016 20:01
Script to create 'fake' Content Hosts via Satellite's Rest API.

Script to create 'fake' Content Hosts via Satellite's Rest API.

The script below will create 'fake' Content Hosts for a Satellite 6 system using its Rest API.

Furthermore, for every Content Host created, a Subscription will be added.

The following assumptions are made:

  • You have a fully installed and configured Satellite 6 system;
import pytest
import unittest
from nose.plugins.attrib import attr
class MyTestCase(unittest.TestCase):
@pytest.mark.crud
def test_pytest_crud(self):
pass
@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

@snobear
snobear / cancel-pulp-tasks.sh
Last active June 21, 2019 12:54
script to cancel all pulp tasks
#!/bin/bash
#
# Cancel all pulp tasks that are just in a specifiedstate
tmpfile=/tmp/tasks
read -p "Enter task state to kill, e.g. Waiting: " ans
echo ""
if [ "${#ans}" -gt 0 ]
then
@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 / 00-readme.md
Last active January 20, 2025 14:04
Create Host Collection and Activation Keys, associating them as well as adding all available subscriptions to the Activation Key for a scenario where you have enabled and synchronized RHEL 5/6/7 i386, x86_64, ppc64 and s390x repositories.

Instructions

Please update 01-credentials.sh to include your credentials, and run these scripts in the order shown below:

  • 01-credentials.sh
  • 02-os-versions.sh
  • 03-initial-configuration.sh
  • 04-enable-content.sh
  • 05-content-views.sh
@omaciel
omaciel / install_sam_on_ec2.sh
Last active August 29, 2015 14:01
Install SAM from CDN on EC2
subscription-manager register --force --username=$USERNAME --password=$PASSWORD --autosubscribe
yum repolist
yum-config-manager --disable rhui*
yum-config-manager --disable rhel-ha*
yum-config-manager --disable rhel-rs*
yum-config-manager --disable rhel-lb*
yum-config-manager --disable rhel-6-server-cf-tools-1-rpms
yum-config-manager --disable *ose*
yum-config-manager --disable *realtime*
yum-config-manager --disable *rhs*
@elyezer
elyezer / bootstrap.sh
Last active August 29, 2015 13:58
Provision Fedora 20 to run vagrant boxes based on libvirt provider
# Install required packages
sudo yum install @virtualization
sudo systemctl start libvirtd
# Install vagrant
wget https://dl.bintray.com/mitchellh/vagrant/vagrant_1.5.2_x86_64.rpm
sudo yum install vagrant_1.5.2_x86_64.rpm
vagrant plugin install vagrant-libvirt
# Testing the installation with katello-deploy script
@adrianratnapala
adrianratnapala / SSH-X11-Forwarding.md
Created October 29, 2011 17:43
A note on X11-Forwarding in SSh.

I used to think that

ssh -X me@some.box

"just bloody worked". However this might not work - ssh must play ball on both sides of the link. On the remote (ssh server, X client) sshd must sit behind some port, tell Xlib to send X11 requests to it and then forward them back to you the X server (where the ssh client is). If the remote box is locked down to prevent this, you will get:

X11 forwarding request failed on channel 0

as part of an otherwise working login. As it happens, I am the admin of the remote box in question, so I followed the ArchWiki and went to /etc/ssh/sshd_config and uncommented