Skip to content

Instantly share code, notes, and snippets.

View fischerdr's full-sized avatar
:octocat:

David R. Fischer fischerdr

:octocat:
View GitHub Profile
@fischerdr
fischerdr / packer_ansible_qemu_fedora.sh
Created November 6, 2017 22:21 — forked from ruzickap/packer_ansible_qemu_fedora.sh
Install Packer with WinRM communicator / Ansible / Qemu and enable Packer's Winrm communicator in Fedora
dnf install -y ansible qemu-img qemu-kvm wget unzip
cd /tmp
wget https://releases.hashicorp.com/packer/1.1.1/packer_1.1.1_linux_amd64.zip
unzip packer*.zip
# Use packerio as a binary name, because packer binary already exists in fedora : /usr/sbin/packer as part of cracklib-dicts package
mv packer /usr/local/bin/packerio
# Install WinRM communicator for Packer (https://www.packer.io/docs/provisioners/ansible.html#winrm-communicator)
@fischerdr
fischerdr / ovs-dump-flows.py
Created July 23, 2018 15:23 — forked from djoreilly/ovs-dump-flows.py
Make ovs-ofctl dump-flows more readable. Remove stats, sort by table and priority, replace port numbers with port names.
#!/usr/bin/python
import sys
import re
import subprocess
if len(sys.argv) != 2:
print "bridge name needed"
sys.exit()
@fischerdr
fischerdr / undercloud-playbook.yaml
Created August 21, 2018 14:56 — forked from nuriel77/undercloud-playbook.yaml
Ansible playbook to initialize new undercloud for tripleo
#
# Ansible playbook to prepare the undercloud machine.
# Will preform all steps until custom steps are to be taken --
# which are: providing a custom undercloud.conf and running
# openstack install undercloud command and so on...
# Root SSH access to the remote machine has to be configured.
# Edit vars as necessary.
#
# If this is the first time you are using Ansible on a host,
@fischerdr
fischerdr / tmux-cheatsheet.markdown
Created October 15, 2018 15:16 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@fischerdr
fischerdr / python-paged-ldap-snippet-2.4.py
Created October 16, 2018 21:21 — forked from mattfahrner/python-paged-ldap-snippet-2.4.py
This snippet allows you to do a Python LDAP search with paged controls. The latest version now supports Python "ldap" 2.4. Many thanks to Ilya Rumyantsev for doing the 2.4 legwork.
#! /usr/bin/python
import sys
import ldap
from ldap.controls import SimplePagedResultsControl
from distutils.version import LooseVersion
# Check if we're using the Python "ldap" 2.4 or greater API
LDAP24API = LooseVersion(ldap.__version__) >= LooseVersion('2.4')
@fischerdr
fischerdr / ansible-summary.md
Created October 17, 2018 15:15 — forked from andreicristianpetcu/ansible-summary.md
This is an ANSIBLE Cheat Sheet from Jon Warbrick

An Ansible summary

Jon Warbrick, July 2014, V3.2 (for Ansible 1.7)

Configuration file

intro_configuration.html

First one found from of

#!/usr/bin/env python
import shlex, subprocess, argparse
from os import listdir
# command line arguments
parser = argparse.ArgumentParser()
parser.add_argument('-n','--hostname', type=str, required=True)
parser.add_argument('-i','--ipaddr', type=str, required=True)
parser.add_argument('-m','--netmask', type=str, required=True)
@fischerdr
fischerdr / pyvenvex.py
Created July 13, 2024 00:34 — forked from vsajip/pyvenvex.py
A script which demonstrates how to extend Python 3.3's EnvBuilder, by installing setuptools and pip in created venvs. This functionality is not provided as an integral part of Python 3.3 because, while setuptools and pip are very popular, they are third-party packages.The script needs Python 3.3 or later; invoke it using"python pyvenvex.py -h"fo…
#
# Copyright (C) 2013-2020 Vinay Sajip. New BSD License.
#
import os
import os.path
from subprocess import Popen, PIPE
import sys
from threading import Thread
from urllib.parse import urlparse
from urllib.request import urlretrieve
@fischerdr
fischerdr / pod_execvar.py
Last active November 11, 2024 15:22
pod_execvar.py
import click
from kubernetes import client, config, stream
import os
import sys
@click.command()
@click.argument('pod_name')
@click.option('--namespace', '-n', default='default', help='Namespace of the pod')
@click.option('--env_var', '-e', multiple=True, help='Environment variable in the format VAR=VALUE')
@click.option('--command', '-c', required=True, help='Command to run in the pod')
import click
import csv
import logging
import asyncio
from kubernetes_asyncio import client, config
from collections import defaultdict
from filelock import FileLock
from concurrent.futures import ThreadPoolExecutor, as_completed
# Configure logging