Skip to content

Instantly share code, notes, and snippets.

View neilkuan's full-sized avatar
🎯
Focusing

Neil Kuan neilkuan

🎯
Focusing
View GitHub Profile
aws dms describe-replication-tasks  --query 'ReplicationTasks'[*]['ReplicationTaskIdentifier'] --output text --region [region]

--- example output ---
prod-sync-task
uat-sync-task
dev-sync-task
@neilkuan
neilkuan / cdk-v2-example-sts-role.ts
Created June 9, 2021 03:54
cdk-v2-example-sts-role.ts
import { App, CfnParameter, Stack, StackProps } from 'aws-cdk-lib';
import * as iam from 'aws-cdk-lib/aws-iam';
import { Construct } from 'constructs';
export class MyStack extends Stack {
constructor(scope: Construct, id: string, props: StackProps = {}) {
super(scope, id, props);
const accountPrincipal = new CfnParameter(this, 'accountid', {
default: '',
description: 'trainerAccountId',
import ast
def dict_or_str(object: any):
if type(object) is dict:
print("I am DICT")
return object
elif type(object) is str:
print ("I am Str")
resp = False

Bump Version Manual 0.0.1 to 0.3.0

  • projen version (0.24.12)
  • git version (2.29.2)
$ git ci -a -m "release version 0.3.0"
[main 23b0b60] release version 0.3.0
 2 files changed, 2 insertions(+), 2 deletions(-)

$ git tag v0.3.0
@neilkuan
neilkuan / rhel8-ecs-init-userdata.sh
Created July 7, 2021 10:54
AWS ECS Container Instance OS use Red Hat Enterprise Linux operating system 8.
#!/bin/bash
if [ $# -gt 0 ]; then
INPUT="$1"
fi
ECS_CLUSTER_NAME=${INPUT-default}
yum remove podman-docker -y
echo 'net.ipv4.conf.all.route_localnet = 1' >> /etc/sysctl.conf
#!/bin/bash
sudo amazon-linux-extras install nginx1 -y
sudo systemctl start nginx
@neilkuan
neilkuan / highlow.py
Created July 23, 2021 08:34
highlow.py
count = 0
while True:
# Start of game?
if count == 0:
start_time = time.time()
num = random.randint(1, 100)
print "I'm thinking of a number from 1 to 100. Try to guess it! (Enter 0 to exit)"
# Guess a number
@neilkuan
neilkuan / ubuntu-20.04-docker-client-only.sh
Created August 11, 2021 08:39
ubuntu-20.04-docker-client-only.sh
#!/bin/bash
apt-get update
apt-get install -y apt-transport-https ca-certificates curl gnupg lsb-release
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null
apt-get update
apt-get install -y docker-ce-cli
docker version
@neilkuan
neilkuan / aws-sdk-nodejs-InstanceMetadata.md
Created August 23, 2021 15:53
aws-sdk-nodejs-InstanceMetadata.md
import { STS, GetCallerIdentityCommandOutput } from '@aws-sdk/client-sts';
import { fromInstanceMetadata } from '@aws-sdk/credential-provider-imds';

let data: GetCallerIdentityCommandOutput;
( async ()=> {
let sts: STS;

    sts = new STS({
 credentials: fromInstanceMetadata({
@neilkuan
neilkuan / amazonlinux2-init-cdk-dev-env.sh
Created October 4, 2021 08:04
amazonlinux2-init-cdk-dev-env.sh
#!/bin/bash
sudo su - ec2-user
sudo yum update -y
sleep 15
sudo yum install docker git vim -y
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash
env VERSION=`python tools/getnodeversion.py` make install DESTDIR=`nvm_version_path v$VERSION` PREFIX=""
nvm install --lts
npm