Skip to content

Instantly share code, notes, and snippets.

View hermannolafs's full-sized avatar
☸️

Hermann Ólafsson hermannolafs

☸️
View GitHub Profile
@hermannolafs
hermannolafs / Makefile
Created February 11, 2025 09:22
make command to convert .env to .env.fish (with --global)
convert-env-file-to-fish: ## take the existing .env and convert to fish format in .env.fish
@awk '{ split($$1, a, "="); printf "set -gx %s \"%s\"\n", a[1], a[2]; }' .env > .env.fish
@hermannolafs
hermannolafs / Makefile
Created November 27, 2024 13:00
AWK Makefile help message,
.DEFAULT_GOAL := help
.PHONY: help
help: ## This help message
@awk -F '[, ]+' '/^[a-zA-Z0-9_-]+:.*##/ { \
target = $$0; \
sub(/^[ \t]*/, "", target); \
sub(/:.*##/, "##", target); \
split(target, parts, "##"); \
gsub(/^[ \t]*|[ \t]*$$/, "", parts[1]); \
@hermannolafs
hermannolafs / release.yaml
Created October 29, 2024 12:28
GitHub action to build and push container and helm chart to ghcr.io
name: Example of building a container and it's relevant helm chart, and pushing to container registry
on:
release:
types: [ published ]
permissions:
contents: read
jobs:
@hermannolafs
hermannolafs / helm.tf
Last active October 18, 2024 11:45
Terraform which bootstraps Cert Manager CRDs, Cert Manager helm chart and Traefik using the Kubernetes and Helm providers
##########################################
# Cert manager
##########################################
data "http" "cert_manager_crds" {
url = "https://github.com/cert-manager/cert-manager/releases/download/v${var.cert_manager_version}/cert-manager.crds.yaml"
}
locals {
cert_manager_crds = {
@hermannolafs
hermannolafs / main.tf
Last active October 29, 2024 14:45
terraform cert manager crds and helm chart install
# It's recommended to install this before the chart
# This is part of bootstrapping a cluster,
# but you probably should not be doing it this way, dingus
data "http" "cm_crds" {
url = "https://github.com/cert-manager/cert-manager/releases/download/v${var.cert_manager_version}/cert-manager.crds.yaml"
}
locals {
crd_map = {
@hermannolafs
hermannolafs / dev_vm.tf
Last active October 14, 2024 08:42
Azure Developer VM: Azure VM with AADSSHLoginForLinux extension, auto shutdown and VM AD login roles
terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~> 4.0"
}
azuread = {
source = "hashicorp/azuread"
version = "~> 3.0"
@hermannolafs
hermannolafs / flake.nix
Created July 4, 2024 12:36
Starting minikube with qemu, installed with Nix, on Apple Silicon.
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
nix-darwin.url = "github:LnL7/nix-darwin";
nix-darwin.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = inputs@{ self, nix-darwin, nixpkgs }:
let
configuration = { pkgs, ... }: {
@hermannolafs
hermannolafs / az.ssh.vm.pf.sh
Created January 31, 2024 10:34
az ssh vm port forward
az ssh vm --ip 1.2.3.4 -- "-L 3000:127.0.0.1:3000"
@hermannolafs
hermannolafs / configuration.nix
Last active December 19, 2024 12:27
Nixos Gnome RDP Remote Desktop
{
# minimized for clarity.
# Some of these might not be needed. After some trial and error
# I got this working with these configs.
# I do not have the patience to rn an elimination test.
services.gnome.gnome-remote-desktop.enable = true;
# Enable the X11 windowing system.
services.xserver.enable = true;
@hermannolafs
hermannolafs / kubectl-unset.sh
Last active July 4, 2024 12:38
Unset/Cleanup kubernetes context/config/clusters/users/current-context
kubectl config unset clusters && kubectl config unset contexts && kubectl config unset users && kubectl config unset current-context