Skip to content

Instantly share code, notes, and snippets.

@kumarrishav
kumarrishav / scan.js
Last active August 29, 2015 14:06 — forked from yurenju/scan.js
var fs = require('fs');
var path = require('path');
fs.readFileSync('.jshintignore', {encoding: 'UTF-8'}).split('\n').forEach(function(line) {
if (line && line.indexOf('.js') !== -1) {
if (!fs.existsSync(path.join(process.cwd(), line))) {
console.log('> ' + line);
}
}
});
@kumarrishav
kumarrishav / io.cpp
Last active August 29, 2015 14:27
Fast I/O in C/C++
/*
grab the whole line
char a[100];
cin.getline(a,100);
scanf("%[^\n]",a);
gets(a);
*/
inline void fastRead_int(int *a)
{
@kumarrishav
kumarrishav / LICENSE
Last active August 29, 2015 14:27 — forked from ourmaninamsterdam/LICENSE
Arrayzing - The JavaScript array cheatsheet
The MIT License (MIT)
Copyright (c) 2015 Justin Perry
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
@kumarrishav
kumarrishav / play_song_via_terminal.txt
Created October 10, 2015 12:38
Play Songs via Terminal using VLC
use the following command to play only MP3s
vlc folder/*.mp3 (GUI)
cvlc folder/*.mp3 (CLI) - command line interface
specify additional formats using *.ogg etc.
If there are subfolders -
@kumarrishav
kumarrishav / index.html
Last active October 10, 2015 12:42 — forked from anonymous/index.html
Undo Manager in FxOS SMS app
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
/*jshint esnext: true, strict: true, globalstrict: true, browser: true, expr: true */
clone the the B2G directory :) > https://github.com/mozilla-b2g/B2G
./config.sh flame-kk
./build.sh
./flash.sh
P.S : don't forget to "git pull" first, if you have an existing repository
@kumarrishav
kumarrishav / file
Created October 19, 2015 21:59
How to install Firefox 41 on Linux Mint, Ubuntu, Debian, CentOS, Fedora…
How to install Firefox 41 on Linux Mint, Ubuntu, Debian, CentOS, Fedora…
… or any other Linux distribution.
http://libre-software.net/how-to-install-firefox-on-ubuntu-linux-mint/
This panda (Firefox) has not much to do with installing Firefox on Linux
This how-to explains how to install Firefox 41 on Linux, with or without replacing an existing Firefox installation.
Firefox 41 was released on September 22, 2015.
@kumarrishav
kumarrishav / springer-free-maths-books.md
Created December 31, 2015 15:25 — forked from bishboria/springer-free-maths-books.md
Springer made a bunch of books available for free, these were the direct links
@kumarrishav
kumarrishav / node-on-ec2-port-80.md
Created March 12, 2016 23:57 — forked from kentbrew/node-on-ec2-port-80.md
How I Got Node.js Talking on EC2's Port 80

The Problem

Standard practices say no non-root process gets to talk to the Internet on a port less than 1024. How, then, could I get Node talking on port 80 on EC2? (I wanted it to go as fast as possible and use the smallest possible share of my teeny tiny little micro-instance's resources, so proxying through nginx or Apache seemed suboptimal.)

The temptingly easy but ultimately wrong solution:

Alter the port the script talks to from 8000 to 80:

}).listen(80);
@kumarrishav
kumarrishav / node-weather.js
Created August 5, 2016 12:41 — forked from ydn/node-weather.js
Weather API
var YQL = require('yql');
var query = new YQL('select * from weather.forecast where (location = 94089)');
query.exec(function(err, data) {
var location = data.query.results.channel.location;
var condition = data.query.results.channel.item.condition;
console.log('The current weather in ' + location.city + ', ' + location.region + ' is ' + condition.temp + ' degrees.');
});