Skip to content

Instantly share code, notes, and snippets.

View johanot's full-sized avatar

Johan Thomsen johanot

  • Danish Scout and Guide Association
  • Denmark
View GitHub Profile
@johanot
johanot / dblog.class.php
Created January 5, 2013 15:23
Hello World
<?php
require_once('db/DBConnection.php');
require_once('db/DBStatement.php');
require_once('db/DBParameter.php');
require_once('db/DBException.php');
class DBLog
{
<FilesMatch \.php$>
SetHandler "proxy:unix:/run/php/johan.colabo.dk.sock|fcgi://localhost/"
</FilesMatch>
<Proxy unix:/run/php/johan.colabo.dk.sock|fcgi://localhost/>
ProxySet connectiontimeout=5 timeout=240
Allow from all
</Proxy>
@johanot
johanot / test.nix
Created October 14, 2018 15:50
Nix
{ file }:
let
pin = builtins.fromJSON (builtins.readFile file);
in
with pin; import ((import <nixpkgs> {}).fetchgit { inherit rev sha256 url; })
apache.hosts = {
jira = {
hostName = config.services.jira.proxy.name;
proxyTarget = "http://127.0.0.1:${toString config.services.jira.listenPort}";
withAcme = true;
};
johan = {
hostName = "johan.colabo.dk";
#!/usr/bin/env bash
set -euo pipefail
cd $(dirname "${BASH_SOURCE[0]}")
for F in $(ls -1 ../hostgroups/*.nix); do
morph ${@/\{\}/$F}
done
{ config, pkgs, ... }: {
deployment.healthChecks = {
cmd = ["${pkgs.kubectl}/bin/kubectl" "apply" "-f" "${pkgs.writeText "test-pod.yaml" (builtins.toJSON (testPod fqdn))}"];
description = "Run test pod on node: ${fqdn}.";
};
services.foo.enable = true;
# whatevs else
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
labels:
app: dex
name: dex
spec:
replicas: 4
template:
metadata:
{ config, pkgs, lib, ... }:
with lib;
let
desc = "Kubernetes DBC Addons";
cfg = config.services.kubernetes.dbc.addons;
files = with builtins; dir:
remove null
(pkgs.lib.mapAttrsToList
{ config, pkgs, lib, ... }:
with lib;
let
cfg = config.services.kube-router;
# CNI-config file name is hardcoded in kube-router source code
cniConfigFileName = "10-kuberouter.conf";
cniFile = pkgs.writeText "cni.cfg" (builtins.toJSON cfg.cniConfig);
{ deployment }:
let
network = (import deployment).network;
pkgs = network.pkgs;
option = with pkgs.lib; mkOption {
type = types.listOf types.attrs;
};
merge = item: pkgs.lib.recursiveUpdate item {