Skip to content

Instantly share code, notes, and snippets.

View dln's full-sized avatar
🚀

Daniel Lundin dln

🚀
View GitHub Profile
@dln
dln / quick-prometheus
Last active May 17, 2021 15:05
Run a local prometheus with short scraping interval for development purposes
#!/bin/bash
set -e
datadir=$1
app_port=$2
metrics_path=${3:-/metrics}
if [[ -z "$datadir" || -z "$app_port" ]]; then
echo "Usage: $0 DATADIR APPLICATION_PORT [METRICS_PATH]"
exit 1
@dln
dln / update-ip-blocklist.sh
Last active May 1, 2021 16:11
Minimal script to update IP blocklists from various sources
#!/bin/bash
set -eo pipefail
blocklists=(
# Team Cymru bogons lists
https://www.team-cymru.org/Services/Bogons/fullbogons-ipv4.txt
# SpamHaus DROP (Don't Route or Peer)
https://www.spamhaus.org/drop/drop.txt
# SpamHaus Extended DROP (Extended Don't Route or Peer)
https://www.spamhaus.org/drop/edrop.txt
@dln
dln / Dockerfile
Created March 30, 2021 07:57
Multi-stage Dockerfile with multiple targets for gooder life
FROM golang:1.16-buster AS builder
WORKDIR /src
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN go build ./cmd/director && \
go build ./cmd/frontend && \
go build ./cmd/matchfunction
FROM gcr.io/distroless/base-debian10 AS director
@dln
dln / daemonset.yaml
Last active December 28, 2022 12:54
Daemonset to automatically stripe all local ssd disks and mount for use in GKE workloads.
---
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: local-ssd-init
labels:
app: local-ssd-init
spec:
template:
spec:
echo -e '\e[0mnormal\e[0m'
echo -e '\e[2mdim\e[0m'
echo -e '\e[1mbold\e[0m'
echo -e '\e[3mitalic\e[0m'
echo -e '\e[2;3mdim italic\e[0m'
echo -e '\e[1;3mbold italic\e[0m'
echo
#!/usr/bin/perl
# Exmple hook script for PVE guests (hookscript config option)
# You can set this via pct/qm with
# pct set <vmid> -hookscript <volume-id>
# qm set <vmid> -hookscript <volume-id>
# where <volume-id> has to be an executable file in the snippets folder
# of any storage with directories e.g.:
# qm set 100 -hookscript local:snippets/hookscript.pl
@dln
dln / smb.conf
Created August 5, 2020 10:31
Minimal samba config with some perf tunings for throughput
[global]
workgroup = WORKGROUP
log file = /var/log/samba/log.%m
max log size = 1000
server role = standalone server
security = user
map to guest = Bad Password
server multi channel support = yes
load printers = no
printing = bsd
@dln
dln / sway.conf
Last active November 9, 2019 17:14
input "2:7:SynPS/2_Synaptics_TouchPad" {
tap enabled
natural_scroll enabled
pointer_accel 0.5
}
input "1:1:AT_Translated_Set_2_keyboard" {
xkb_layout us,se
xkb_options "grp:switch,ctrl:nocaps"
@dln
dln / fixfonts.sh
Created November 8, 2019 09:52
Subpixel rendering and proper font hints on Arch
yay -Sy freetype2-cleartype
mkdir -p ~/.config/fontconfig/conf.d
ln -s /etc/fonts/conf.avail/10-sub-pixel-rgb.conf ~/.config/fontconfig/conf.d/
ln -s /etc/fonts/conf.avail/11-lcdfilter-default.conf ~/.config/fontconfig/conf.d/
cat <<EOF >~/.Xresources
Xft.dpi: 96
Xft.antialias: true
Xft.hinting: true
@dln
dln / ingressgateway_probes.yaml
Created September 17, 2019 07:46
kustomize from istio helm chart + gke ingress health checks
apiVersion: apps/v1
kind: Deployment
metadata:
name: istio-ingressgateway
spec:
template:
spec:
containers:
- name: istio-proxy
readinessProbe: