Skip to content

Instantly share code, notes, and snippets.

View machacekondra's full-sized avatar

Ondra Machacek machacekondra

View GitHub Profile
@machacekondra
machacekondra / Dockerfile
Last active October 15, 2025 09:14
Testing proxy
FROM --platform=linux/amd64 alpine:latest
RUN apk add --no-cache tinyproxy
# add config (we'll copy local tinyproxy.conf)
COPY tinyproxy.conf /etc/tinyproxy/tinyproxy.conf
EXPOSE 8888
CMD ["tinyproxy", "-d", "-c", "/etc/tinyproxy/tinyproxy.conf"]
@machacekondra
machacekondra / context.go
Created September 13, 2023 12:51 — forked from montanaflynn/context.go
An example of using context to cancel goroutines between server handlers
package main
import (
"context"
"fmt"
"log"
"net/http"
"sync"
"time"
)
@machacekondra
machacekondra / notes.txt
Created February 10, 2023 08:31
Troubleshooting resources on baremetal OCP using kvm hosts
# Attach disk
$ virsh attach-disk test-infra-cluster-b8af966c-worker-1 /mnt/data/disk1.img vdb --config
# Increase cpu
$ virsh setvcpus test-infra-cluster-b8af966c-worker-1 6 --config --maximum
# Hotplug cpu
$ virsh setvcpus test-infra-clu^Cer-b8af966c-worker-0 6 --live
# Hotplug memory
@machacekondra
machacekondra / sapauth.py
Created September 21, 2022 12:11
SAPauth plugin for requests
class SAPAuth(AuthBase):
"""
SAPAuth is class which implements the SAP launchpad authentication.
"""
sso_url = 'https://accounts.sap.com/saml2/idp/sso'
def get_next_url(self, text):
return ET.fromstring(text, parser=etree.HTMLParser()).find(".//body//form[@method='post']").attrib['action']
@machacekondra
machacekondra / get_status_of_sap_file.py
Created September 21, 2022 12:05
Get status of the sap file
import json
import os
import requests
from requests_sap import SAPAuth
r = requests.get(
"https://launchpad.support.sap.com/services/odata/svt/swdcuisrv/ObjectSet('0030000000103162022')",
auth=SAPAuth(username=os.environ['LP_USERNAME'], password=os.environ['LP_PASSWORD']),
headers={'Accept': 'application/json'}
@machacekondra
machacekondra / unix_socket_soap.py
Last active September 19, 2022 07:50
Use suds soap client with local unix socket
from suds.client import Client
from suds.transport.http import HttpAuthenticated, HttpTransport
import http.client
import socket
import urllib.request
class LocalSocketHttpConnection(http.client.HTTPConnection):
def __init__(self, host, port=None, timeout=socket._GLOBAL_DEFAULT_TIMEOUT,
@machacekondra
machacekondra / nginx_deployment.yaml
Created January 18, 2022 16:57
Yaml describing the nginx edge deployment exposing HTTP port 8885
apiVersion: management.k4e.io/v1alpha1
kind: EdgeDeployment
metadata:
name: nginx
spec:
deviceSelector:
matchLabels:
device: local
type: pod
pod:
@machacekondra
machacekondra / myfilter.py
Created August 30, 2018 12:55
Get first equal_to filter plugin
class FilterModule(object):
def filters(self):
return {
'get_first_equalto': self.get_first_equalto,
}
def get_first_equalto(self, var, attr, val):
for x in var:
if x[attr] == val:
return x
@machacekondra
machacekondra / playbook_run.sh
Last active January 15, 2017 13:17
Run manageiq.yml to deploy ManageIQ to oVirt
$ omachace ~/workspace $ ansible-playbook -v manageiq.yml
Using /home/omachace/.ansible.cfg as config file
PLAY [Deploy ManageIQ to oVirt engine] *****************************************
TASK [ovirt-manageiq : Download the OVA image of ManageIQ] *********************
changed: [example.com] => {"changed": true, "checksum_dest": null, "checksum_src": "7641fb36babcb85db8348a020bac384d34d99ff2", "dest": "/tmp/manageiq.ova", "gid": 0, "group": "root", "md5sum": "f5bd3388b0fcd0e6b563ee26f2c193fa", "mode": "0644", "msg": "OK (1108479736 bytes)", "owner": "root", "secontext": "unconfined_u:object_r:user_tmp_t:s0", "size": 1108479736, "src": "/tmp/tmpfyCvx5", "state": "file", "uid": 0, "url": "http://releases.manageiq.org/manageiq-ovirt-euwe-1.ova"}
TASK [ovirt-manageiq : Create a directory for extract the OVA image] ***********
changed: [example.com] => {"changed": true, "gid": 0, "group": "root", "mode": "0755", "owner": "root", "path": "/tmp/manageiq/", "secontext": "unconfined_u:object_r:user_tmp_t:s0", "size
@machacekondra
machacekondra / install_ovirt_manageiq.yml
Created January 15, 2017 12:04
Install Ansible galaxy role to deploy ManageIQ
$ ansible-galaxy install machacekondra.ovirt-manageiq