Skip to content

Instantly share code, notes, and snippets.

View jonathanhle's full-sized avatar

Jonathan Le jonathanhle

View GitHub Profile
@jonathanhle
jonathanhle / GoogleAuthenticationCurl.sh
Created March 16, 2023 13:54 — forked from LindaLawton/GoogleAuthenticationCurl.sh
Curl bash script for getting a Google Oauth2 Access token
# Tutorial https://www.daimto.com/how-to-get-a-google-access-token-with-curl/
# YouTube video https://youtu.be/hBC_tVJIx5w
# Client id from Google Developer console
# Client Secret from Google Developer console
# Scope this is a space seprated list of the scopes of access you are requesting.
# Authorization link. Place this in a browser and copy the code that is returned after you accept the scopes.
https://accounts.google.com/o/oauth2/auth?client_id=[Application Client Id]&redirect_uri=http://127.0.0.1&scope=[Scopes]&response_type=code
# Exchange Authorization code for an access token and a refresh token.
# sh -c "$(curl -fsSL https://gist.githubusercontent.com/gjgd/5a08da85a98bf147294f331461e44d1f/raw/a63bf0f4169a8ab651adfa0a56e676e6bc465876/setup-github-action-runner.sh)"
# Update instance
sudo apt update -y
sudo apt upgrade -y
# Install latest version of git
sudo add-apt-repository ppa:git-core/ppa -y
sudo apt-get update
sudo apt-get install git -y
import asyncio
from typing import Coroutine, List, Sequence
def _limit_concurrency(
coroutines: Sequence[Coroutine], concurrency: int
) -> List[Coroutine]:
"""Decorate coroutines to limit concurrency.
Enforces a limit on the number of coroutines that can run concurrently in higher
@jonathanhle
jonathanhle / Security_Tools_for_AWS.MD
Created September 15, 2022 21:26 — forked from markofu/Security_Tools_for_AWS.MD
Security Tools for AWS

Security Tools for AWS

I often get asked which tools are good to use for securing your AWS infrastructure so I figured I'd write a short listof some useful Security Tools for the AWS Cloud Infrastructure.

This list is not intended be something completely exhaustive, more so provide a good launching pad for someone as they dig into AWS and want to make it secure from the start.

Open Source

This section focuses on tools and services provided by the community and released as open-source.

@jonathanhle
jonathanhle / main.tf
Created September 12, 2022 23:07 — forked from rodrigodiez/main.tf
Terraform code to configure ALB listener rules with OIDC authentication with one app per route
variable "aws_lb_listener_arn" {
description = "ARN of the ALB listener to include rules into"
type = "string"
}
variable "okta_auth_server_base_url" {
description = "Base URL of Okta's authorization server"
type = "string"
}
@jonathanhle
jonathanhle / System Design.md
Created September 11, 2022 18:51 — forked from vasanthk/System Design.md
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
@jonathanhle
jonathanhle / Kafka.drawio
Created September 5, 2022 20:18 — forked from alexandreaquiles/Kafka.drawio
draw.io Kafka Diagram (open it in https://draw.io)
<mxfile host="app.diagrams.net" modified="2020-06-03T21:01:58.638Z" agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36" etag="a1-ix2r6zzVVSPH3lcE_" version="12.9.3" type="device"><diagram id="h7GPxYbChwaNLsouTysn" name="Page-1">7V1pd9rG1/80nKYvyNEu8ZJ4SZ3EsWPcp+3/TY9AA6gGDZWEHfrpnxltSHMvi40WhMk5sY0kJLi/ufsyHfVi/vOzby+mt9Qhs44iOT876mVHUWSjp7Nf/MgqPqJpVnxg4rtOctH6wMD9jyQHpeTo0nVIULgwpHQWuoviwRH1PDIKC8ds36cvxcvGdFZ86sKeEHBgMLJn8OgfrhNO46OWYq6P/0bcyTR9MvvG8Zm5nV6cfJNgajv0JXdIveqoFz6lYfzX/OcFmXHipXSJ33e94Wz2wXzihfu84Z9H25ldvHxR/9a1fx/Gtvbb5KGra/Ftnu3ZMvnGX+xnu6MYM3bTT0Of/TXhf11QL1jOiQ/PbDkiHhhT9lEZJcJVQl7j3yVNT3SDCPw+u0CWFj/XJ9O7XA0pffpMPOLbIfUHxH92RyS9Nfve8d2LT2SHc59CKTxc8enScwgnj8xOv0zdkAwW9oiffWGrmR2bhvNZcnrszmYXdEb96L0qkR2dmOx4EPr0ieTO9AxTtY3sTLpqlOwT5CFLUHwmfkh+5g4lEH4mdE5Cf8UuSc7qSoJYwk+yoiXr62W9POV0zU1zS9NIjtkJR0yye68XDfsjWTf4Grob3F9fXy97N18WxuAfpSvfeNddtubBIjqM1mXQySySSe5BMqmmCsmk6FXRSdlNJTtYxEJs7P7kxPq0IL7Lnk742mKPYFKP3K8P5Wlmz9yJx/4eMZpF5zJ5I7
@jonathanhle
jonathanhle / strace.md
Created September 5, 2022 02:46 — forked from shaikhul/strace.md
Strace cheat sheet

Strace cheat sheet

  • trace an executable: strace ls
  • trace specific system call: strace -e open ls
  • trace multiple system call: strace -e trace=open,read,write ls
  • save trace output: strace -o ls.txt ls
  • trace a running linux process: sudo strace -p pid
  • print timestamp: strace -t ls
  • gerate stat: strace -c ls
@jonathanhle
jonathanhle / install_pyenv.sh
Created September 5, 2022 02:28 — forked from styk-tv/ubu22 pyenv
Install pyenv on Ubuntu
#!/bin/bash
sudo apt-get install git python-pip make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev curl
sudo pip install virtualenvwrapper
git clone https://github.com/yyuu/pyenv.git ~/.pyenv
git clone https://github.com/yyuu/pyenv-virtualenvwrapper.git ~/.pyenv/plugins/pyenv-virtualenvwrapper
git clone https://github.com/pyenv/pyenv-virtualenv.git ~/.pyenv/plugins/pyenv-virtualenv
@jonathanhle
jonathanhle / docker-shell.sh
Created September 2, 2022 06:15 — forked from falvarez/docker-shell.sh
Run docker container, mount current working directory and get interactive shell
docker run -ti -v $(pwd):/tmp DOCKER_IMAGE /bin/bash