Skip to content

Instantly share code, notes, and snippets.

@snese
snese / .zshrc
Created July 10, 2025 07:42
zshrc Example to Solve Amazon Q CLI and Cline Shell Integration Issue
# Amazon Q pre block (skip in VS Code)
if [[ "$TERM_PROGRAM" != "vscode" ]]; then
[[ -f "${HOME}/Library/Application Support/amazon-q/shell/zshrc.pre.zsh" ]] && builtin source "${HOME}/Library/Application Support/amazon-q/shell/zshrc.pre.zsh"
fi
# Basic PATH setup
export PATH="/Users/hclo/.codeium/windsurf/bin:$PATH"
export PATH="$PATH:/Users/hclo/.local/bin"
export PATH="$PATH:$HOME/.toolbox/bin"
@snese
snese / launch-instances.sh
Created July 18, 2024 04:49
launch-instances
#!/bin/bash
# 設置參數
INSTANCE_COUNT=5
INSTANCE_NAME_PREFIX="MyInstance"
IMAGE_ID="ami-xxxxxxxxxxxxxxxxx"
INSTANCE_TYPE="t2.micro"
KEY_NAME="your-key-pair-name"
SECURITY_GROUP_ID="sg-xxxxxxxxxxxxxxxxx"
SUBNET_ID="subnet-xxxxxxxxxxxxxxxxx"

Building a Go program for ARM64 and creating a Docker image (Sample)

Note: The following guideline is provided as a sample and should be tested thoroughly before being used in a production environment.

  1. Install and configure Go on the machine.
  2. Write the Go program, making sure it's compatible with the ARM64 architecture.
  3. Create a Dockerfile that uses the 'golang:1.20.1-alpine' base image, compiles the Go program for the ARM64 architecture, and creates a minimal Alpine Linux image for the final Docker image. Here's an example Dockerfile:
@snese
snese / dotnet_core_dockerfile.md
Last active February 8, 2023 01:04
dotnet core dockerfile sample

Dockerfile

x86 Version

# Use a minimal Linux image as the base
FROM alpine:3.13 AS base

# Set the working directory
WORKDIR /app
@snese
snese / ELB Pre-warming.md
Last active September 23, 2022 02:27
ELB Pre-warming Note

Note

BS/ES support ELB pre-warming

Support Cat.

  • Case type: Technical
  • Service: Elastic Load Balancing(ELB)
  • Category: Load balancer related
  • Severity: General guidance
  • Timestamp (UTC) - optional: leave blank
  • Error code description - optional: leave blank
@snese
snese / Private DNS Transfer.md
Last active August 5, 2021 02:51
Private DNS Transfer

VPC Endpoint Private DNS Transfer

Spoke to Share Services VPC

aws ec2 modify-vpc-endpoint \
    --vpc-endpoint-id {VPC ENDPOINT ID} \
    --no-private-dns-enabled \
    --region {REGION}
import * as cdk from '@aws-cdk/core';
import globalaccelerator = require('@aws-cdk/aws-globalaccelerator');
import ec2 = require('@aws-cdk/aws-ec2');
import ecs = require('@aws-cdk/aws-ecs');
import ecsPatterns = require('@aws-cdk/aws-ecs-patterns');
export class AgaStack extends cdk.Stack {
constructor(scope: cdk.Construct, id: string, props?: cdk.StackProps) {
super(scope, id, props);
#!/usr/bin/env node
import 'source-map-support/register';
import * as cdk from '@aws-cdk/core';
import { AppStack, AgaStack } from '../lib/aga-demo-stack';
const app = new cdk.App();
const envEU = { account: process.env.CDK_DEFAULT_ACCOUNT, region: 'eu-west-1' };
const envUS = { account: process.env.CDK_DEFAULT_ACCOUNT, region: 'us-west-2' };
exports.handler = (event, context, callback) => {
//
// if(event.userPoolId === "theSpecialUserPool") {
var maskUsername = maskEmails(event.request.usernameParameter);
console.log("[1]" + maskUsername);
// Identify why was this function invoked
if(event.triggerSource === "CustomMessage_AdminCreateUser") {
// Ensure that your message contains event.request.codeParameter event.request.usernameParameter. This is the placeholder for the code and username that will be sent to your user.
event.response.smsMessage = "This HC Lo and your user name is " + maskUsername + ", temporary password is " + event.request.codeParameter;
event.response.emailSubject = "Welcome to the service";