Skip to content

Instantly share code, notes, and snippets.

@steve-ng
steve-ng / athena.sql
Last active March 28, 2020 13:19
medium post
/* Assume the table is called order on Athena */
SELECT
"item category",
reduce(kv1['Asia Pacific'], 0.0, (s, x) -> s + x, s-> s) AS "Asia Pacific",
reduce(kv1['North America'], 0.0, (s, x) -> s + x, s-> s) AS "North America"
FROM (
SELECT
"item category",
multimap_agg("region", amount) kv1
Lambda Memory Timeout (secs) Routed within VPC Routed to Internet
256MB 30 8 6
256MB 60 17 14
512MB 30 11 10
512MB 60 25 21
test 1
2 3
@steve-ng
steve-ng / nginx.conf
Last active January 18, 2021 07:55
Nginx reverse proxy wss with ssl
server {
listen 443 ssl;
server_name xxx.xx.io
ssl on;
ssl_certificate /etc/asterisk/certs/xxx.io.pem;
ssl_certificate_key /etc/asterisk/certs/xxx.io.key;
ssl_session_timeout 5m;
@steve-ng
steve-ng / Asterisk v12.3 setup
Last active June 18, 2020 10:37
Environment Ubuntu 64bit. This setup will allow SIPML5 to connect to your Asterisk server. Refer to the comment in gist for the location of the configuration files
Asterisk set up step by step guide
1) sudo apt-get update && sudo apt-get upgrade && sudo reboot
2) sudo apt-get install ntp
3) sudo apt-get install build-essential subversion libncurses5-dev libssl-dev libxml2-dev libsqlite3-dev uuid-dev vim-nox
4) Install uuid sudo apt-get install uuid uuid-dev uuid-runtime libuuid1 libjansson-dev
Install srtp
1) mkdir ~/src
2) wget http://srtp.sourceforge.net/srtp-1.4.2.tgz
@steve-ng
steve-ng / DLTS Chrome 35 SIPML5 fix
Last active August 29, 2015 14:02
SIPML5 fix for Chrome v35
/*
* Chrome 35 forced dtls fix
*/
var tmedia_session_jsep01$prev = tmedia_session_jsep01;
tmedia_session_jsep01 = function tmedia_session_jsep01(o_mgr) {
tmedia_session_jsep.call(this, o_mgr);
this.o_media_constraints =
{ 'mandatory':
{
'OfferToReceiveAudio': !!(this.e_type.i_id & tmedia_type_e.AUDIO.i_id),