Skip to content

Instantly share code, notes, and snippets.

{
config,
pkgs,
lib,
...
}:
{
imports = [
./hardware-configuration.nix
{
description = "Minimal NixOS VM install with disko";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.11";
disko.url = "github:nix-community/disko/latest";
disko.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = { self, nixpkgs, disko, ... }: {
{ ... }:
{
disko.devices = {
disk.main = {
type = "disk";
device = "/dev/sda"; # Proxmox: scsi0 = sda
content = {
type = "gpt";
partitions = {
ESP = {
@daemonfire300
daemonfire300 / pingpong.sh
Last active March 20, 2025 10:13
Pod Ping Pong
#!/bin/sh
NS=$1
# Delete existing pods and services if they exist
kubectl -n $NS delete pod pod1 pod2 --ignore-not-found
kubectl -n $NS delete service pod1-svc pod2-svc --ignore-not-found
# Create services
kubectl -n $NS create service clusterip pod1-svc --tcp=8080:8080 --dry-run=client -o yaml | kubectl set selector --local -f - 'run=pod1' -o yaml | kubectl -n $NS apply -f -
kubectl -n $NS create service clusterip pod2-svc --tcp=8080:8080 --dry-run=client -o yaml | kubectl set selector --local -f - 'run=pod2' -o yaml | kubectl -n $NS apply -f -
@daemonfire300
daemonfire300 / example.py
Created February 27, 2025 15:17
Minio STS Sample in Python without RoleArn
import requests
def make_post_request(base_url, action, duration_seconds, web_identity_token, version):
# Define the URL and query parameters
url = base_url
params = {
"Action": action,
"DurationSeconds": duration_seconds,
"WebIdentityToken": web_identity_token,
"Version": version
awk '/-----BEGIN CERTIFICATE-----/{f++}{print > "cert" f ".pem"}' yourfile.pem && for cert in cert*.pem; do kubectl create secret tls $(basename $cert .pem) --cert=$cert --dry-run=client -o yaml | kubectl apply -f -; done
@daemonfire300
daemonfire300 / adm_mut_pol.yaml
Created February 18, 2025 16:13
example-admission-policy
apiVersion: admissionregistration.k8s.io/v1alpha1
kind: MutatingAdmissionPolicy
metadata:
name: "modify-init-container-security-context"
spec:
matchConstraints:
resourceRules:
- apiGroups: ["apps"]
apiVersions: ["v1"]
operations: ["CREATE", "UPDATE"]
apiVersion: projectcalico.org/v3
kind: NetworkPolicy
metadata:
name: allow-same-namespace-communication
namespace: my-namespace
spec:
selector: app == 'myapp' # Applies to pods with the label `app=myapp`
types:
- Ingress
- Egress
@daemonfire300
daemonfire300 / minio.yaml
Created February 4, 2025 15:52
Example Minio Tenant
apiVersion: v1
kind: Secret
metadata:
name: storage-configuration
namespace: minio-tenant
stringData:
config.env: |-
export MINIO_ROOT_USER="minio"
export MINIO_ROOT_PASSWORD="minio123"
export MINIO_STORAGE_CLASS_STANDARD="EC:2"
@daemonfire300
daemonfire300 / email.exs
Created October 13, 2016 12:07
Simple shot at implementing an email validator for use with `Ecto.Changeset`
defmodule YourApp.Validators.Email do
use Ecto.Changeset
@mail_regex ~r/^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/
# ensure that the email looks valid
def validate_email(changeset, field) do
changeset
|> validate_format(field, @mail_regex)
end
end