View nginx-passwd.sh
#!/bin/sh
USERNAME=kopter
PASSWORD=$(openssl rand -base64 12)
SALT=$(openssl rand -base64 3)
SHA1=$(printf "$PASSWORD$SALT" | openssl dgst -binary -sha1 | xxd -ps | sed 's#$#'"`echo -n $SALT | xxd -ps`"'#' | xxd -r -ps | base64)
HEADER=$(printf "$USERNAME:$PASSWORD" | base64)
printf "user: $USERNAME | password: $PASSWORD | %s:{SSHA}%s | Authorization: Basic $HEADER\n" $USERNAME $SHA1
View cloudformation-yaml-to-json.py
#!/usr/bin/env python
import sys, yaml, json
def funcparse(loader, node):
node.value = {
yaml.constructor.ScalarNode: loader.construct_scalar,
yaml.constructor.SequenceNode: loader.construct_sequence,
yaml.constructor.MappingNode: loader.construct_mapping,
}[type(node)](node)
node.tag = node.tag.replace(u'!Ref', 'Ref').replace(u'!', u'Fn::')
View cloudwatch-logs-to-elastic.js
var http = require('http');
var zlib = require('zlib');
var ts = [ 0 ];
var DEBUG = false; // set to `true` to enable timestamps in results
// private IP of the ELK server in "Default VPC"
var endpointHost = '172.31.10.250';
var endpointPort = 9200;
View cloudtrail-parser.js
#!/usr/bin/env node
const fs = require('fs');
function displayEC2Event(event, type) {
if (event.errorCode) {
// -- errors is when someone is using his fat thumbs
console.log('ERROR: ', event.errorCode, event.errorMessage);
} else {
let items = event.responseElements.instancesSet.items;
View publisher.dot
// example of a dependency graph described using Graphviz dot notation
// see the rendering of graphiviz here - http://imgur.com/a/kiUR2
digraph G {
sales_missing_info
None[label="",shape=point]
open[label="Open"]
sales_missing_info[label="Missing Info.",color=darkgreen,fontcolor=darkgreen]
View convert_yaml_to_json.py
#!/usr/bin/env python
import sys
import yaml
import json
with open(sys.argv[1], 'r') as fd_r:
with open(sys.argv[2], 'w') as fd_w:
json.dump(yaml.load(fd_r), fd_w)
View upload-certificate.sh
#!/bin/sh
cert_name="mycompany"
decrypted_rsa_key=$(mktemp `dirname $0`/${cert_name}-com-server-key-UNENCRYPTED.pem.XXXXXXX)
trap "rm -rf $decrypted_rsa_key" EXIT
openssl rsa -in ${cert_name}-com-server-key.pem -out $decrypted_rsa_key
# The certificate chain must start with the immediate signing certificate,
View bash-container.txt
root@89de118f2aa3:~# ps -ef ; date ; nohup ./zombie & ; sleep 2 ; ps -ef ; sleep 65 ; date ; ps -ef
bash: syntax error near unexpected token `;'
root@89de118f2aa3:~# ps -ef ; date ; (nohup ./zombie &) ; sleep 2 ; ps -ef ; sleep 65 ; date ; ps -ef
UID PID PPID C STIME TTY TIME CMD
root 1 0 0 16:41 ? 00:00:00 /bin/bash
root 364 1 0 16:47 ? 00:00:00 ps -ef
Wed May 20 16:47:37 UTC 2015
nohup: appending output to 'nohup.out'
UID PID PPID C STIME TTY TIME CMD
root 1 0 0 16:41 ? 00:00:00 /bin/bash
View go-web.go
package main
import (
"fmt"
"net/http"
)
func handler(w http.ResponseWriter, r *http.Request) {
fmt.Printf(w, "Hello World!")
}
View docker_workshop_microservices_cheat_sheet.md