Skip to content

Instantly share code, notes, and snippets.

@myh-st
myh-st / sample-cicd-glue-cdk.md
Last active May 16, 2023 09:07
Sample CI/CD Glue CDK

เขียน aws cdk ในการเชื่อมต่อ git codcommit เพื่อทำ ci/cd aws glue ประมาณ 3 jobs

Genie

ตัวอย่างการใช้ AWS CDK สำหรับการเชื่อมต่อ Git CodeCommit และสร้าง CI/CD pipeline สำหรับ AWS Glue ที่ประกอบด้วย 3 jobs:

  1. สร้างไฟล์ cdk.json ที่รากของโปรเจคของคุณ (ถ้ายังไม่มี) และตั้งค่าคำสั่งเริ่มต้นสำหรับ CDK:
{
const SECRET_KEY = ENTER YOUR SECRET KEY HERE;
const MAX_TOKENS = 200;
// For more cool AI snippets and demos, follow me on Twitter: https://twitter.com/_abi_
/**
* Completes your prompt with GPT-3
*
* @param {string} prompt Prompt
* @param {number} temperature (Optional) Temperature. 1 is super creative while 0 is very exact and precise. Defaults to 0.4.
@myh-st
myh-st / nc-simtraffic-loop.sh
Created March 22, 2023 03:14
Simulate traffic to test Device42
#!/bin/bash
# Define array of IPs and ports
ips=("10.0.0.1" "10.0.0.2" "10.0.0.3")
ports=(80 8080 3306)
# Loop through the IPs and ports with a random sleep time
for ip in "${ips[@]}"
do
for port in "${ports[@]}"
@myh-st
myh-st / awscontainer.md
Created March 16, 2023 07:34
comparison table of AWS App Runner, ECS on EC2, and ECS on Fargate

ChatGPT

Sure, here's a comparison table of AWS App Runner, ECS on EC2, and ECS on Fargate that includes the pros and cons of each service:

image

Here are some additional details and some additional pros and cons:

@myh-st
myh-st / CalcwSLA.sh
Last active March 1, 2023 08:30
calculate SLA from Cloudwatch metric
#!/bin/bash
INSTANCE_ID="i-0axxxxxxxxxx"
NAMESPACE="AWS/EC2"
METRIC_NAME="StatusCheckFailed_Instance"
START_TIME=$(date -u -d '30 day ago' +%Y-%m-%dT%H:%M:%SZ)
END_TIME=$(date -u +%Y-%m-%dT%H:%M:%SZ)
AWS_PROFILE=my_profile
# Retrieve the metric data
@myh-st
myh-st / latitude_longitude.txt
Created October 21, 2022 02:54 — forked from pjobson/latitude_longitude.txt
Latitude / Longitude DMS, DDM, DD Regular Expressions
Degrees Minutes Seconds (DMS)
40° 26′ 46″ N 79° 58′ 56″ W
40° 26′ 46″ S 79° 58′ 56″ E
90° 0′ 0″ S 180° 0′ 0″ E
40° 26′ 45.9996″ N 79° 58′ 55.2″ E
Latitudes range from 0 to 90.
Longitudes range from 0 to 180.
Minutes & Seconds range from 0-60
Use N, S, E or W as either the last character,
which represents a compass direction North, South, East or West.
@myh-st
myh-st / README.md
Created October 20, 2022 04:02 — forked from citizenrich/README.md
How to setup HAPI FHIR and Postgres in Docker

Start with a fresh folder and copy a hapi.properties into it. It will be mounted into the container.

Carefully make sure your hapi.properties looks like this:

# add postgres
datasource.driver=org.postgresql.Driver
datasource.url=jdbc:postgresql://db:5432/hapi
hibernate.dialect=org.hibernate.dialect.PostgreSQL95Dialect
datasource.username=admin
datasource.password=admin
@myh-st
myh-st / regex.md
Created October 18, 2022 05:26 — forked from debkanchan/regex.md
RegEx for Latitude and Longitude

Regular Expression(RegExp) for Latitude and Longitude

Just Latitude:

^-?([0-8]?[0-9]|90)(\.[0-9]{1,10})$

matches:

  • 56.3847
  • -56.387

unmatches:

@myh-st
myh-st / snat_dnat_advantech.md
Created June 21, 2022 06:45 — forked from tomasinouk/snat_dnat_advantech.md
examples of SNAT, DNAT with iptables for Advantech, Conel routers, with comments (probably will work on other routers where iptables can be manipulated, care needs to be taken on applying these commands after reboot).

Some examples of SNAT, DNAT with iptables with comments

mainly used in start-up script

How to test 'safely'

When we play with iptables aka firewall we might end up in situation, where we execute rule, which has unforseen impact - lock yourself out. Recovering from this situation is necessity.

How to:

  • Enable reboot via SMS.
  • Test all commands in shell first before putting them into Start-up script. This way the command will be wiped out, when unit is rebooted.

masquarade all outgoing packets to be WLAN0 IP

@myh-st
myh-st / install-gcc4.8.5.sh
Last active May 6, 2022 03:55
Install gcc 4.8.5 from rpm
#!/bin/bash
echo "Please run as root"
echo ""
wget --load-cookies /tmp/cookies.txt "https://docs.google.com/uc?export=download&confirm=$(wget --quiet --save-cookies /tmp/cookies.txt --keep-session-cookies --no-check-certificate 'https://docs.google.com/uc?export=download&id=13TU6pnsx1dX5tHOQjgVh2URM9AMqeKcD' -O- | sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/\1\n/p')&id=13TU6pnsx1dX5tHOQjgVh2URM9AMqeKcD" -O gcc48-c++-4.8.5-1.el6.x86_64.rpm && rm -rf /tmp/cookies.txt
rpm -i gcc48-c++-4.8.5-1.el6.x86_64.rpm
mv /usr/bin/gcc48 /usr/bin/gcc && mv /usr/bin/g++48 /usr/bin/g++