Skip to content

Instantly share code, notes, and snippets.

@dominik-ba
dominik-ba / measure.py
Created April 10, 2021 14:30
python performance measurement
import time
def measure(method, verbose=True, *params):
start = time.perf_counter()
result = method(*params)
for i in range(100000):
i + 1
end = time.perf_counter()
duration = end - start
@dominik-ba
dominik-ba / example-param-parsing.sh
Last active February 27, 2020 09:17
Linux bash argument parsing
#!/bin/bash
# Author: Dominik Bartsch
usage="
Usage: $(basename "$0") [OPTIONS]
A tool to gather several infromation about the OpenShift projects/namespaces and capacity
Options:
-h, --help Show this help text
-f, --foo Do the foo thing
@dominik-ba
dominik-ba / profiles.json
Last active June 29, 2021 11:06
windows terminal settings file
{
"$schema": "https://aka.ms/terminal-profiles-schema",
"actions":
[
{
"command": "unbound",
"keys": "win+shift+\u00b4"
},
{
"command":
@dominik-ba
dominik-ba / .bash_profile
Last active October 25, 2019 13:40
bash aliases
# Aliases
alias g='git'
alias gst='git status'
alias gclean="git pull --all -p && git branch -vv | grep 'origin/.*: gone]' | awk '{print $1}' | xargs git branch -d"
alias gp='git push'
alias cdrep='cd /c/repositories/'
@dominik-ba
dominik-ba / dns-sync.sh
Created December 28, 2018 14:33 — forked from matthiassb/dns-sync.sh
Init.d script for keeping WSL resolv.conf in-sync with Windows
#! /bin/bash
### BEGIN INIT INFO
# Provides: dns-sync
# Required-Start:
# Required-Stop:
# Default-Start: S
# Default-Stop:
# Short-Description: Synchronizes /etc/resolv.conf in WLS with Windows DNS - Matthias Brooks
### END INIT INFO
@dominik-ba
dominik-ba / dynamicloading.py
Created November 9, 2018 14:50
loads dynamically a method in python
class FunctionAttributeMapping(AttributeMapping):
def __init__(self, method, targetName):
AttributeMapping.__init__(self)
self.__method = method
self.__targetName = targetName
def getValue(self, ci):
import sys
modname = globals()['__name__']
module = sys.modules[modname]
@dominik-ba
dominik-ba / buildPackage.bat
Created November 9, 2018 13:57
makes zip of special content for packages
@echo off
echo Building Package...
set arg1=%1
set mydir="%~p0"
cd %mydir%
::find package name
::convert \ to ;