Skip to content

Instantly share code, notes, and snippets.

View neilkuan's full-sized avatar
🎯
Focusing

Neil Kuan neilkuan

🎯
Focusing
View GitHub Profile
@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

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
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
@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',
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 / s3-lambda-cdk-sample.ts
Created June 6, 2021 10:43
s3-lambda-cdk-sample.ts
import * as lambda from '@aws-cdk/aws-lambda';
import * as s3 from '@aws-cdk/aws-s3';
import { App, Construct, Stack, StackProps, CfnOutput, RemovalPolicy } from '@aws-cdk/core';
// get date function.
function getdate() {
var date = new Date();
var mm = date.getMonth() + 1; // getMonth() is zero-based
var dd = date.getDate();
return [date.getFullYear(),
(mm>9 ? '' : '0') + mm,
@neilkuan
neilkuan / lambda-test-event-string.md
Created May 24, 2021 08:32
lambda-test-event-string.md
{
  "Records": [
    {
      "body": "{\"url\": \"https://apps.apple.com/tw/app/facebook/id284882215\",\"line\": {\"reply\": {\"replyToken\": \"mockvalue\"}}}"
    }
  ]
}
@neilkuan
neilkuan / amazon-linux2-install-mysql-5.7.md
Last active May 16, 2021 08:28
amazon-linux2-install-mysql-5.7.md
@neilkuan
neilkuan / ssh-keygen.md
Created May 3, 2021 08:19
ssh-keygen.md

The note for ssh-keygen

OS: Centos7 and MacOS(amd)

# example
# ssh-keygen -t rsa -b 4096 -f $HOME/.ssh/[filename] -P "" -C [email]
# -t type [dsa | ecdsa | ed25519 | rsa]
# -b bits
# -f [output_keyfile]

kind.yaml

apiVersion: kind.x-k8s.io/v1alpha4
kind: Cluster
nodes:
  - role: control-plane
    extraPortMappings:
      - containerPort: 30002  
        hostPort: 30002       
 - role: worker