Skip to content

Instantly share code, notes, and snippets.

View hoangvx's full-sized avatar
🏠
Working from home

kyo hoangvx

🏠
Working from home
View GitHub Profile
@hoangvx
hoangvx / list.txt
Created February 18, 2022 01:05 — forked from shortjared/list.txt
List of AWS Service Principals
a4b.amazonaws.com
access-analyzer.amazonaws.com
account.amazonaws.com
acm-pca.amazonaws.com
acm.amazonaws.com
airflow-env.amazonaws.com
airflow.amazonaws.com
alexa-appkit.amazon.com
alexa-connectedhome.amazon.com
amazonmq.amazonaws.com
@hoangvx
hoangvx / buildspec.yml
Created December 14, 2018 01:25
AWS codebuild for rails with mariadb ( ruby:2.5.1 )
version: 0.2
env:
variables:
RAILS_ENV: test
RDS_USER: root
RDS_PASSWORD: docker
RDS_DB_NAME: ap_test
phases:
@hoangvx
hoangvx / schedule_ec2.py
Created August 29, 2018 00:38
auto start and stop aws ec2 instance by setting tags name
import boto3
import time
# Example EC2 Instance tags:
#
# Scheduled : True
# ScheduleStart : 06:00
# ScheduleStop : 18:00
##
@hoangvx
hoangvx / schedule_rds.py
Created August 29, 2018 00:34
Create a lambda function for auto start and stop rds instance by add tags into instance. Then, schedule it by cloudwatch event
import boto3
import time
# Example RDS Instance tags:
#
# Scheduled : True
# ScheduleStart : 06:00
# ScheduleStop : 18:00
##
// Calculate distance between 2 point with lat and long
function getDistanceFromGPS(lat1,lon1,lat2,lon2) {
var R = 6371; // Radius of the earth in km
var dLat = deg2rad(lat2-lat1); // deg2rad below
var dLon = deg2rad(lon2-lon1);
var a =
Math.sin(dLat/2) * Math.sin(dLat/2) +
Math.cos(deg2rad(lat1)) * Math.cos(deg2rad(lat2)) *
Math.sin(dLon/2) * Math.sin(dLon/2)
;
@hoangvx
hoangvx / install-opencv-2.4.11-in-ubuntu.sh
Last active August 17, 2017 09:11 — forked from dynamicguy/install-opencv-2.4.11-in-ubuntu.sh
install opencv-2.4.11 in ubuntu
# install dependencies
sudo apt-get update
sudo apt-get install -y build-essential
sudo apt-get install -y cmake
sudo apt-get install -y libgtk2.0-dev
sudo apt-get install -y pkg-config
sudo apt-get install -y python-numpy python-dev
sudo apt-get install -y libavcodec-dev libavformat-dev libswscale-dev
sudo apt-get install -y libjpeg-dev libpng-dev libtiff-dev libjasper-dev