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
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
# WIP
name: deploy-heroku
# Trigger only on v#.#.#-Release tag
on:
push:
tags:
- "v*.*.*-release"
@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}
@noinarisak
noinarisak / README.md
Last active April 26, 2020 23:09
Makefile Python Boilerplate

Makefile Python Boilerplate

Contains boilerplate Makefile for Python development work.

Quick start

$ make

# Output...
# //BUG: There is bug in the '-e'. Maybe have to two sed calls to the same log file?
function scrub_log() {
sed -i -e 's/^Authorization: SSWS.*/Authorization: SSWS not_real_base64_token/g' -e 's/^Authorization: Bearer.*/Authorization: Bearer not_real_base64_token/g' @{1}
}
@noinarisak
noinarisak / README.md
Last active February 14, 2020 16:19
Okta Postman Environment JSON File.

Okta Postman Environment JSON Template.

Use to setup the environments for Okta API calls.

Setup Okta Org Custom Domain with Let's Encypt

Table of Content

  • Requirements (#requirements)

Requirements

  • Okta Tenant. Get one here
  • Docker (My example is Docker for Mac)
  • Domain Name that you control. (Need to add DNS records so both Okta and Let's Encypt can validate your domain)

Makefile Base Boilerplate

Contains boilerplate Makefile for development work.

@noinarisak
noinarisak / audit_mixin.py
Created January 29, 2019 15:13 — forked from techniq/audit_mixin.py
Useful SQLAlchemy Mixins
from datetime import datetime
from sqlalchemy import Column, Integer, DateTime, ForeignKey
from sqlalchemy.orm import relationship
from sqlalchemy.ext.declarative import declared_attr
from flask_security import current_user
class AuditMixin(object):
created_at = Column(DateTime, default=datetime.now)
updated_at = Column(DateTime, default=datetime.now, onupdate=datetime.now)