Skip to content

Instantly share code, notes, and snippets.

View noinarisak's full-sized avatar
🏠
Working from home

Noi Narisak noinarisak

🏠
Working from home
View GitHub Profile
@noinarisak
noinarisak / Dockerfile
Last active April 23, 2020 18:45
Visual Studio Code - Flask Development
#-------------------------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information.
#-------------------------------------------------------------------------------------------------------------
# Update the VARIANT arg in devcontainer.json to pick a Python version: 3, 3.8, 3.7, 3.6
# To fully customize the contents of this image, use the following Dockerfile instead:
# https://github.com/microsoft/vscode-dev-containers/tree/v0.112.0/containers/python-3/.devcontainer/base.Dockerfile
ARG VARIANT="3"
FROM mcr.microsoft.com/vscode/devcontainers/python:0-${VARIANT}
# WIP
name: deploy-heroku
# Trigger only on v#.#.#-Release tag
on:
push:
tags:
- "v*.*.*-release"
def getSignedJWT(self, privateKey, clientid, aud, algorithm = 'RS256'):
# Algo : RS256, RS384, RS512, ES256, ES384, ES512
now = int(time.time())
token = {'iss': clientid,
'sub': clientid,
'aud': aud,
'iat': now ,
'exp': now + 3600 }
encoded = jwt.encode(token, privateKey, algorithm)
return encoded
@noinarisak
noinarisak / terraform.envrc
Last active July 16, 2020 23:56
Direnv template for Terraform .envrc file
# .envrc with direnv
# Desc:
# Environment Variable debugging Terraform.
# Usage:
# cd into_dir_of_terrafrom_project
# mv terraform.envrc .envrc
#
export TF_LOG=TRACE
export TF_LOG=${PWD}/$(date +"%Y%m%d_%H%M$S").crash.logs
@noinarisak
noinarisak / Dockerfile
Last active July 10, 2025 08:23
VsCode devcontainer development setup for Java 8
#-------------------------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information.
#-------------------------------------------------------------------------------------------------------------
FROM openjdk:8-jdk
# This Dockerfile adds a non-root user with sudo access. Use the "remoteUser"
# property in devcontainer.json to use it. On Linux, the container user's GID/UIDs
# will be updated to match your local UID/GID (when using the dockerFile property).
@noinarisak
noinarisak / README.md
Last active March 14, 2024 15:25
GitHub Actions Deploy by Git Tag to AWS Elastic Beanstalk

GitHub Actions Deploy by Git Tag to AWS Elastic Beanstalk

Example workflow assuming you are using git tags to deploy to AWS EBS. Leveraging the following flow with GH Releases:

  1. Draft Release and manually set Sematic version (eg. Major.Minor.Patch) Using the Release Drafter to automate it.
  2. Reveiw and Publish that version.
  3. Run the DEPLOY TO EBS.
  4. Profit! 🎉
@noinarisak
noinarisak / jwt_helpers.py
Created November 7, 2020 00:01 — forked from linuskohl/jwt_helpers.py
Helper functions to validate JSON Web Tokens for flask RESTful APIs by fetching JWKs from OpenID Provider Metadata. Used with Okta.
from functools import wraps
from flask import request, abort, g
import json
import jwt
import requests
from typing import Union, List
from ..config import cache
from ..env import JWT_ISSUER, JWT_CLIENTID, JWT_AUDIENCE
DISCOVERY_URL = "/.well-known/oauth-authorization-server"
@noinarisak
noinarisak / certbot-okta.sh
Last active April 15, 2021 20:19
Okta + Let's Encypt + AWS Route53
#!/usr/local/bin/bash
set -o pipefail
# Description: LetsEncypt + AWS Rout53 + Okta intergration. Poor mans Okta Custom Domain URL implementation with Let's Encypt and Route53.
# Requirements:
# - Docker
# - Route53 and AWS account (We need aws_access_key_id/aws_secret_access_key pair)
# - Okta Tenant (We need okta url and domain_id) *Beta Domain API has to be enable
#
@noinarisak
noinarisak / main.tf
Last active May 26, 2021 16:59
Example TF okta_idp_saml
# Simple example doing the following:
# a. Adding idp_saml
# b. Adding idp_saml discovery
# c. Adding mock x509 cert, idp_saml_key
# d. Adding profile_mapping
terraform {
required_providers {
okta = {
source = "okta/okta"
@noinarisak
noinarisak / Okta-SignInWidget-Passwordless.html
Last active June 7, 2021 17:08
Okta Sign In Widget Passwordless configuration
<script type="text/javascript">
new OktaSignIn({
baseUrl: "{{config.okta_org_name}}",
logo: "{{config.settings.app_logo}}",
clientId: "{{config.client_id}}",
redirectUri: "{{config.redirect_uri}}",
i18n: {
en: {
'primaryauth.title': 'Sign in to {{config.settings.app_name|safe}}'
}