Skip to content

Instantly share code, notes, and snippets.

@kradalby
kradalby / ssh.nix
Created December 1, 2022 10:22
SSH NixOS bootstrap
{pkgs, ...}: {
services.openssh = {
enable = true;
# require public key authentication for better security
passwordAuthentication = false;
kbdInteractiveAuthentication = false;
permitRootLogin = "yes";
};
users.users."root".openssh.authorizedKeys.keys = [
@kradalby
kradalby / README.md
Created November 16, 2022 14:28
Quick test server of headscale

Create a folder for test configuration and files:

mkdir headscale-testing
cd headscale-testing
wget -O config.yaml https://github.com/juanfont/headscale/raw/main/config-example.yaml
nix run github:juanfont/headscale#headscale -- serve

In a new window/tmux/session

@kradalby
kradalby / london.md
Last active June 30, 2022 14:11
Reisetips til London

London

Nyttig ting som gjør reisen litt mer behagelig.

Undergrunnen aka The Tube

All betaling på undergrunnen er betalt med kontaktløse kort, så du trenger ikke kjøpe billett eller noe lignende. Det viktigste er at du bruker samme korte når man sjekker inn og ut. På buss sjekker man bare inn. Systemet fungerer også med Apple og Google Pay.

TLDR: "Tap" inn på undergrunnen med kontaktløsekort

@kradalby
kradalby / cloudinit.yaml
Created February 12, 2022 08:23
Oracle Linux 8.5 to NixOS with ESP resizing
#cloud-config
# vim: syntax=yaml
disable_root: false
ssh_authorized_keys: []
write_files:
- path: "/etc/ssh/sshd_config.d/permit_root"
owner: "root:root"
permissions: "0644"
content: |
@kradalby
kradalby / alerts.yaml
Created March 24, 2021 20:09
Prometheus rules for v0.3.2 terraform provider
groups:
- name: alertmanager.rules
rules:
- alert: AlertmanagerFailedReload
annotations:
description: Configuration has failed to load for {{$labels.instance}}.
runbook_url: https://github.com/thanos-io/thanos/tree/main/mixin/runbook.md#alert-name-alertmanagerfailedreload
summary: Reloading an Alertmanager configuration has failed.
expr: |
# Without max_over_time, failed scrapes could create false negatives, see
@kradalby
kradalby / crash.log
Created March 18, 2021 13:53
v0.3.1 panic
This file has been truncated, but you can view the full file.
2021/03/18 13:49:15 [INFO] Terraform version: 0.14.8
2021/03/18 13:49:15 [INFO] Go runtime version: go1.16
2021/03/18 13:49:15 [INFO] CLI args: []string{"/usr/local/bin/terraform", "apply"}
2021/03/18 13:49:15 [DEBUG] Attempting to open CLI config file: /Users/kradalby/.terraformrc
2021/03/18 13:49:15 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2021/03/18 13:49:15 [DEBUG] checking for credentials in "/Users/kradalby/.terraform.d/plugins"
2021/03/18 13:49:15 [DEBUG] ignoring non-existing provider search directory terraform.d/plugins
2021/03/18 13:49:15 [DEBUG] will search for provider plugins in /Users/kradalby/.terraform.d/plugins
2021/03/18 13:49:15 [TRACE] getproviders.SearchLocalDirectory: /Users/kradalby/.terraform.d/plugins is a symlink to /Users/kradalby/.terraform.d/plugins
2021/03/18 13:49:15 [TRACE] getproviders.SearchLocalDirectory: found registry.terraform.io/dmacvicar/libvirt v0.6.3 for darwin_amd64 at /Users/kradalby/.terraform.d/plugins/registry.terraform.io/dmacvicar/libvirt/0.
@kradalby
kradalby / debug.log
Created March 12, 2021 09:12
terraform-provider-kubernetes-alpha v0.3.1 PrometheusRule CRD
2021/03/12 09:11:18 [WARN] Log levels other than TRACE are currently unreliable, and are supported only for backward compatibility.
Use TF_LOG=TRACE to see Terraform's internal logs.
----
2021/03/12 09:11:18 [INFO] Terraform version: 0.14.8
2021/03/12 09:11:18 [INFO] Go runtime version: go1.16
2021/03/12 09:11:18 [INFO] CLI args: []string{"/usr/local/bin/terraform", "plan"}
2021/03/12 09:11:18 [DEBUG] Attempting to open CLI config file: /Users/kradalby/.terraformrc
2021/03/12 09:11:18 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2021/03/12 09:11:18 [DEBUG] checking for credentials in "/Users/kradalby/.terraform.d/plugins"
@kradalby
kradalby / output.log
Created August 29, 2020 07:22
importing vSphere virtual machine with SATA
2020/08/29 08:21:32 [WARN] Log levels other than TRACE are currently unreliable, and are supported only for backward compatibility.
Use TF_LOG=TRACE to see Terraform's internal logs.
----
2020/08/29 08:21:33 [INFO] Terraform version: 0.13.1
2020/08/29 08:21:33 [INFO] Go runtime version: go1.14.7
2020/08/29 08:21:33 [INFO] CLI args: []string{"/usr/local/bin/terraform", "import", "vsphere_virtual_machine.vmac_terra", "/terra/vm/vmac"}
2020/08/29 08:21:33 [DEBUG] Attempting to open CLI config file: /Users/kradalby/.terraformrc
2020/08/29 08:21:33 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2020/08/29 08:21:33 [DEBUG] ignoring non-existing provider search directory terraform.d/plugins
@kradalby
kradalby / photos_exporter.py
Created August 3, 2020 19:05
Export Photos from Photos.app
""" Export all photos to specified directory using album names as folders
If file has been edited, also export the edited version,
otherwise, export the original version
This will result in duplicate photos if photo is in more than album """
import os.path
import pathlib
import sys
from click import echo as print
@kradalby
kradalby / ssh.ps1
Last active May 2, 2020 19:46
Install SSH on Windows
# Run with:
# iex ((New-Object System.Net.WebClient).DownloadString('URL'))
# Install the OpenSSH Client
Add-WindowsCapability -Online -Name OpenSSH.Client~~~~0.0.1.0
# Install the OpenSSH Server
Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0
Start-Service sshd