Skip to content

Instantly share code, notes, and snippets.

View Rotzke's full-sized avatar
🇩🇪

Nils Bergmüller Rotzke

🇩🇪
  • Berlin, Germany
  • 08:38 (UTC +01:00)
View GitHub Profile
@Rotzke
Rotzke / docker-compose-app.service
Created September 3, 2022 19:14
systemctl enabled service from docker-compose logic
# /etc/systemd/system/docker-compose-app.service
[Unit]
Description=Docker Compose Application Service
Requires=docker.service
After=docker.service
[Service]
Type=oneshot
RemainAfterExit=yes
@Rotzke
Rotzke / kube-bench.yaml
Last active May 6, 2022 16:13
Kube bench job manifest
---
apiVersion: batch/v1
kind: Job
metadata:
name: kube-bench
spec:
template:
metadata:
labels:
app: kube-bench
@Rotzke
Rotzke / load_directory_json.gz.sh
Created February 21, 2022 21:00 — forked from rjurney/load_directory_json.gz.sh
How to bulk load gzip'd JSON in Elastic
# Bulk load the Foo data we prepared via PySpark in etl/transform_foo.spark.py
for path in data/foo/elastic/part*
do
file=$(basename ${path})
echo "Submitting ${path} to Elastic index foo ..."
curl ${USER_STRING} \
-X POST \
-H "Content-encoding: gzip" \
-H "Content-Type: application/x-ndjson" \
@Rotzke
Rotzke / ssntxt
Created September 17, 2021 09:25
Fake-Aware SSN RegEx Pattern
^(?!b(d)1+-(d)1+-(d)1+b)(?!123-45-6789|219-09-9999|078-05-1120)(?!666|000|9d{2})d{3}-(?!00)d{2}-(?!0{4})d{4}$
@Rotzke
Rotzke / cc.txt
Last active September 17, 2021 09:24
Universal Credit Card RegEx Pattern
(?:4[0-9]{12}(?:[0-9]{3})?|(?:5[1-5][0-9]{2}|222[1-9]|22[3-9][0-9]|2[3-6][0-9]{2}|27[01][0-9]|2720)[0-9]{12}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|6(?:011|5[0-9]{2})[0-9]{12}|(?:2131|1800|35\d{3})\d{11})
import signal
import sys
import asyncio
import aiohttp
import json
loop = asyncio.get_event_loop()
client = aiohttp.ClientSession(loop=loop)
async def get_json(client, url):
@Rotzke
Rotzke / dataclasses.py
Created June 30, 2020 16:34
Dataclasses in Python 3.7+
from dataclasses import dataclass
@dataclass
class Card:
rank: str
suit: str
card = Card("Q", "hearts")
print(card == card)
PUT /twitter/_settings
{
"index" : {
"number_of_replicas" : 2
}
}
GET {index}/{type}/_search
{
"size": 0,
"aggs": {
"{aggregation_name}": {
"terms": {
"field": "{filed_value}",
"size": 10
}
}
PUT /_cluster/settings
{
"transient": {
"logger.org.elasticsearch.transport": "trace"
}
}