Skip to content

Instantly share code, notes, and snippets.

@jamesbjackson
jamesbjackson / ecs-autoscaing.json
Created December 15, 2017 12:49 — forked from igorlg/ecs-autoscaing.json
AWS CloudFormation template for ECS AutoScaling Group
{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "Template for a VPC with High Availability NAT for ECS",
"Parameters": {
"ClusterName": {
"Description": "The ECS Cluster Name",
"Type": "String"
},
"InstanceType": {
"Description": "NAT instance type",
@jamesbjackson
jamesbjackson / disable-ipv6.sh
Created December 15, 2017 12:47 — forked from kwilczynski/disable-ipv6.sh
Amazon Linux OS tweaks
#!/bin/bash
set -u
set -e
set -o pipefail
export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
cat <<'EOF' > /etc/modprobe.d/blacklist-ipv6.conf

Better SSH Authorized Keys Management

A seemingly common problem that people encounter is how to handle all of your users authorized_keys file.

People struggle over management, ensuring that users only have specific keys in the authorized_keys file or even a method for expiring keys. A centralized key management system could help provide all of this functionality with a little scripting.

One piece of functionality overlooked in OpenSSH is the AuthorizedKeysCommand configuration keyword. This configuration allows you to specify a command that will run during login to retrieve a users public key file from a remote source and perform validation just as if the authorized_keys file was local.

Here is an example directory structure for a set of users with SSH public keys that can be shared out via a web server:

@jamesbjackson
jamesbjackson / AWS.js
Created October 11, 2017 11:19 — forked from zircote/AWS.js
Google Script for Excel and AWS instance pricing + Reserved Instances
/**=
* User: zircote
* Date: 16/10/2013
* Time: 08:59
*/
var SERVICE_HOST = 'http://aws.amazon.com'
var data_sources = {
"linux-od": {
@jamesbjackson
jamesbjackson / tls-client.go
Created July 11, 2017 13:25 — forked from michaljemala/tls-client.go
SSL Client Authentication Golang sample
package main
import (
"crypto/tls"
"crypto/x509"
"flag"
"io/ioutil"
"log"
"net/http"
)
@jamesbjackson
jamesbjackson / gist:331b71eb414e3b9279e64de035165e9c
Created June 11, 2017 08:33 — forked from julianlam/expose-directory-on-host-to-lxc-container.md
Exposing a directory on the host machine to an LXC container

Exposing a directory on the host machine to an LXC container

  1. Log into the container and create an empty directory, this will be the mount point
  2. Log out and stop the container.
  3. Open to your container's config file
    • For regular LXC containers: /var/lib/lxc/mycontainer/config
    • For unprivileged LXC containers: $HOME/.local/share/lxc/mycontainer/config
  4. Add a new line above the lxc.mount directive, that follows the format below. Substitute proper paths as necessary:
    • lxc.mount.entry = /path/to/folder/on/host /path/to/mount/point none bind 0 0
  • Both of these paths are relative to the host machine.

Write Performance Benchmark

This document will allow anyone to verify the benchmark result of writing 2 - 3 million metrics per second into DalmatinerDB. This is a single node benchmark to keep things simple and easily comparable between time series databases that don't support clustering.

We will setup 2 Haggar servers to generate metrics and fire them at a single node DalmatinerDB server as per this diagram.

dalmatiner benchmark

You can expect near linear performance results as a DalmatinerDB cluster is horizontally scaled.

DalmatinerDB Installation Guide (Linux)

These instructions outline how to install DalmatinerDB on a single Linux x86_64 physical server or virtual machine. Scaling out will be covered in a future document. This setup guide also covers configuring CAdvisor and Telegraf to send in monitoring data and Grafana to build dashboards.

Here's how everything connects together:

dalmatiner architecture

Create a VM

#!/usr/bin/python -tt
#
import datetime
import json
import logging
import logging.handlers
import optparse
import os
import re
import shutil
@jamesbjackson
jamesbjackson / userstyle.css
Created May 31, 2017 08:54 — forked from fastdivision/userstyle.css
Sane Flowdock Redesign with Stylebot (Browser) or userstyle.css (Native Flowdock OS X App)
/*
* Sane Flowdock Redesign Overrides
* Option 1: Copy and paste CSS into Stylebot
* Option 2: Save file as `userstyle.css` inside ~/Library/Application Support/Flowdock, hit CMD+R to reload app
*/
body {
font-family: -apple-system, BlinkMacSystemFont, Arial, Helvetica, sans-serif !important;
}