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 / .gitconfig
Created February 14, 2022 21:44
My .gitconfig alias
[alias]
a = add
ap = add -p
amend-all = !git add -A && git commit --amend --no-edit
c = commit --verbose
ca = commit -a --verbose
cm = commit -m
co = checkout
cam = commit -a -m
br = !git branch -av
@noinarisak
noinarisak / okta_client_credential_flow_example.sh
Last active November 17, 2021 14:58
Okta client credential flow example in bash
#!/usr/bin/env bash
set -e
# More details at https://bit.ly/3FlOmYd
# Update and set the client_id and client_secrect
client_id=_GET_THIS_FROM_YOUR_APP_GENERALS_SCREEN_
client_secret=_GET_THIS_FROM_YOUR_APP_GENERALS_SCREEN_
# Update the Okta root domain url and GUID Authorization Server (NOTE: Okta default is call 'default')
@noinarisak
noinarisak / okta-cli_examples.sh
Last active July 27, 2021 14:38
OKTA-CLI Examples
# Pre-req's
# - Validate macOS Mojava 10.14.6
# - pipx (https://pypa.github.io/pipx) - Highly recommended ;)
# - okta-cli (from https://pypi.org/project/okta-cli/ not cli that is more creating the OIDC Apps cli)
# - jq (https://stedolan.github.io/jq/download/ or 'brew install jq')
#
# List DEPROVISION users, every attribute
okta-cli users list --deprovisioned --json | \
jq '.[]'
@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}}'
}
@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 / 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 / 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 / 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 / Dockerfile
Last active March 1, 2024 10:20
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 / 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