This gist is an implementation of http://sirile.github.io/2015/05/18/using-haproxy-and-consul-for-dynamic-service-discovery-on-docker.html on top of Docker Machine and Docker Swarm.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# this script queries aws logs with insights filtering on ERROR | |
# explanation of start and end times | |
#--start-time = unix timestamp 30 mins in the past | |
#--end-time = unix timestamp now | |
QUERY_ID=$(aws logs start-query \ | |
--profile $profile \ | |
--log-group-name /aws/lambda/aap-event-consumer-dev \ | |
--start-time `date -v-30M "+%s"` \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function (context, req) { | |
context.log('JavaScript HTTP trigger function processed a request.'); | |
if (req.query.email && req.query.name) { | |
const userEmail = req.query.email; | |
const userDisplayName = req.query.name; | |
getToken().then(token => { | |
/* INVITE A USER TO YOUR TENANT */ | |
var options = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Wrapper MySQL Client for IAM Based Authentication for MySQL and Amazon Aurora on RDS | |
# Read: https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/UsingWithRDS.IAMDBAuth.html | |
# Usage: [app] [aws_profile] [rds_endpoint] [rds_mysql_username] | |
command_exists() { | |
type "$1" &> /dev/null ; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
""" | |
Script that creates Personal Access Token for Gitlab API; | |
Tested with: | |
- Gitlab Community Edition 10.1.4 | |
- Gitlab Enterprise Edition 12.6.2 | |
- Gitlab Enterprise Edition 13.4.4 | |
""" | |
import sys | |
import requests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Took this: | |
# https://s3.amazonaws.com/awsiammedia/public/sample/SAMLAPICLIADFS/samlapi_formauth_adfs3.py | |
# converted to boto3 and smooshed it together with this: | |
# https://gist.github.com/kapilt/ac8e222081f63ba64e93 | |
# which gave birth too this: | |
import sys | |
import botocore | |
import boto3 | |
import requests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// get the original destination for the socket when redirect by linux iptables | |
// refer to https://raw.githubusercontent.com/missdeer/avege/master/src/inbound/redir/redir_iptables.go | |
// | |
const ( | |
SO_ORIGINAL_DST = 80 | |
IP6T_SO_ORIGINAL_DST = 80 | |
) | |
func getOriginalDst(clientConn *net.TCPConn) (rawaddr []byte, host string, newTCPConn *net.TCPConn, err error) { | |
if clientConn == nil { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
function handle_event() { | |
local entry="$1" | |
local action=$(echo $entry | jq -r '.action') | |
local service=$(echo $entry | jq -r '.service') | |
local hook="./hooks/$service/$action" | |
if [ -x "$hook" ]; then | |
"$hook" "$entry" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
b2hex() { echo -n $1|base64 --decode | xxd -p -u | tr -d \\n; } | |
modulus=$(b2hex u2/nlDLMbqLY+XBnWlqHv74a/wvmPoefKv+5NkTU0sbQAEMN7Gar9Hgp50uMUQhiOhwO6L4hezrY021etPyh2Q==) | |
exponent=$(b2hex AQAB) | |
asn1conf=$(echo -e "asn1=SEQUENCE:pubkeyinfo\n[pubkeyinfo]\nalgorithm=SEQUENCE:rsa_alg\npubkey=BITWRAP,SEQUENCE:rsapubkey\n[rsa_alg]\nalgorithm=OID:rsaEncryption\nparameter=NULL\n[rsapubkey]\nn=INTEGER:0x$modulus\ne=INTEGER:0x$exponent" | openssl asn1parse -genconf /dev/stdin -noout -out /dev/stdout | base64) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"errors" | |
"net" | |
"strconv" | |
"syscall" | |
"unsafe" | |
"os" | |
) |
NewerOlder