Skip to content

Instantly share code, notes, and snippets.

View dontlaugh's full-sized avatar

Coleman McFarland dontlaugh

View GitHub Profile
@dontlaugh
dontlaugh / .tmux.conf
Created October 1, 2018 00:19
tmux conf
# Tested on MacOS save to $HOME/.tmux.conf and restart tmux
# Binds, Options
unbind C-b
set-option -g prefix f9
bind f9 send-prefix
setw -g xterm-keys on
set-option -sg escape-time 10
set -g mouse on
@dontlaugh
dontlaugh / tfdebug.tcl
Last active October 12, 2018 01:31
tfdebug
#!/usr/bin/env tclsh
variable tfcount 0
variable Data [dict create]
variable resources [dict create]
variable current_file ""
proc analyze_file {filename} {
global current_file data
set current_file $filename
@dontlaugh
dontlaugh / main.c
Created October 18, 2018 03:02
unnamed pipe between parent and child
#include <stdio.h>
#include <unistd.h>
#include <sys/wait.h>
#include <string.h>
void capture_output(char * cmd, char ** outstr, int max_lines)
{
// we must pass a len 2 array to pipe
int pipefds[2];
// fork() returns a process id
@dontlaugh
dontlaugh / mongo_conn.sh
Created October 19, 2018 17:57
scriptomundo
#!/bin/sh
# Install:
# chmod +x mongo_conn.sh
# ./mongo_conn.sh
MONGO_USER=""
MONGO_PASS=""
HOST_1="10.135.7.252"
HOST_2="10.135.4.81"
@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")));
@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 / _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
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
<?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>
@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)