Skip to content

Instantly share code, notes, and snippets.

View jveldboom's full-sized avatar

John Veldboom jveldboom

View GitHub Profile
@jveldboom
jveldboom / terraform-workspaces-template.tf
Created November 30, 2018 23:52
terraform-workspaces-template
# S3 Bucket
resource "aws_s3_bucket" "deployment" {
bucket = "${local.deployment_bucket}"
}
# Amazon Certificate Manager
resource "aws_acm_certificate" "cert" {
domain_name = "${local.domain}"
validation_method = "DNS"
}
@jveldboom
jveldboom / terraform-workspaces-vars.tf
Last active November 30, 2018 23:46
terraform-workspaces-vars
locals {
deployment_buckets = {
develop = "my-develop-bucket"
staging = "my-staging-bucket"
production = "my-production-bucket"
}
domains = {
develop = "develop.example.com"
import boto3
ec2 = boto3.client('ec2');
cloudwatch = boto3.client('cloudwatch');
def lambda_handler(event, context):
count = 0
response = ec2.describe_instances()
for r in response['Reservations']:
count += len(r['Instances'])
@jveldboom
jveldboom / order.json
Last active October 20, 2015 16:27
test order
{
"order_num": "5066",
"customer_id": "1",
"po_num": null,
"email": "[email protected]",
"phone": "",
"billing_name": "JOHN VELDBOOM",
"billing_addr1": "289 W MAIN ST",
"billing_addr2": "",
"billing_city": "NESS CITY",
@jveldboom
jveldboom / goaccess.conf
Created May 22, 2015 01:47
GoAccess Log Formats
# stld
log-format %h %^[%d:%t %^] "%m %r %H" %s %b "%u"
# invubu
log-format %h %^[%d:%t %^] %m "%U" "%^" %^ %s %T %b "%u"
class SortMdArray {
public $sort_order = 'asc'; // default
public $sort_key = 'position'; // default
public function sortByKey(&$array) {
usort($array, array(__CLASS__, 'sortByKeyCallback'));
}
function sortByKeyCallback($a, $b) {
if($this->sort_order == 'asc') {
@jveldboom
jveldboom / gist:87615b2a5d49ac04e2c3
Created February 20, 2015 20:36
Apache prefork
<?php
$workers = 400;
//10000
echo 'StartServers '.($workers * .3).PHP_EOL;
echo 'MinSpareServers '.($workers * .05).PHP_EOL;
echo 'MaxSpareServers '.($workers * .10).PHP_EOL;
echo 'ServerLimit '.($workers).PHP_EOL;
echo 'MaxRequestWorkers '.($workers).PHP_EOL;
echo 'MaxRequestsPerChild 10000';
@jveldboom
jveldboom / heka-system.conf
Created January 21, 2015 13:44
monit heka config
check process hekad-system with pidfile /var/run/hekad-system.pid
start program = "/bin/bash -c 'hekad --config=/usr/share/heka/conf.d/system.toml'" with timeout 60 seconds
stop = "/bin/bash -c 'kill -s SIGTERM `cat /var/run/hekad-system.pid`'"
<?php
require '../includes/class.common.php';
require '../includes/class.images.php';
$common = new common;
$images = new images;
// mysql connection
$conn=mysqli_connect("localhost","database","password","database_name");
// Check connection
if (mysqli_connect_errno($conn)) {
@jveldboom
jveldboom / SystemStats.php
Created October 30, 2014 20:51
Combine sar system stats
<?php
/**
* sar documentation http://linux.die.net/man/1/sar
*/
class SystemStats
{
function __construct($sar)
{
$this->sar = $sar;
}