Skip to content

Instantly share code, notes, and snippets.

@dontlaugh
dontlaugh / cloud-init.yml
Created May 7, 2020 02:24
launch droplet
#cloud-config
users:
- name: coleman
groups:
- wheel
shell: /bin/bash
sudo: ['ALL=(ALL) NOPASSWD:ALL']
ssh-authorized-keys:
@dontlaugh
dontlaugh / haproxy.tf
Created July 7, 2020 18:04
inline cloud-init yaml file
variable "fedora_32" {
default = "ami-0285100bb3546c0e7"
description = "Fedora 32 AMI id from https://alt.fedoraproject.org/cloud/"
}
variable "centos_7" {
default = "ami-0affd4508a5d2481b"
description = "Centos 7 AMI id from Amazon Marketplace"
@dontlaugh
dontlaugh / k3s-001.xml
Last active July 15, 2020 22:30
Output of: virsh dumpxml k3s-001
<domain type='kvm'>
<name>k3s-001</name>
<uuid>fda3dee9-7b9e-42fd-9bf9-54f7e2829424</uuid>
<metadata>
<libosinfo:libosinfo xmlns:libosinfo="http://libosinfo.org/xmlns/libvirt/domain/1.0">
<libosinfo:os id="http://archlinux.org/archlinux/rolling"/>
</libosinfo:libosinfo>
<cockpit_machines:data xmlns:cockpit_machines="https://github.com/cockpit-project/cockpit/tree/master/pkg/machines">
<cockpit_machines:has_install_phase>false</cockpit_machines:has_install_phase>
<cockpit_machines:install_source_type>disk_image</cockpit_machines:install_source_type>
@dontlaugh
dontlaugh / iptables.md
Last active January 1, 2023 01:40
Setting up a libvirt virtual machine lab
                             +-------------------------------------+
                             | `iptables -L`  below                |
                             |                                     |
                             |             +--------+ +--------+   |
                             |             |        | |        |   |
+-----------------+          |             |        | |vnet0   |   |
|                 |          |             |        | |        |   |
| Laptop          |   ???    |             |        | +--------+   |
From 8/4/2020, 3:32:06 PM to 8/4/2020, 3:35:28 PM
2020-08-04T19:32:06.139381959Z
2020-08-04T19:32:06.139431798Z > novelcovid-api@1.0.1 start:scraper /home/container
2020-08-04T19:32:06.139436761Z > node serverScraper.js
2020-08-04T19:32:06.139439244Z
2020-08-04T19:32:06.85437932Z {
2020-08-04T19:32:06.854403359Z message: '[2020-08-04T19:32:06.851Z] ERROR: Failed to load environment variables',
2020-08-04T19:32:06.854407177Z error: "ENOENT: no such file or directory, open '/home/container/.env'",
2020-08-04T19:32:06.854409963Z stack: "Error: ENOENT: no such file or directory, open '/home/container/.env'\n" +
2020-08-04T19:32:06.854413012Z ' at Object.openSync (fs.js:465:3)\n' +
@dontlaugh
dontlaugh / networks.ts
Last active October 25, 2024 08:14
Deno AWS cli example
#!/usr/bin/env -S deno run --allow-read --allow-net --allow-run
/*
This script prints out a list of VPCs, subnets, and route tables.
The output will be different depending on which AWS account you are
connected to.
*/
const {stdout, copy} = Deno;
import iro, {
bold, red, dim, yellow, white, blue, cyan, green
@dontlaugh
dontlaugh / getters.ts
Created August 9, 2020 17:13
Abstract static getters w/o implementation?
abstract class Vpc {
static VpcAlias: string;
// Static getters require a default implementation, so we provide one
// that throws an error. This enforces our subclass overriding.
static get PublicSubnets(): string[] { Vpc.unimplemented("PublicSubnets"); return [""] };
static get PrivateSubnets(): string[] { Vpc.unimplemented("PrivateSubnets"); return [""] };
public static get Subnets(): string[] {
return [...Vpc.PublicSubnets, ...Vpc.PrivateSubnets];
}
@dontlaugh
dontlaugh / generate.go
Created August 14, 2020 15:40
generate random ipv4 address in go
func randomIPFromRange(cidr string) (net.IP, error) {
GENERATE:
ip, ipnet, err := net.ParseCIDR(cidr)
if err != nil {
return nil, err
}
@dontlaugh
dontlaugh / runbook.md
Created August 26, 2020 20:32
What's a runbook?

What's a Runbook?

A runbook is a precise list of steps for doing routine tasks, or debugging a system.

Good candidates for runbooks:

  • procedures with a relatively precise begin state and end state
  • lists of commands for launching a kubernetes cluster
  • lists of commands for tearing down a kubernetes cluster
  • links to dashboards for troubleshooting problems with a particular system,
@dontlaugh
dontlaugh / update-checker.yaml
Last active August 27, 2020 17:18
Data auditing cron job (update-checker)
apiVersion: batch/v1beta1
kind: CronJob
metadata:
name: update-checker
namespace: apis
annotations:
fluxcd.io/automated: "true"
fluxcd.io/tag.update-checker: glob:sha-*
spec:
# Every 6 hours