Skip to content

Instantly share code, notes, and snippets.

View deepbrook's full-sized avatar

Nils Diefenbach deepbrook

  • BioNTech SE
  • Koblenz
View GitHub Profile
@deepbrook
deepbrook / pseudocode
Last active September 6, 2017 11:17
Pseudocode for a fuzzy join implementation
"""
MIT License
Copyright (c) [2017] Sebastian Freundt, Nils Diefenbach
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
@deepbrook
deepbrook / assert_warnings_emitted.py
Last active December 18, 2017 09:28
Properly asserting if a warning was emitted in unittests
# Courtesy of https://stackoverflow.com/a/3892413/5413116
import unittest, warnings
from mock import patch
class MyCustomWarning(warnings.Warning):
pass
def emit_warning():
warnings.warn("My custome warning message", MyCustomWarning)
@deepbrook
deepbrook / gist:d4ca8ee51eb1a5b8c2dd575263abb85c
Created March 15, 2019 11:47
Add Port Binding to existing Docker Container.
"""Create a new Port binding for an existing container.
Must be run as root, as access to /var/lib/docker/containers
requires root privileges.
Source:
https://mybrainimage.wordpress.com/2017/02/05/docker-change-port-mapping-for-an-existing-container/
..admonition: WARNING!
@deepbrook
deepbrook / REDMetricsTracker.py
Created May 14, 2019 13:20
Simple Prometheus Metrics exposition for RED metrics in web applications.
"""Prometheus Metrics used to monitor our flask applications.
Available metrics are:
http_requests_total
The total number of requests made to the application.
http_exceptions_total
The total number of exceptions raised during processing or requests. Please
note that *404 Not Found* errors caused by requesting incorrect URLs are **NOT**
>>>run-000.stderr
--------- Starting ---------
/tmp/_MEIMzmA50/raiden/network/rpc/client.py:375: UserWarning: Infura does not provide an API to recover the latest used nonce. This may cause the Raiden node to error on restarts.
The error will manifest while there is a pending transaction from a previous execution in the Ethereum's client pool. When Raiden restarts the same transaction with the same nonce will be retried and *rejected*, because the nonce is already used.
--------- Stopped ---------
>>>run-000.stdout
--------- Starting ---------
Command line: /tmp/raiden_releases/bin/raiden-nightly-2019-10-28T00-25-48-v0.100.5a1.dev650+g78dcbaf9b-linux-x86_64 --accept-disclaimer --datadir /tmp/scenarios/smoketests/node_0_000 --keystore-path /tmp/scenarios/smoketests/node_0_000/keys --address 0xA312A639193268081423323C91707D49beBec9Fa --password-file /tmp/scenarios/smoketests/node_0_000/password.txt --network-id 5 --sync-check --gas-price normal --eth-rpc-endpoint https://goerli.infura.io/v3/de4710375b854c759ee2
@deepbrook
deepbrook / switch-workspace.fish
Last active March 21, 2020 19:11
cd && activate virtualenv with venvwrapper
set DEV_DIR {$HOME}/devel
function switch-to
if test -e {$DEV_DIR}/{$argv[1]}
cd {$DEV_DIR}/{$argv[0]}
workon (basename {$argv[1]})
else
echo "No such workspace!"
end
end
--> Test matrix
└── default
├── lint
├── syntax
├── destroy
├── create
├── converge
├── verify
└── destroy
@deepbrook
deepbrook / 1_packer.pseudo-template.json
Last active October 13, 2024 17:33
Terraform Variable for Packer Manifest post-processor output
{
"builders": [
{
"type": "digitalocean",
...
}
],
"post-processors":[
{
"type": "manifest",
@deepbrook
deepbrook / ironwood-master.yml
Last active October 15, 2020 14:42
OpenEDX Devstack Setup Ansible Playbooks
# usage:
# ansible-playbook juniper-master.yml
#
# Overwrite variables set in `vars` below by using the `-e/--extra-vars` flag.
#
# Installs devstack into the playbook's directory - overwrite by passing `-e install_dir=<your_dir>`.
---
- hosts: 127.0.0.1
connection: local
become: false
@deepbrook
deepbrook / msk-zookeeper-sg.tf
Created May 18, 2022 12:20
Attach Separate AWS Security Group To AWS MSK's ZooKeeper instances
resource aws_security_group "msk_nodes" {...}
resource aws_msk_cluster "cluster" {
broker_node_group_info {
security_groups = [aws_security_group.msk_nodes.id]
...
}
}