Skip to content

Instantly share code, notes, and snippets.

View sophea's full-sized avatar
💭
https://medium.com/@sopheamak

sophea sophea

💭
https://medium.com/@sopheamak
View GitHub Profile
Option Explicit
'Main Function
Function SpellNumber(ByVal MyNumber)
Dim Dollars, Cents, Temp
Dim DecimalPlace, Count
ReDim Place(9) As String
Place(2) = " Thousand "
Place(3) = " Million "
Place(4) = " Billion "
Place(5) = " Trillion "
@sophea
sophea / TracerRequestFilter.java
Created September 2, 2022 06:41
tracer fitler
package com.manulife.ap.config;
import java.io.IOException;
import java.util.Arrays;
import java.util.List;
import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import lombok.extern.slf4j.Slf4j;
@sophea
sophea / pre-push
Created July 21, 2022 04:24
pre-push
#!/bin/sh
#
# Run the following command in the root of your project to install this pre-push hook:
# cp git-hooks/pre-push .git/hooks/pre-push; chmod 700 .git/hooks/pre-push
# @author : Mak Sophea
# @version : 1.0
#
# get the path to this script file
DIR=$(dirname "$0")
#!/bin/sh
# This script will config git hook path into specific folder in your project. This script will invoked by maven build.
# @author : Mak Sophea
# @version : 1.0#
#
echo "config git hooksPath to .githooks folder for commit-msg and pre-push"
git config core.hooksPath .githooks
@sophea
sophea / commit-msg
Created July 21, 2022 04:02
custom commit-msg
#!/usr/bin/env bash
#
# @author : Mak Sophea
# @version : 1.0#
# Create a regex for a conventional commit.
commit_types="(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test|wip)"
convetional_commit_regex="^${commit_types}(\([a-z \-]+\))?!?: .+$"
# Get the commit message (the parameter we're given is just the path to the
# temporary file which holds the message).
@sophea
sophea / sns-team-notification.py
Created May 20, 2021 07:26
lambda sns-team-notification
import urllib3
import json
import logging
import os
logger = logging.getLogger()
logger.setLevel(logging.INFO)
http = urllib3.PoolManager()
@sophea
sophea / ECSFargateLBWithVPCStack.java
Created May 13, 2021 15:14
CDK FargateService with existing VPC java
package com.amazonaws.cdk.examples;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import software.amazon.awscdk.core.Construct;
import software.amazon.awscdk.core.Stack;
import software.amazon.awscdk.core.StackProps;
import software.amazon.awscdk.services.ec2.*;
import software.amazon.awscdk.services.ecr.IRepository;
import software.amazon.awscdk.services.ecr.Repository;
@sophea
sophea / alert_ms_team
Last active February 24, 2024 13:09
Lambda function alert the message to ms-team
import json
import logging
import os
from urllib.request import Request, urlopen
from urllib.error import URLError, HTTPError
HOOK_URL = os.environ['HookUrl']
logger = logging.getLogger()
@sophea
sophea / stop_start_rds_instance
Last active October 6, 2020 08:09
lambda python
import sys
import botocore
import boto3
import json
import logging
from botocore.exceptions import ClientError
rds = boto3.client('rds')
logger = logging.getLogger()
logger.setLevel(logging.INFO)
package com.sma.rabbitmq.service;
import com.sma.rabbitmq.model.Category;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
/**