Skip to content

Instantly share code, notes, and snippets.

View dontlaugh's full-sized avatar

Coleman McFarland dontlaugh

View GitHub Profile
@dontlaugh
dontlaugh / iptables.md
Last active January 1, 2023 01:40
Setting up a libvirt virtual machine lab
                             +-------------------------------------+
                             | `iptables -L`  below                |
                             |                                     |
                             |             +--------+ +--------+   |
                             |             |        | |        |   |
+-----------------+          |             |        | |vnet0   |   |
|                 |          |             |        | |        |   |
| Laptop          |   ???    |             |        | +--------+   |
@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 / 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 / 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 / reshape.sh
Created April 23, 2020 18:13
JQ reshape json
#!/bin/bash
# Requires gcloud and jq to be installed
# Get instance name and zone, required for our gcloud query
INSTANCE_NAME=$(curl --silent "http://metadata.google.internal/computeMetadata/v1/instance/name" -H "Metadata-Flavor: Google")
ZONE=$(curl --silent "http://metadata.google.internal/computeMetadata/v1/instance/zone" -H "Metadata-Flavor: Google")
# Get a giant blob of json with our instance's metadata
METADATA=$(gcloud compute instances describe $INSTANCE_NAME --zone $ZONE --format json)
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>author</key>
<string>IceTimux / Andres Michel</string>
<key>name</key>
<string>One Dark</string>
<key>settings</key>
<array>
define("nginx/mod", ["require", "exports"], function (require, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.NginxPackage = "nginx";
});
define("install-nginx-ubuntu", ["require", "exports", "nginx/mod"], function (require, exports, mod_ts_1) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
async function main() {
// Install nginx with apt
@dontlaugh
dontlaugh / _install.sh
Last active October 16, 2023 09:27
fluent-bit install on Centos6
#!/bin/bash
# centos6 build
yum install -y glibc zlib-static flex-devel wget
fb_version="fluent-bit-1.2.1"
wget https://fluentbit.io/releases/1.2/$fb_version.tar.gz
tar -xzf $fb_version.tar.gz
cd ${fb_version}/build
@dontlaugh
dontlaugh / list.h
Created June 27, 2019 01:46
linked list interface
#ifndef LIST_H
#define LIST_H
#include <stdlib.h>
// linked list elements
typedef struct ListElm_ {
void *data;
struct ListElm_ *next;
} ListElm;
@dontlaugh
dontlaugh / empty_elbs.ts
Last active June 14, 2019 02:39
Empty ELBs Deno script
import { dim, red, bold, italic, underline } from "https://deno.land/std/colors/mod.ts";
function printEmptyELBs(elbs: object[]): void {
elbs["LoadBalancerDescriptions"].map((elb) => {
let name = elb["LoadBalancerName"];
let dnsName = elb["DNSName"];
if (elb["Instances"].length < 1) {
console.log(bold(red("Name:")), red(name));
console.log(bold(red("DNS:")), red(dnsName));
console.log(dim(red(" no instances")));