Skip to content

Instantly share code, notes, and snippets.

View NguyenTungs's full-sized avatar

Nguyen Tung NguyenTungs

View GitHub Profile
@NguyenTungs
NguyenTungs / notify-awssns2fcm.js
Created December 22, 2017 06:57 — forked from shinoda-ak/notify-awssns2fcm.js
Notify FCM for Android via AWS SNS
// Notify Target ARN for Android device
'use strict';
const AWS = require('aws-sdk');
const sns = new AWS.SNS({
apiVersion: '2010-03-31',
region: 'MY_REGION'
});
if (process.argv.length < 3) {
console.log('Usage: node notify.js ENDPOINT_ARN');
process.exit();
@NguyenTungs
NguyenTungs / aws.sns.js
Created December 22, 2017 04:16 — forked from anshul313/aws.sns.js
AWS SNS ( Simple Push Notification ) using Node.js
var AWS = require('aws-sdk');
AWS.config.update({accessKeyId: config.AWSAccessKeyId, secretAccessKey: config.AWSSecretKey,{region: config.AWSRegion}});
var sns = AWS.SNS();
var params ={
Name:"test",
Platform:"GCM",//or APNS (Apple ) or ADM (Amazon)
Attributes:{ // required
@NguyenTungs
NguyenTungs / html5-video-streamer.js
Created April 24, 2017 07:05 — forked from lleo/html5-video-streamer.js
This is an enhancement to Gist#1993068 https://gist.github.com/paolorossi/1993068 . I found what was needed to demonstrate a functioning video stream was a HTML file with a <video> tag pointing to the streamer.
#!/usr/bin/env node
/*
* Inspired by: http://stackoverflow.com/questions/4360060/video-streaming-with-html-5-via-node-js
* Modified from https://gist.github.com/paolorossi/1993068
*/
var http = require('http')
, fs = require('fs')
, util = require('util')
@NguyenTungs
NguyenTungs / app.js
Created June 25, 2016 08:49 — forked from DanisHack/app.js
Rendering angularjs app using ejs from node server and how to use a JS variable which is passed to ejs template for angular app.
//@server in express js file
var data = {};
data.title = "My First APP";
data.arr=[{x:1, y:1}, {x:2, y:2}, {x:3, y:4}];
res.render('/ejsFile', data);