Skip to content

Instantly share code, notes, and snippets.

View mesaugat's full-sized avatar
🇳🇵
Working from Nepal

Saugat Acharya mesaugat

🇳🇵
Working from Nepal
View GitHub Profile
@mesaugat
mesaugat / promise-promise_promise-async-series-callback-then-promise-promise.js
Last active March 22, 2017 15:50
promise_promise_promise_async_series_callback_then_promise_promise.js
const async = require('async');
const axios = require('axios');
const CronJob = require('cron').CronJob;
let courseList = [
{courseId: 3},
{courseId: 4},
{courseId: 5},
{courseId: 6}
];
@mesaugat
mesaugat / jwt.js
Last active March 13, 2017 09:34
Generate a JWT
/**
* npm install jsonwebtoken
*
* node --harmony jwt.js
*/
const jsonwebtoken = require('jsonwebtoken');
const expiresIn = '1m';
const object = { name: 'WTF' };
@mesaugat
mesaugat / tcin-airtable.js
Last active March 26, 2017 12:30
Script to fetch all companies and their information from https://github.com/mesaugat/tech-companies-in-nepal and push it to Airtable.
/**
* Script to fetch all companies and their information from https://github.com/mesaugat/tech-companies-in-nepal and push it to Airtable.
*
* Some inspiration from https://github.com/poteto/hww-api
*
* I know the script doesn't look good but hey, it works!
*
* Requires node > 7.6
* Run: node --harmony <filename>
*/
--
-- Most commits per user from Jan 2016 to March 2017
-- More than one project can share the same commits if one is a fork of the other
--
-- https://bigquery.cloud.google.com/savedquery/39178653524:a0ff27f9332c4ef2b03ecea1c8dbd3e2
--
SELECT
u.login AS login,
u.location AS location,
COUNT(c.id) AS num_commits
--
-- Most commits per user in JavaScript projects from Jan 2016 to March 2017
-- Change JavaScript to any other language for other metrics
--
-- https://bigquery.cloud.google.com/savedquery/39178653524:00053da8b5534c24881a08d034de9bae
--
SELECT
u.login AS login,
u.location AS location,
COUNT(c.id) AS num_commits
--
-- Most unique commits per user from Jan 2016 to March 2017
--
-- https://bigquery.cloud.google.com/savedquery/39178653524:e4b670a18035460792b0554983dde6ad
--
SELECT
u.login AS login,
u.location AS location,
COUNT(c.id) AS num_commits
FROM
--
-- Most followed users as of March 2017
-- If the user has been unfollowed it still counts as a follow
--
-- https://bigquery.cloud.google.com/savedquery/39178653524:3c9bf26cf2054e50a53d325f869e129a
--
SELECT
u.login AS login,
u.location AS location,
count(f.follower_id) AS num_followers
--
-- Most unique commits from Jan 2016 to March 2017 for `mesaugat`
-- Change `mesaugat` to any other username to get number of commits for that username
--
-- https://bigquery.cloud.google.com/savedquery/39178653524:9a10947dbf8f429da6dd5193592d2d61
--
SELECT
u.login AS login,
u.location AS location,
u.country_code AS country_code,