Skip to content

Instantly share code, notes, and snippets.

View kapiltekwani's full-sized avatar

Kapil Tekwani kapiltekwani

View GitHub Profile
@kapiltekwani
kapiltekwani / grokking_to_leetcode.md
Created July 4, 2022 07:58 — forked from tykurtz/grokking_to_leetcode.md
Grokking the coding interview equivalent leetcode problems

GROKKING NOTES

I liked the way Grokking the coding interview organized problems into learnable patterns. However, the course is expensive and the majority of the time the problems are copy-pasted from leetcode. As the explanations on leetcode are usually just as good, the course really boils down to being a glorified curated list of leetcode problems.

So below I made a list of leetcode problems that are as close to grokking problems as possible.

Pattern: Sliding Window

@kapiltekwani
kapiltekwani / ultimate-ut-cheat-sheet.md
Created May 8, 2018 07:22 — forked from yoavniran/ultimate-ut-cheat-sheet.md
The Ultimate Unit Testing Cheat-sheet For Mocha, Chai and Sinon

The Ultimate Unit Testing Cheat-sheet

For Mocha, Chai and Sinon

using mocha/chai/sinon for node.js unit-tests? check out my utility: mocha-stirrer to easily reuse test components and mock require dependencies


module Memory
# sizes are guessed, I was too lazy to look
# them up and then they are also platform
# dependent
REF_SIZE = 4 # ?
OBJ_OVERHEAD = 4 # ?
FIXNUM_SIZE = 4 # ?
# informational output from analysis
MemoryInfo = Struct.new :roots, :objects, :bytes, :loops
@kapiltekwani
kapiltekwani / app.js
Created May 8, 2017 15:50 — forked from shigeki/app.js
Testing http.request with socket.io
var app = require('express').createServer(),io = require('socket.io').listen(app),http = require('http');
app.listen(8080);
app.get('/', function (req, res) {
res.sendfile(__dirname + '/index.html');
});
io.sockets.on('connection', function (socket) {
var options = {
host: 'www.google.com',
@kapiltekwani
kapiltekwani / chatServer.js
Created May 3, 2017 12:25 — forked from creationix/chatServer.js
A simple TCP based chat server written in node.js
// Load the TCP Library
net = require('net');
// Keep track of the chat clients
var clients = [];
// Start a TCP Server
net.createServer(function (socket) {
// Identify this client
@kapiltekwani
kapiltekwani / clientserver.js
Created May 3, 2017 12:17 — forked from robertklep/clientserver.js
client -> socket.io server 1 (clientserver.js) -> socket.io server 2 (serverserver.js)
var app = require('express')()
, server = require('http').createServer(app)
, io = require('socket.io').listen(server);
server.listen(3012);
app.get('/', function (req, res) {
res.sendfile(__dirname + '/index.html');
});
@kapiltekwani
kapiltekwani / Changes to Support Single-User RVM Install
Created March 8, 2017 09:20 — forked from shanlalit/Changes to Support Single-User RVM Install
Munin passenger plugin with Single-User RVM Install
Munin Passenger Plug-in Installation
Configure the passenger plug-ins according the the guide on http://www.alfajango.com/blog/how-to-monitor-your-railspassenger-app-with-munin/
NOTE: restart munin after implementing the following changes for Single-User RVM
sudo nano /etc/munin/plugin-conf.d/munin-node
[passenger_*]
user root
@kapiltekwani
kapiltekwani / Changes to Support Single-User RVM Install
Created March 8, 2017 09:20 — forked from shanlalit/Changes to Support Single-User RVM Install
Munin passenger plugin with Single-User RVM Install
Munin Passenger Plug-in Installation
Configure the passenger plug-ins according the the guide on http://www.alfajango.com/blog/how-to-monitor-your-railspassenger-app-with-munin/
NOTE: restart munin after implementing the following changes for Single-User RVM
sudo nano /etc/munin/plugin-conf.d/munin-node
[passenger_*]
user root
@kapiltekwani
kapiltekwani / MySQL.md
Created January 5, 2017 07:12 — forked from nrollr/MySQL.md
Install MySQL on El Capitan using Homebrew

Install MySQL on OS X El Capitan

Normally the installation of MySQL can be achieved with a single command, which executes a script provided by MacMiniVault : bash <(curl -Ls http://git.io/eUx7rg)

However, at the time of writing the script is not compatible with OS X El Capitan (10.11)

Install MySQL using Homebrew

An alternative to the aforementioned installation script is installing MySQL using Homebrew. This gist assumes you already have Homebrew installed, if not first read the article "Homebrew and El Capitan"

Make sure Homebrew has the latest formulae, so run brew update first