Skip to content

Instantly share code, notes, and snippets.

View aniruddhanath's full-sized avatar

Aniruddha Nath aniruddhanath

  • Mumbai, India
View GitHub Profile
@aniruddhanath
aniruddhanath / AdbCommands
Created April 4, 2022 12:05 — forked from Pulimet/AdbCommands
Adb useful commands list
adb help // List all comands
== Adb Server
adb kill-server
adb start-server
== Adb Reboot
adb reboot
adb reboot recovery
adb reboot-bootloader
" Don't try to be vi compatible
set nocompatible
" Helps force plugins to load correctly when it is turned back on below
filetype off
" Load plugins
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
@aniruddhanath
aniruddhanath / proxy-server.js
Created August 12, 2016 05:58
Simple HTTP Proxy Server with Node.js
const http = require('http');
const url = require('url');
http.createServer(onRequest).listen(3000);
function onRequest (req, res) {
console.log('serving: ' + req.url);
const u = url.parse(req.url);
@aniruddhanath
aniruddhanath / match-replace.js
Created December 28, 2015 12:19
JavaScript global match group and replace
var hash = { prop_a: "abc", prop_b: "def", prop_c: "ghi" };
function getMatches (string, regex) {
var match;
while (match = regex.exec(string)) {
var prop = match[1];
string = string.slice(0, match.index) + hash[prop] + string.slice(match.index + prop.length + 4);
}
output = string;
}
@aniruddhanath
aniruddhanath / binary-search-tree.js
Created October 1, 2015 07:47
Binary Search Tree
var Node = function (value) {
this.value = value;
this.left = null;
this.right = null;
};
var BinarySearchTree = function() {
this._root = null;
};
@aniruddhanath
aniruddhanath / csv-download.js
Last active November 5, 2017 10:01
Download some data on DOM as CSV
var csvDownload = function (payload) {
var header = '"f1-value", "f2-value", "f3-value", "f4-value"\r\n',
link = document.createElement('a'),
csv;
payload.forEach(function(doc) {
data += '"' + doc.f1 + '",';
data += '"' + doc.f2 + '",';
data += '"' + doc.f3 + '",';
data += '"' + doc.f4 + '"\r\n';