Skip to content

Instantly share code, notes, and snippets.

View jonathanhle's full-sized avatar

Jonathan Le jonathanhle

View GitHub Profile
@jonathanhle
jonathanhle / AWS.js
Created December 10, 2016 00:05 — forked from zircote/AWS.js
Google Script for Excel and AWS instance pricing + Reserved Instances
/**=
* User: zircote
* Date: 16/10/2013
* Time: 08:59
*/
var SERVICE_HOST = 'http://aws.amazon.com'
var data_sources = {
"linux-od": {

📂 repo_root/

📄 Jenkinsfile (has no file extension, references tasks in xx_BUILD_STEP folders below)

📂 01_BUILD/
    📄  _build.sh
        Dockerfile.build
    (optional - add more files for BUILD stage here)

📂 02_UNIT_TESTS/

// https://blog.crashtest-security.com/lambda-edge-to-configure-http-security-headers-for-cloudfront-34a44775061d
'use strict';
exports.handler = (event, context, callback) => {
const response = event.Records[0].cf.response;
const headers = response.headers;
// Add security headers
@jonathanhle
jonathanhle / README.md
Created February 15, 2019 01:36 — forked from antonbabenko/README.md
Example of using terraform-aws-modules/vpc/aws module with Terragrunt

This is an example of how to use Terraform AWS registry modules with Terragrunt.

Notes:

  1. source has to be full git URL and not Terraform Registry open issue #311
  2. File main_providers.tf is named so, because it will be copied to another local directory and merged with module's code. If such file exists in the module already then it will overwrite the one provided by the module.
@jonathanhle
jonathanhle / secretsmanager.tf
Created February 22, 2019 23:14 — forked from anttu/secretsmanager.tf
Terraform AWS Secrets Manager example with key and value
resource "aws_secretsmanager_secret" "IRCSecrets" {
name = "irc/client/credentials"
description = "My IRC client credentials"
}
resource "aws_secretsmanager_secret_version" "IRCCredentials" {
secret_id = "${aws_secretsmanager_secret.IRCSecrets.id}"
secret_string = "{\"username\":\"AzureDiamond\",\"password\":\"hunter2\"}"
}
@jonathanhle
jonathanhle / go-ssh-reverse-tunnel.go
Created March 4, 2019 23:44 — forked from codref/go-ssh-reverse-tunnel.go
Go SSH reverse tunnel implementation (SSH -R)
/*
Go-Language implementation of an SSH Reverse Tunnel, the equivalent of below SSH command:
ssh -R 8080:127.0.0.1:8080 operatore@146.148.22.123
which opens a tunnel between the two endpoints and permit to exchange information on this direction:
server:8080 -----> client:8080
@jonathanhle
jonathanhle / botos3upload.py
Created March 10, 2019 17:01 — forked from SavvyGuard/botos3upload.py
Use boto to upload directory into s3
import boto
import boto.s3
import os.path
import sys
# Fill these in - you get them when you sign up for S3
AWS_ACCESS_KEY_ID = ''
AWS_ACCESS_KEY_SECRET = ''
# Fill in info on data to upload
@jonathanhle
jonathanhle / lambda_assume_role.py
Created March 10, 2019 19:29 — forked from ozgurakan/lambda_assume_role.py
Assume Role within A Lambda function (Python)
import boto3
# you can assign role in the function like below
# ROLE_ARN = 'arn:aws:iam::01234567890:role/my_role'
#
# or you can pass role as an evironment varibale
# ROLE_ARN = os.environ['role_arn']
ROLE_ARN = = os.environ['role_arn']
@jonathanhle
jonathanhle / requests-with-retry.py
Created May 29, 2019 00:40 — forked from benjiao/requests-with-retry.py
Python requests with retry
import requests
from requests.adapters import HTTPAdapter
from requests.packages.urllib3.util.retry import Retry
with requests.Session() as s:
retries = Retry(
total=10,
backoff_factor=0.2,
status_forcelist=[500, 502, 503, 504])
@jonathanhle
jonathanhle / zipapp.md
Created June 2, 2019 17:26 — forked from lukassup/zipapp.md
Python zipapp

Python zipapp web apps

What's a zipapp?

This concept is very much like .jar or .war archives in Java.

NOTE: The built .pyz zipapp can run on both Python 2 & 3 but you can only build .pyz zipapps with Python 3.5 or later.

Initial setup