Skip to content

Instantly share code, notes, and snippets.

View x.yaml
commands:
create_dir:
base: mkdir
argument: true
params:
- mode:
arg: "-m"
type: string
help: set file mode (as in chmod), not a=rwx - umask
@bukowa
bukowa / Dockerfile
Last active Oct 26, 2020
kubernetes certbot
View Dockerfile
FROM ubuntu:20.04
RUN apt-get update \
&& apt-get install -y \
software-properties-common \
&& add-apt-repository universe \
&& apt-get update
RUN apt-get install -y \
certbot \
@bukowa
bukowa / nginx-ingress.values.yaml
Last active Oct 4, 2020
kubernetes nginx helm install script
View nginx-ingress.values.yaml
controller:
service:
annotations:
# digitalocean
service.beta.kubernetes.io/do-loadbalancer-enable-proxy-protocol: 'true'
config:
use-proxy-protocol: 'true'
extraArgs:
# tls used if you didn't provide one in ingress definition for your service
# what below value really means is: namespace/name of your secret
@bukowa
bukowa / Makefile
Last active Oct 3, 2020
kubernetes makefile
View Makefile
NAME=gowpslack
NAMESPACE=gowpslack
deploy:
kubectl apply -f deployment.yaml --namespace=${NAMESPACE}
delete:
kubectl delete -f deployment.yaml --namespace=${NAMESPACE}
# rollout pulls new image if `ImagePullPolicy` is set to latest in deployment.yaml
View lib.go
// Library represents git repositories based on Hosts
type Library struct {
Hosts []string // first folder in the tree for each git host
Logger *log.Logger
baseDir string // base dir for all libraries
libDir string // base dir where library resides inside BaseDir
mux sync.Mutex
locks map[string]*sync.Mutex // locks per repository dir
perm os.FileMode
fileServer http.Handler
@bukowa
bukowa / Dockerfile
Last active Aug 26, 2020
wait for it golang
View Dockerfile
FROM golang@sha256:5219b39d2d6bf723fb0221633a0ff831b0f89a94beb5a8003c7ff18003f48ead as builder
ENV CGO_ENABLED=0
WORKDIR /build
COPY ./waitforit ./waitforit
RUN go build -o /build/bin/waitforit ./waitforit/main.go
COPY ./testit ./testit
RUN go build -o /build/bin/testit ./testit/main.go
FROM TESTABLECONTAINER
@bukowa
bukowa / validate_host.py
Last active Aug 19, 2020
validate_host.py
View validate_host.py
from urllib.parse import urlparse
allowed_hosts = ["example.com"]
def validate_host(uri: str) -> bool:
return (host := urlparse(uri).hostname) and any(
(host == allowed for allowed in allowed_hosts)
) or False
def host_validator(allowed_hosts: Iterable) -> Callable[[str], bool]:
View test.txt
https://github.com/bukowa/poeparser
https://github.com/bukowa/django-georangefilter
https://github.com/bukowa/djangevu
https://github.com/bukowa/small_eod
https://github.com/bukowa/1000-common-words
View productexport.py
import csv
from bs4 import BeautifulSoup
csvfile = open("csvdata.csv", 'a', encoding='utf-8')
csvwriter = csv.writer(csvfile, delimiter='~')
root = BeautifulSoup(open("products.xml", "r", encoding='utf-8'))
products = root.find("products")
items = products.find_all("item")