Skip to content

Instantly share code, notes, and snippets.

View Nikhiladiga's full-sized avatar
🎯
Focusing

Nikhil Adiga Nikhiladiga

🎯
Focusing
View GitHub Profile
/* SPDX-License-Identifier: GPL-2.0
*
* Copyright (C) 2018-2021 WireGuard LLC. All Rights Reserved.
*/
#include <winsock2.h>
#include <Windows.h>
#include <ws2ipdef.h>
#include <iphlpapi.h>
#include <mstcpip.h>

MongoDB Cheat Sheet

Show All Databases

show dbs

Show Current Database

@spalladino
spalladino / mysql-docker.sh
Created December 22, 2015 13:47
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@learncodeacademy
learncodeacademy / cluster.md
Created October 9, 2014 18:11
Node Cluster - Enhance your node app by using all the cores of your processor.

Here's all you have to do to add clustering to your node.js application.

  • save this code as cluster.js, and run cluster.js instead of server.js (or /bin/www, or whatever it's called for your project)
  • the only line you'll need to change is the last line - it needs to point to the location of your server.js file
var cluster = require('cluster');

if (cluster.isMaster) {
  // Count the machine's CPUs
 var cpuCount = require('os').cpus().length;
@richardkazuomiller
richardkazuomiller / proxy.js
Created February 19, 2014 06:52
node-http-proxy routing proxy with websockets
var httpProxy = require('http-proxy')
var proxy = httpProxy.createProxy({
ws : true
});
var options = {
'herp.dev': 'http://0.0.0.0:9008',
'derp.dev' : 'http://0.0.0.0:3000'
}