Skip to content

Instantly share code, notes, and snippets.

View dln's full-sized avatar
🚀

Daniel Lundin dln

🚀
View GitHub Profile
@dln
dln / clip.sh
Created June 19, 2021 09:48
Copy to clipboard using OSC 52. Works over remote in most terminals.
#!/bin/sh
exec echo -en "\x1b]52;c;$(base64 -w0)\x07"
@dln
dln / envoy-static.yaml
Created June 3, 2021 20:31
Minimal envoy config with static endpoints
static_resources:
listeners:
- name: http
address:
socket_address: { address: 0.0.0.0, port_value: 8080 }
filter_chains:
- filters:
- name: envoy.filters.network.http_connection_manager
typed_config:
"@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager
@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"