Skip to content

Instantly share code, notes, and snippets.

View raychew13's full-sized avatar

Ray Chew raychew13

View GitHub Profile

Read SQS

aws sqs receive-message --queue-url https://sqs.ap-southeast-2.amazonaws.com/410182434753/forecast-inbound-request-daily-gamma --region ap-southeast-2

# Read 2 messsage at a time
aws sqs receive-message --queue-url https://sqs.ap-southeast-2.amazonaws.com/410182434753/forecast-inbound-request-daily-gamma --region ap-southeast-2 --max-number-of-messages 2

Delete Msg from SQS

@raychew13
raychew13 / cloud_watch.md
Last active August 26, 2021 02:09
Cloud Watch Queries

README

This README would normally document whatever steps are necessary to get your application up and running.

What is this repository for?

# Delete Docker machine
docker-machine rm -y default
# Create Docker machine (default)
docker-machine create -d virtualbox default
# Build image with 4G memory. Some of the machine learning library requires 4G of memory to install.
docker build -t forecast:R1.1 -m 4g .
@raychew13
raychew13 / mysql_tips.sql
Last active February 13, 2018 23:23
Useful SQL
ALTER TABLE forecast.workstream_data
ADD timezone VARCHAR(40);
-- Copying data - specific column from one table to another based on row condition
UPDATE forecast.workstream_data set timezone = (SELECT o.timezone FROM roster.organisation as o where o.id=workstream_data.organisation_id)
WHERE user_id is NULL;
-- Copying data - specific column from one table to another based on row condition
UPDATE forecast.workstream_data set workstream_data.timezone = (
SELECT t.timezone
// Tips on `moment` & `moment-timezone` js library
// Create string from timestamp
const moment = require('moment')
console.log(moment().format(("YYYY-MM-DD_hh-mm-ss")));
// This will print current date & time (i.e '2017-12-20_03-57-59')
// ------------------- intersection of two arrays ------------------- //
let setA = new Set([1, 2, 3, 4, 8]);
let setB = new Set([4, 3, 2, 10, 7]);
let tmpIntersection = new Set([...setA].filter(x => setB.has(x)));
console.log(tmpIntersection);
// return Set { 2, 3, 4 }
console.log( [...setA].filter(x => setB.has(x)) )
// return [ 2, 3, 4 ]
@raychew13
raychew13 / js_arrays_tips.js
Created December 20, 2017 04:42
JavaScripts Tips
var array = [2, 5, 9, 10];
var index = array.indexOf(9);
if (index > -1) {
array.splice(index, 1); // delete from index 3 for 1 item.
}
console.log(array)
// return [ 2, 5, 10 ]
# Install new dependency for dev environmet
npm install thread-sleep --save-dev