Skip to content

Instantly share code, notes, and snippets.

@rewiko
rewiko / proxy.js
Created June 14, 2018 13:23 — forked from NickNaso/proxy.js
Log or modify the request body in the node-http-proxy before to pass it to the express.js application
/*******************************************************************************
* Copyright (c) 2017 Nicola Del Gobbo
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the license at http://www.apache.org/licenses/LICENSE-2.0
*
* THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS
* OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY
* IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
* MERCHANTABLITY OR NON-INFRINGEMENT.
@rewiko
rewiko / ip_vs_sch.c
Created November 16, 2017 13:37 — forked from SaveTheRbtz/ip_vs_sch.c
Consistent source hashing scheduler for IPVS (SH-derivative, GPL)
/*
* IPVS: Source Consistent Hashing scheduling module
*
* Authors: Jonathan Lee <jonlee@dropbox.com>
*
* Changes:
*
*/
#define KMSG_COMPONENT "IPVS"
@rewiko
rewiko / tmux-cheatsheet.markdown
Created October 10, 2016 18:56 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@rewiko
rewiko / using-raw-socket-io-in-sails.js
Created February 3, 2016 07:28 — forked from mikermcneil/using-raw-socket-io-in-sails.js
Using raw socket.io functionality in a Sails.js controller
module.exports = {
/**
*
* Using raw socket.io functionality from a Sails.js controller
*
*/
index: function (req,res) {
@rewiko
rewiko / moment.workdays.js
Created January 15, 2016 08:11 — forked from ioleo/moment.workdays.js
introduce 'workdays' mode to moment.js add/subtract methods (PL national holidays)
(function (undefined) {
/**
* moment.easter
* Source: https://github.com/zaygraveyard/moment-easter
* License: MIT
*/
moment.easter = function Easter20ops(year) {
var a = (year / 100 | 0) * 1483 - (year / 400 | 0) * 2225 + 2613;
var b = ((year % 19 * 3510 + (a / 25 | 0) * 319) / 330 | 0) % 29;
var c = 148 - b - ((year * 5 / 4 | 0) + a - b) % 7;