Skip to content

Instantly share code, notes, and snippets.

View artburkart's full-sized avatar
💭
why

Arthur Burkart artburkart

💭
why
  • Coinbase
  • somewhere rainy, probably
View GitHub Profile
@artburkart
artburkart / commands.md
Last active March 27, 2017 02:09
Terraform #12716

Should look like this:

$ tree
.
├── production
│   ├── production.tf
│   └── terraform.tfstate
└── site
    └── main.tf
@artburkart
artburkart / LambdaFunctionOverHttps.js
Last active August 30, 2018 02:36
testing_localstack_apigateway_lambda
console.log('Loading function');
var AWS = require('aws-sdk');
var dynamo = new AWS.DynamoDB.DocumentClient();
/**
* Provide an event that contains the following keys:
*
* - operation: one of the operations in the switch statement below
* - tableName: required for operations that interact with DynamoDB
@artburkart
artburkart / main.tf
Created June 14, 2017 02:39
aws_security_group test thing
provider "aws" {
region = "us-east-1"
}
variable "cidr" {
# default = "0.0.0.0/0"
default = ""
}
resource "aws_security_group" "dummy" {
@artburkart
artburkart / README.md
Created June 14, 2017 03:50
testing terraform tags from data sources

Usage

  1. If you run terraform plan agains the main.tf as-is, you get this output:
+ aws_ebs_volume.ebs_vol
    availability_zone: "us-east-1"
    encrypted:         "<computed>"
    iops:              "<computed>"
    kms_key_id:        "<computed>"
    size:              "40"
@artburkart
artburkart / copy_kv.sh
Created June 14, 2017 20:12
backup consul kv store with terraform (used for upgrading consul versions that didn't have backups)
import subprocess
import json
import base64
import os
# Gather all key values
keys = json.loads(subprocess.check_output(['curl', '-sL', 'http://localhost:8500/v1/kv/?keys']))
# Map them to their values
kvs = {}
@artburkart
artburkart / influx_crash.log
Created August 3, 2017 19:23
influx crash log
This file has been truncated, but you can view the full file.
Ran this query through Grafana:
SELECT mean("thread_cache_needed") AS "Thread Cache Needed" FROM (SELECT 100 - (("threads_created" / "connections") * 100) AS "thread_cache_needed" FROM "mysql" WHERE $timeFilter AND "host" = 'ip-10-20-0-127.ec2.internal' fill(null)) WHERE $timeFilter GROUP BY time($__interval) fill(null)
InfluxDB Log:
...snip.....
[I] 2017-08-03T18:13:12Z SELECT mean(thread_cache_needed) AS "Thread Cache Needed" FROM (SELECT 100 - ((threads_created / connections) * 100) AS thread_cache_needed FROM simplisafe.autogen.mysql WHERE time > 1500514212972ms AND time < 1500522389529ms AND host = '10.0.0.1') WHERE time > 1500514212972ms AND time < 1500522389529ms GROUP BY time(30s) service=query
@artburkart
artburkart / sts-example.js
Created February 24, 2018 06:17
Using aws-sdk npm package with DefaultProviderChain
const AWS = require('aws-sdk');
// Gets copy of default provider chain
const chain = AWS.CredentialProviderChain.defaultProviders.slice(0);
// Inserts additional check for specific profile in ~/.aws/credentials file
chain.splice(2, 0, () => new AWS.SharedIniFileCredentials({profile: 'readonly_user'}));
// Creates credential resolver that uses my custom provider chain
const credentialProvider = new AWS.CredentialProviderChain(chain);
@artburkart
artburkart / ipsec-go-vici-example.go
Created April 25, 2018 22:50
ipsec-go-vici-example.go
package main
import (
"github.com/bronze1man/goStrongswanVici"
"github.com/davecgh/go-spew/spew"
"strings"
)
type Status map[string]map[string]string
@artburkart
artburkart / route-eth0
Last active June 8, 2018 17:15
Persisting advmss across reboots
#!/bin/bash
# This takes advantage of the code in /etc/sysconfig/network-scripts/ifup-routes
# handle_file () {
# . $1
# routenum=0
# while [ "x$(eval echo '$'ADDRESS$routenum)x" != "xx" ]; do
# eval $(ipcalc -p $(eval echo '$'ADDRESS$routenum) $(eval echo '$'NETMASK$routenum))
# line="$(eval echo '$'ADDRESS$routenum)/$PREFIX"
# if [ "x$(eval echo '$'GATEWAY$routenum)x" != "xx" ]; then
@artburkart
artburkart / alert.js
Created September 14, 2018 07:27
alert.js
alert('testing xss vulnerability');