Skip to content

Instantly share code, notes, and snippets.

View matburt's full-sized avatar
😄

Matthew Jones matburt

😄
View GitHub Profile
@matburt
matburt / Dockerfile
Created August 24, 2021 16:15
.devcontainer for ansible runner
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.192.0/containers/codespaces-linux/.devcontainer/base.Dockerfile
FROM mcr.microsoft.com/vscode/devcontainers/universal:1-focal
RUN pip3 install --user ansible
USER root
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
&& apt-get -y install python3-pexpect
USER codespace
@matburt
matburt / flask_handler.py
Last active October 6, 2023 14:15
Demonstrating a basic flask POST request handler that examines request headers.
#!/usr/bin/env python
from flask import Flask, request, abort, jsonify
app = Flask(__name__)
@app.route('/push', methods=['POST'])
def handle_push():
if not request.json:
abort(400)
if 'AnsibleTower' in request.headers and request.headers['AnsibleTower'] == 'xSecretx':
# Trigger some other external action
// For compilers that support ranges in case statements
// remember, if a case doesn't have a break then it will fall through to the next one.
switch (age) {
case 21:
printf("You are old enough to drink");
case 18 ... 20:
printf("You are old enough to vote");
case 16 ... 17:
printf("You are old enough to drive");
@matburt
matburt / Containerfile.yml
Created June 5, 2023 20:00
An opa policy and Containerfile sidecar definition for use with ansible-runner runtime policy evaluation experiements
version: '3.7'
volumes:
opa_data:
driver: local
networks:
opa:
driver: bridge
@matburt
matburt / mod-list.json
Last active November 3, 2022 00:16
Factorio Space Exploration Mods
{
"mods":
[
{
"name": "base",
"enabled": true
},
{
"name": "space-exploration",
@matburt
matburt / execution-environment.yml
Created May 18, 2022 13:51
EE to add the awx sample collection from ansible/ansible-tower-samples to a basic EE derived from awx-ee:latest
---
version: 1
build_arg_defaults:
EE_BASE_IMAGE: 'quay.io/ansible/awx-ee:latest'
additional_build_steps:
append:
- ADD awx-sample-1.0.0.tar.gz /ansible-tower-sample-1.0.0.tar.gz
- RUN ansible-galaxy collection install /ansible-tower-sample-1.0.0.tar.gz
@matburt
matburt / onlinego.el
Last active June 16, 2021 13:15
A simple emacs module for interfacing with online-go.com
;;; onlinego.el
;; Author: Matthew Jones <matburt@online-go.com>
(require 'request)
(defvar onlinego-api-base "https://online-go.com/api/v1"
"The base onlinego api url")
(defcustom onlinego-api-client-id nil
"onlinego api client id, see: https://online-go.com/developer"
FROM registry.access.redhat.com/ubi8/python-36
USER root
ADD https://github.com/krallin/tini/releases/download/v0.19.0/tini /bin/tini
RUN pip3 install git+https://github.com/ansible/ansible-runner
RUN pip3 install git+https://github.com/ansible/ansible
RUN chmod +xr /bin/tini
@matburt
matburt / i3plug.py
Created August 10, 2012 02:51
To be used with the i3 window manager (and i3-py). Takes a command 'save' or 'restore'. When 'save' is used it will store the monitor that each workspace is assigned to. When 'restore' is used it will restore those workspaces to the monitor that it was
import os
import i3
import sys
import pickle
def showHelp():
print(sys.argv[0] + " <save|restore>")
def get_visible_workspace():
for workspace in i3.get_workspaces():
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.