Skip to content

Instantly share code, notes, and snippets.

View tbielawa's full-sized avatar
💭
bitmath!

Tim Bielawa tbielawa

💭
bitmath!
View GitHub Profile
@tbielawa
tbielawa / sed-with-lang.diff
Created September 24, 2013 14:56
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
@@ -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
@tbielawa
tbielawa / cd_hacks.sh
Created September 17, 2019 23:36
Quick directory `cd`/shell hacks
# 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.
$ ./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
@tbielawa
tbielawa / magic.md
Created November 28, 2017 16:18 — forked from abutcher/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>
 a4879b25-1c92-49d6-986b-e9e2cde27678
# 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
[
{
"name": "router2",
"replicas": 1,
"serviceaccount": "router",
"namespace": "default",
"stats_port": 1941,
"ports": [
"8080:8080",
"6443:6443"
$ 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
$ 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'}
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

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