Skip to content

Instantly share code, notes, and snippets.

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

Vinay Pandya imVinayPandya

🏠
Working from home
View GitHub Profile
var alexa = require('alexa-traffic-rank'),//including alexa traffic rank node js module to get data from alexa.com
mongoose = require('mongoose'); // including mongoose node js module to connect MongoDB
mongoose.connect('mongodb://localhost:27017/test'); // this url should be your mongoDB url
var db = mongoose.connection, // Database connection object
schema = mongoose.Schema({}, {collection: 'AlexaDailyTracks', strict: false, versionKey: false}); // Defining MongoDB Schema
// this code run if you fail to connect database
db.on('error', function(error) {
@imVinayPandya
imVinayPandya / feed.sh
Created January 11, 2017 05:03 — forked from dstoc/feed.sh
Feed rtsp to ffserver as webm via mpegts
ffmpeg -i rtsp://${SOURCE} -vcodec copy -f mpegts -\
| ffmpeg -i pipe:0 -crf 10 -b:v 2M -c:v libvpx -g 25 http://${TARGET}
@imVinayPandya
imVinayPandya / stream.sh
Created January 11, 2017 05:03 — forked from dstoc/stream.sh
Streaming h264 rtsp to youtube
ffmpeg -i rtsp://${SOURCE} -vcodec copy -f flv\
-acodec libmp3lame -ar 44100 -threads 6 -qscale 3 -b:a 712000 -bufsize 512k\
rtmp://a.rtmp.youtube.com/live2/${KEY}
<div *tdLoading="'overlayStarSyntax'; mode:'indeterminate'; type:'circular'; strategy:'overlay'; color:'accent'">
<div layout="column" layout-fill>
<md-toolbar color="primary" class="md-whiteframe-z1">
<span>Login</span>
</md-toolbar>
<div class="md-content" layout-padding flex>
<div layout-gt-xs="row" layout-align-gt-xs="center start" class="margin">
<div flex-gt-xs="50">
@imVinayPandya
imVinayPandya / accountInformationSyncer.js
Last active September 25, 2019 09:31
How to get notification when CRON fails (Node.js).
// Main cron's logic here which will return array of messages
// and it will tell, how i am returning partially/full success result from this function
const accountInformationSyncer = ({ logger, utils, userUtils, interactiveBrokers }) => async () => {
const messages = []; // Array of result
const unexpectedErrors = []; // array of unexpectedErrors
function logInfo(msg) {
const m = `Account information sync: ${msg}`;
logger.info(m); // this will log to console/file
messages.push(m); // this will push message in array