Skip to content

Instantly share code, notes, and snippets.

@victortv7
victortv7 / k8s_node_images.py
Created August 12, 2019 15:50
Python script that prints the images pulled in each node on a kubernetes cluster, similarly to `docker images`
#!/usr/bin/python
# Usage: kubectl get node [optional: name of node] -o json | python k8s_node_images.py
import sys
import json
data = json.load(sys.stdin)
try:
nodes = data['items']
except KeyError:
nodes = [data]
for node in nodes:
@victortv7
victortv7 / php.py
Created March 10, 2019 03:59
Python 3 interface to run string as PHP code
"""
Credits to @brool for the original class: https://github.com/brool/util/blob/master/php.py
I've only made alterations in the __submit method to use subprocess.Popen instead of popen2. I am also using json instead of simplejson
"""
import json
import subprocess
class PHP:
"""This class provides a stupid simple interface to PHP code."""