Skip to content

Instantly share code, notes, and snippets.

Tim Bielawa tbielawa

Block or report user

Report or block tbielawa

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@tbielawa
tbielawa / cd_hacks.sh
Created Sep 17, 2019
Quick directory `cd`/shell hacks
View cd_hacks.sh
# Make a named directory and change immediately into it
#
# pwd -> /tmp/cdhacks
# $ cdmkdir zerocool; pwd -> /tmp/cdhacks/zerocool
function cdmkdir () {
mkdir -p ${1} && cd ${1}
}
# Make a temp directory, add it to the top of the directory stack.
# Immediately switch into it.
View config:print --help
$ ./tools/src/oit.py config:print --help
{'odcs_mode': False, 'ignore_missing_base': False, 'group': None, 'images': (), 'sources': None, 'rpms': (), 'latest_parent_version': False, 'quiet': False, 'disabled': False, 'source': (), 'working_dir': None, 'no_oit_comment': False, 'user': None, 'branch': None, 'wip': False, 'debug': False, 'exclude': (), 'metadata': None, 'stage': False}
Usage: oit.py config:print [OPTIONS]
View config for given images / rpms
Options:
-i, --images NAME Name of group image member to include in operation (all
by default). Can be comma delimited list.
-n, --name-only Just print name of matched configs. Overrides --key
View magic.md

Edit your network and add your domain (<domain name='example.com' localOnly='yes'/>) to the network definition. All of your hosts using this network must have hostnames (hostnamectl set-hostname) within the domain.

sudo virsh net-edit default
<network>
  <name>default</name>
  <uuid>a4879b25-1c92-49d6-986b-e9e2cde27678</uuid>
@tbielawa
tbielawa / sed-with-lang.diff
Created Sep 24, 2013
Fix "RE error: illegal byte sequence" sed errors on OS X 10.7 when working with specially encoded characters. Read more on the blog: http://blog.lnx.cx/?p=403
View sed-with-lang.diff
@@ -2,4 +2,4 @@
# Translate Latin-1 smart quotes and en-dash into UTF-8. There is probably a
# better way to do this.
-LANG=C sed -e s/$'\x92'/$'\xe2\x80\x99'/g -e s/$'\x93'/$'\xe2\x80\x9c'/g -e s/$'\x94'/$'\xe2\x80\x9d'/g -e s/$'\x96'/-/g -e s/$'\xa0'/' '/g -e s/$'\xff'/' '/g
+LANG=C LC_ALL=C sed -e s/$'\x92'/$'\xe2\x80\x99'/g -e s/$'\x93'/$'\xe2\x80\x9c'/g -e s/$'\x94'/$'\xe2\x80\x9d'/g -e s/$'\x96'/-/g -e s/$'\xa0'/' '/g -e s/$'\xff'/' '/g
View test_proxy_facts.py
# Run from here: roles/openshift_facts/library/test_set_proxy_facts.py
"""
Some basic testing of the openshift_facts 'set_proxy_facts' function
"""
from pprint import pprint as pp
import copy
import openshift_facts
View openshift_hosted_routers.json
[
{
"name": "router2",
"replicas": 1,
"serviceaccount": "router",
"namespace": "default",
"stats_port": 1941,
"ports": [
"8080:8080",
"6443:6443"
View example_output.log
$ python ./parse_docker_info.py
Sizes as parsed using bitmath from 'docker info':
{'memtotal_mb': MB(15470.0), 'TotalMemory': GiB(15.11), 'DataSpaceAvailable': GB(43.01), 'DataSpaceTotal': GB(44.43)}
-----------------------
diskleft percent: 96.8039612874%
-----------------------
Sizes as from to_gigabytes:
memtotal_mb 15.47 GB
View junkformatter.py
$ python ./junkformatter.py
{'failed': True,
'msg': 'All objects are not valid. If you are a supported customer please\ncontact Red Hat Support providing the complete output above. If you\nare not a customer please contact users@lists.openshift.redhat.com for\nassistance.',
'results': 'all_invalid',
'state': 'list'}
{'msg': 'All objects are not valid. If you are a supported customer please\ncontact Red Hat Support providing the complete output above. If you\nare not a customer please contact users@lists.openshift.redhat.com for\nassistance.', 'failed': True, 'state': 'list', 'results': 'all_invalid'}
View fixup_cert_parsing_tests.patch
From 21713422e20dd80e24a758ff4c700da2e4c1c3b8 Mon Sep 17 00:00:00 2001
From: Tim Bielawa <tbielawa@redhat.com>
Date: Tue, 28 Feb 2017 11:19:48 -0800
Subject: [PATCH] Add another cert parsing test
---
.../test/test_fakeopensslclasses.py | 55 +++++++++++++++++++++-
1 file changed, 53 insertions(+), 2 deletions(-)
diff --git a/roles/openshift_certificate_expiry/test/test_fakeopensslclasses.py b/roles/openshift_certificate_expiry/test/test_fakeopensslclasses.py
View NamedCertificates.md

OpenShift Named Certificates

This is a short guide explaining how to deploy and manage custom certificates via openshift-ansible. These custom certificates will be served for public facing UI/API.

1. Set up

NOTE: I'm running ansible from the first master so I'm creating the certificates in /root/ on my first master. The certificates will be copied to the masters (within /etc/origin/master/named_certificates/) by ansible. I could create them on my local system and run ansible from my local system instead.

1.1 Create CA Certificate

You can’t perform that action at this time.