Skip to content

Instantly share code, notes, and snippets.

View draganHR's full-sized avatar

Dragan Bošnjak draganHR

View GitHub Profile
#!/bin/bash
# Generate commands to recreate directory structure, including ownership and permissions
find . -type d -printf "install --mode="%m" --owner="%u" --group="%g" -d "%p/\\n
@draganHR
draganHR / tmux-exec.sh
Last active January 16, 2024 14:53
Run kubectl exec in multiple pods in a single tmux session
#!/bin/bash
#
# Example:
# $ bash tmux-exec.sh <app>
# $ bash tmux-exec.sh <app> <namespace>
if [ -n "$1" ]; then
NAME="$1"
else
echo "Pleae specify app.kubernetes.io/name"
@draganHR
draganHR / ingress-haproxy.md
Created February 16, 2023 10:57
Exposing TCP and UDP services trough kubernetes ingress
# PING - SEND ICMP ECHO_REQUEST TO NETWORK HOSTS
# Copyright (c): Dragan Bosnjak
# License: Apache License
echo -e "\033[1;31m"
ping "$@"
import timeit
from datetime import datetime
from dateutil import parser as dateutil_parser
from backports.datetime_fromisoformat import datetime_fromisoformat # backport for python < 3.7
strformat = "%Y-%m-%dT%H:%M:%S.%f"
def main():
#!/bin/bash
exec sudo --preserve-env=PYTHONPATH --preserve-env=PWD /usr/bin/python3 "$@"
@draganHR
draganHR / benchmark_json.py
Last active March 25, 2020 09:25
benchmark_json.py
from __future__ import unicode_literals, print_function
import time
import json
import simplejson
import ujson
import msgpack
def get_example_raw_data():
package observer
type Event interface {
}
type Observer interface {
OnNotify(Event)
}
type Subject struct {
import pytest
from django.test import TestCase as django_case
class TestFoobarCase(object):
@pytest.fixture(scope="class", autouse=True)
def prepare_class(self, django_db_setup, django_db_blocker):
with django_db_blocker.unblock():
django_case.setUpClass()