Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python
"""Test MySQL tooz driver."""
import os
import platform
import time
from tooz import coordination
#!/usr/bin/env python3
"""
Example script on how to get the OpenIDConnect refresh token
developed / tested with Okta https://developer.okta.com/
should be good with any generic OpenIDConnect provider and
self-deployed Kubernetes tied into it.
Inspired by
https://github.com/micahhausler/k8s-oidc-helper
@pshchelo
pshchelo / noVNC-Hack-around-iDRAC8-VNC-support.patch
Created June 27, 2019 05:44
Patch noVNC to work with iDRAC built-in VNC server
From 1ed89a2c0ebae62e37f390ffd0d1deeca31b83ce Mon Sep 17 00:00:00 2001
From: Pavlo Shchelokovskyy <shchelokovskyy@gmail.com>
Date: Fri, 25 Nov 2016 15:13:20 +0200
Subject: [PATCH] Hack around iDRAC8 VNC support
Bug#712
---
core/rfb.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
@pshchelo
pshchelo / microk8s-tips.md
Created June 25, 2019 09:03
Canonical MicroK8s tips

MicroK8S tips

https://microk8s.io/docs/

enable DNS and Registry support

microk8s.enable dns registry

if needed, add extra DNS to the kube-dns

@pshchelo
pshchelo / get-latest-k8s-client.sh
Created January 10, 2019 08:48
Command to fetch latest kubectl binary
curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl
@pshchelo
pshchelo / syntax-check.py
Created August 27, 2018 16:11
Test file for Python syntax highlighting in editors / IDEs
#!/usr/bin/env python
"""Test file for Python syntax highlighting in editors / IDEs.
Meant to cover a wide range of different types of statements and expressions.
Not necessarily sensical or comprehensive (assume that if one exception is
highlighted that all are, for instance).
Extraneous trailing whitespace can't be tested because of svn pre-commit hook
checks for such things.
@pshchelo
pshchelo / genconfigdrive.py
Created May 5, 2017 12:11
Generate configdrive suitable for ironic in pure Python
#!/usr/bin/env python
import base64
import contextlib
import gzip
import os
import sys
import StringIO
import pycdlib # GNU LGPL v2.1 - not possible to include in Apache 2.0-licensed code :(
@pshchelo
pshchelo / gerritq.py
Last active March 24, 2017 21:17
Gerrit Queries
#!/usr/bin/env python
# Usage example:
#
# import gerritq
# g = gerritq.GerritQuery()
# user = 'pshchelo'
# q = 'owner:%s+status:merged' % user
# merged = g.changes(q)
# print(len(merged))
@pshchelo
pshchelo / srt2vtt.py
Created February 6, 2017 16:47
convert SubRip subtitles to WebVTT (suitable for WebM format)
#!/usr/bin/env python
import sys
import re
with open(sys.argv[1], 'r') as infile:
data = infile.readlines()
timecodere = re.compile("^\d*:\d\d:\d\d,\d\d\d --> \d*:\d\d:\d\d,\d\d\d")
@pshchelo
pshchelo / allmacs.py
Last active November 2, 2016 11:43
all macs
#!/usr/bin/env python
"""Return all non-zero Ethernet (6 octets) MAC addresses"""
import itertools
import re
import netifaces
MAC_REGEXP = re.compile("^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2})$")