Skip to content

Instantly share code, notes, and snippets.

@hsingh23
hsingh23 / app.js
Created May 7, 2018 14:30 — forked from edujr1/app.js
Clusterizar uma aplicação NodeJS de acordo com o numero máximo de processadores
const cluster = require('cluster');
const numCPUs = require('os').cpus().length;
const express = require('express');
const app = express();
module.exports = app;
cluster.on('exit', (worker, code, signal) => {
console.log(`Worker ${worker.process.pid} died with code: ${code}, and signal: ${signal}`);
console.log('Starting a new worker');
@hsingh23
hsingh23 / WithStatePropsFactory.js
Created September 18, 2017 21:32
WithStatePropsFactory
import { reduce, isFunction, forEach } from 'lodash';
import React, { PureComponent } from 'react';
/**
* WithStatePropsFactory is a Higher Order Function that returns a Higher Order Component https://facebook.github.io/react/docs/higher-order-components.html
* It is similar to withStateHandlers from recompose https://github.com/acdlite/recompose/blob/master/docs/API.md#withstatehandlers but more versitile b/c it handles https://github.com/acdlite/recompose/issues/443
* It can be used to pass in data from async functions to WrappedComponent as props making them easier to test
* initialState
* @param {Object} initialState - the initialState of the HOC
* @param {Object} lifecycle - lifecycle functions that wont be passed down to the WrappedComponent but will be evaluated in context
@hsingh23
hsingh23 / cdbaby-amma-bhajans-7.15.2017.json
Created July 16, 2017 01:18
cdbaby amma bhajans 7.15.2017
{
"Hridayanjali (feat. Swami Pranavamritananda Puri)": {
"name": "Hridayanjali (feat. Swami Pranavamritananda Puri)",
"mp3": "https://content.cdbaby.com/audio/samples/d073192b/Amma26-01.mp3",
"u": "https://store.cdbaby.com/cd/Amma26",
"sn": "rieytdlaieyanjatdliey"
},
"Nin Tirupatatil (Vintage Version)": {
"name": "Nin Tirupatatil (Vintage Version)",
"mp3": "https://content.cdbaby.com/audio/samples/d073192b/Amma26-02.mp3",
@hsingh23
hsingh23 / desert.txt
Created March 13, 2017 15:29
Peanut Butter + Chocolate Recipe
all items are measured by weight
1 part Powdered Sugar
1 part finely ground Gram Cracker
2 parts Peanut Butter either chunky or smooth
1 part Heavy Cream
1 part Good Quality Chocolate
Mix the powdered sugar, gram cracker, and peanut butter together.  spread evenly onto a tray or pan.  
@hsingh23
hsingh23 / Summary of the Amazon S3 Service Disruption
Created March 2, 2017 20:49
Summary of the Amazon S3 Service Disruption in the Northern Virginia (US-EAST-1) Region
https://aws.amazon.com/message/41926/
Summary of the Amazon S3 Service Disruption in the Northern Virginia (US-EAST-1) Region
We’d like to give you some additional information about the service disruption that occurred in the Northern Virginia (US-EAST-1) Region on the morning of February 28th. The Amazon Simple Storage Service (S3) team was debugging an issue causing the S3 billing system to progress more slowly than expected. At 9:37AM PST, an authorized S3 team member using an established playbook executed a command which was intended to remove a small number of servers for one of the S3 subsystems that is used by the S3 billing process. Unfortunately, one of the inputs to the command was entered incorrectly and a larger set of servers was removed than intended. The servers that were inadvertently removed supported two other S3 subsystems. One of these subsystems, the index subsystem, manages the metadata and location information of all S3 objects in the region. This subsystem is necessary to serve all G
.mdl-ripple {
background: #000;
border-radius: 50%;
height: 50px;
left: 0;
opacity: 0;
pointer-events: none;
position: absolute;
@hsingh23
hsingh23 / index.js
Last active December 30, 2016 19:01
async await example sync example (node only)
var async = require('asyncawait/async');
var await = require('asyncawait/await');
console.log("starting")
var getSomethingAsync = function(i){
return new Promise((resolve, reject) => {
setTimeout(()=>resolve(`money = ${i}`), Math.random()*500)
})
}
var foo = async(function() {
@hsingh23
hsingh23 / apt-fast.conf
Created July 17, 2016 17:34
/etc/apt-fast.conf
###################################################################
# CONFIGURATION OPTIONS
###################################################################
# Every item has a default value besides MIRRORS (which is unset).
# Use aptitude or apt-get?
# Note that for outputting the package URI list, we always use apt-get
# ...since aptitude can't do this
# Optionally add the FULLPATH to apt-get or apt-rpm or aptitude
# e.g. /usr/bin/aptitude
@hsingh23
hsingh23 / .zshrc
Created July 17, 2016 16:59
Harsh's oh my zsh like zplug zshrc
# Check if zplug is installed
if [[ ! -d ~/.zplug ]]; then
git clone https://github.com/zplug/zplug ~/.zplug
source ~/.zplug/init.zsh && zplug update --self
fi
# Essential
source ~/.zplug/init.zsh
# Make sure to use double quotes to prevent shell expansion
Flows:
create group:
1. get timezone, default alert time
2. create chore group
get group:
sign up with email password:
1. create user