Skip to content

Instantly share code, notes, and snippets.

View estahn's full-sized avatar
👨‍💻
ʕʘ̅͜ʘ̅ʔ – ʕ•̫͡•ʕ*̫͡*ʕ•͓͡•ʔ-̫͡-ʕ•̫͡•ʔ

Enrico Stahn estahn

👨‍💻
ʕʘ̅͜ʘ̅ʔ – ʕ•̫͡•ʕ*̫͡*ʕ•͓͡•ʔ-̫͡-ʕ•̫͡•ʔ
View GitHub Profile
var handler = require('lambda-formation').resource.create;
var util = require('lambda-formation').util;
var aws = require("aws-sdk");
/**
* Creates a Hosted Zone and supports delegation sets
*
* Type: "AWS::Route53::HostedZone"
* Properties:
* DelegationSetId: <Your delegation set id>
{% import 'roles/cfn-orchestrator/templates/cfn.macros.j2' as cfn with context %}
---
AWSTemplateFormatVersion: '2010-09-09'
{{ cfn.metadata(1) }}
Description: >
Creates a VPC with DNS and Public IPs enabled.
Creates 4 subnets in 2 AZs (a pair of public/private subnets in each AZ).
---
- debug: var=name
- name: First include of roleA
include_role:
name: roleA
vars:
name: first include
- name: Second include of roleA
allow_duplicates: yes
dependencies:
- { role: roleA, tasks: [1] }
@estahn
estahn / update_docker.sh
Last active March 23, 2017 00:12 — forked from dylanscott/update_docker.sh
Travis Update to Docker 17.03.0
#!/usr/bin/env bash
set -euo pipefail
echo "Installing docker engine"
sudo sh -c 'echo "deb https://apt.dockerproject.org/repo ubuntu-$(lsb_release -cs) main" > /etc/apt/sources.list.d/docker.list'
curl -fsSL https://apt.dockerproject.org/gpg | sudo apt-key add -
sudo apt-key fingerprint 58118E89F3A912897C070ADBF76221572C52609D
sudo apt-get update
sudo apt-get -y install "docker-engine=17.03.0~ce-0~ubuntu-$(lsb_release -cs)"
@estahn
estahn / check-ssl-all-elbs.sh
Last active June 22, 2016 03:43
Check SSL on all ELBs
#!/bin/sh
ELBS=`aws elb describe-load-balancers | jq -r '.LoadBalancerDescriptions[] | select(.ListenerDescriptions[].Listener.SSLCertificateId) | .DNSName'`
for elb in ${ELBS}; do
OUTPUT=`echo | timeout 2 openssl s_client -connect ${elb}:443 2>/dev/null | openssl x509 -noout -enddate 2> /dev/null`
echo "${elb};${OUTPUT}"
done

Nginx Tuning For Best Performance

For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.

Generally, properly configured nginx can handle up to 400,000 to 500,000 requests per second (clustered), most what i saw is 50,000 to 80,000 (non-clustered) requests per second and 30% CPU load, course, this was 2xIntel Xeon with HT enabled, but it can work without problem on slower machines.

You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.

First, you will need to install nginx, my way to install nginx is compiling it from source, but for now we will use apt-get

@estahn
estahn / open_files_per_process.sh
Last active August 29, 2015 14:21
Number of open files per process
#!/bin/sh
processes=$(lsof | cut -f1 -d" " | sort | uniq | xargs -n1 -I% sh -c 'echo % `pidof % | sed -e "s/ /,/g"`' | cut -d" " -f1 -s)
for process in $processes; do
echo $process $(pidof $process | sed -e "s/ /,/g" | xargs -I% -n1 sh -c 'lsof -a -p % | wc -l')
done
@estahn
estahn / designer.html
Created July 26, 2014 02:07
designer
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;
width: 100%;
/**
* WebP support check
*
* The cookie will be set for the top level domain, e.g. ".zanui.com.au".
* This will enable access from "static.zanui.com.au".
*
* Script might not work for local environments.
*
* @author <a href="mailto:enrico.stahn@rocket-internet.de">Enrico Stahn</a>
*/