Skip to content

Instantly share code, notes, and snippets.

View johananl's full-sized avatar

Johanan Liebermann johananl

View GitHub Profile
@johananl
johananl / README.md
Last active November 5, 2020 22:44
Michigan voter information search

Michigan voter information search

Installation

pip install beautifulsoup4
pip install requests

Usage

@johananl
johananl / README.md
Created October 26, 2020 17:47
List all images in a Docker Hub repository

List all images in a Docker Hub repository

Requirements

Usage

@johananl
johananl / grafana.service
Created May 31, 2020 17:02
Monitoring a Flatcar node using Prometheus, Grafana and Node Exporter
[Unit]
Description=Grafana
After=docker.service
Requires=docker.service
[Service]
TimeoutStartSec=0
Restart=always
ExecStartPre=-/usr/bin/docker stop %n
ExecStartPre=-/usr/bin/docker rm %n
#!/bin/bash
# wait-for-dns - a script which waits for the availability of a DNS record.
#
# This script is useful in cases where it is necessary to ensure a certain DNS record is resolvable
# without "contaminating" DNS resolvers with cached NXDOMAIN responses.
#
# This script accepts a DNS zone and a record. It then figures out the authoritative nameservers
# for for the zone and queries each of them for the existence of the provided record. If the record
# exists on all of the nameservers, the script exits successfully. If the record doesn't exist on
@johananl
johananl / README.md
Created March 12, 2020 17:52
Backup/restore Postgres in Docker
docker exec postgres.service pg_dump -U my_user my_db > dump_`date +%d-%m-%Y"_"%H_%M_%S`.sql
docker exec -i postgres.service psql -U my_user my_db < dump_12-03-2020_17_49_37.sql
@johananl
johananl / postgres.service
Last active March 3, 2020 13:51
Run a Docker container as a systemd unit
[Unit]
Description=PostgreSQL
After=docker.service
Requires=docker.service
[Service]
TimeoutStartSec=0
Restart=always
ExecStartPre=-/usr/bin/docker stop %n
ExecStartPre=-/usr/bin/docker rm %n
@johananl
johananl / README.md
Created July 17, 2019 14:55
Generate self-signed TLS certificate
openssl req -x509 -newkey rsa:4096 -keyout mykey.key -out mycert.pem -days 365 -nodes -subj '/CN=localhost'
@johananl
johananl / registry.yaml
Created July 16, 2019 13:21
Private Docker registry on k8s
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: registry
---
apiVersion: policy/v1beta1
kind: PodSecurityPolicy
metadata:
name: registry
@johananl
johananl / README.md
Last active January 6, 2020 11:11
Privileged DaemonSet

Privileged DaemonSet

kubectl apply -f privileged-ds.yaml
kubectl exec -it debug-xxxxx sh
chroot /host
@johananl
johananl / main.tf
Last active July 23, 2019 09:58
AKS cluster using Terraform
provider "azurerm" {}
variable "cluster_name" {
default = "aks-test"
}
resource "azurerm_resource_group" "test" {
name = "${var.cluster_name}"
location = "West Europe"
}