Skip to content

Instantly share code, notes, and snippets.

View bogdando's full-sized avatar

Bogdan Dobrelya bogdando

  • Red Hat
  • Poznan, Poland
View GitHub Profile
@bogdando
bogdando / keybase.md
Created March 13, 2024 14:52
Keybase proof

Keybase proof

I hereby claim:

  • I am bogdando on github.
  • I am bogdando (https://keybase.io/bogdando) on keybase.
  • I have a public key ASCI7ad_x0B5ZugZswrr5nHa5pGwn_EYrVl9wWUbXhDxSQo

To claim this, I am signing this object:

@bogdando
bogdando / tripleo_standalone_ansible_roles_validate.sh
Last active July 5, 2022 11:25
Validate and fix tripleo standalone role vars mappings for t-h-t/hiera data
#!/bin/bash
# Moved to https://github.com/bogdando/tripleo_vars_converter
# Validate and fix tripleo standalone role vars mappings for t-h-t/hiera data
#
# Example PARAMS_FILE contents:
# SVC=nova_libvirt
# THT=tripleo-heat-templates/deployment/nova/nova-modular-libvirt-container-puppet.yaml
# # matching regex rules to deduplicate long names, like:
# # tripleo_service_component_foo_service_bar_component_subcomponent_baz
# # into: tripleo_service_component_foo_subcomponent_baz
#!/bin/bash
# Fetch Zuul comments on failed builds for a patchset $1 and colorize it
#
set -eu
FROM=${FROM:-johndoe@review.opendev.org} # Insert HERE your gerrit ssh login
echo "Fetching CI results from $FROM for: $1"
out=$(mktemp /tmp/tmp.XXXXXXXXXX)
trap 'rm -f ${out}*' EXIT INT HUP
ssh -p 29418 $FROM gerrit query --comments --format=JSON \
--current-patch-set change:$1 > $out.all
# Copyright 2016 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
#!/bin/bash
printf 'Total layers/blobs involved into the test 8787(l)/5000(l+b): '
find /var/lib/image-serve/v2 -type f -name 'sha256*' | cut -d':' -f2 | wc -l
find /var/lib/containers/storage/volumes/*/_data/docker/registry/v2/repositories/*/*/_layers/sha256 -type f | cut -d'/' -f17 | wc -l
find /var/lib/containers/storage/volumes/*/_data/docker/registry/v2/blobs -type f | wc -l
printf 'Total unique layers 8787/5000: '
find /var/lib/image-serve/v2 -type f -name 'sha256*' | cut -d':' -f2 | sort -u | wc -l
find /var/lib/containers/storage/volumes/*/_data/docker/registry/v2/repositories/*/*/_layers/sha256 -type f | cut -d'/' -f17 | sort -u | wc -l
@bogdando
bogdando / gist:43a6c5938c964fa4ee94f714e0638ee5
Last active October 2, 2019 12:41
memalloc_wsgi_app.py
import gc
import numpy
import sys
import threading
def application(environ, start_response):
class mydata(object):
_data = numpy.zeros(1000000000, dtype='uint8')
pass
#!/bin/bash -x
# Based on http://www.dougalmatthews.com/2017/Jan/31/interactive-mistral-workflows-over-zaqar/
. stackrc
export OS_CACERT=${1:-/etc/pki/ca-trust/source/anchors/cm-local-ca.pem}
cat > test <<EOF
---
version: '2.0'
interactive-workflow:
import futurist
import futurist.waiters
import six
import subprocess
import sys
import time
EXECUTOR = futurist.ThreadPoolExecutor()
TIMEOUT = 5
WORK_AMOUNT = 10
@bogdando
bogdando / docker_vs_podman_run.sh
Last active February 1, 2019 10:54
Comparing the time it takes to launch containers concurrently for docker and podman runtimes
#!/bin/bash
set -e
containers_total=${1:-100}
containers_concur=${2:-10}
container_image=${3:-docker.io/library/busybox}
podman pull $container_image
docker pull $container_image
rm -f bench-jobs.txt
@bogdando
bogdando / ep.sh
Last active September 12, 2016 12:39
An entrypoint to capture net packets for a given command, in a dedicated netns
#!/bin/bash -ex
# An entrypoint to capture net packets for a given command, in a dedicated netns.
# Example usage: timeout -s KILL 15 docker run -e "SHARKFMT=pcap" -v \
# /tmp:/tmp -v /tmp/ep.sh:/usr/local/sbin/ep.sh:ro --entrypoint ep.sh \
# --privileged --cap-add ALL --rm bogdando/dbox nslookup kubernetes.io 10.233.0.2
# Then replay with: tcpick -C -yP -r /tmp/out.pcap or tcpdump -qns 0 -A -r /tmp/out.pcap
INT=${INT:-$(ip addr show | grep -E '^[ ]*inet' | grep -m1 global | awk '{ print $NF }' | sed -e 's/@//')}
IP=${IP:-$(ip addr show | grep -E '^[ ]*inet' | grep -m1 -E "global( $INT)?" | awk '{ print $2 }' | sed -e 's/\/.*//')}
TESTNETPREFIX=${TESTNETPREFIX:-192.168.163}