Skip to content

Instantly share code, notes, and snippets.

View Marak's full-sized avatar

Marak

View GitHub Profile
@Marak
Marak / git-commit-prefixes
Created May 18, 2011 06:12 — forked from indexzero/git-commit-prefixes
Short list of Git commit prefixes used at Nodejitsu
[api]: New apis / changes to apis
[test]: Update test/* files
[dist]: Changes to submodules, version bumps, updates to package.json
[minor]: Small changes
[doc]: Updates to documentation
[ux]: Updates to UX
[fix]: Bug fixes
[bin]: Update binary scripts associated with the project
[merge]: Resolved git merge from upstream or otherwise
[refactor]: Refactor of existing code with no external API changes
@Marak
Marak / base64.js
Created February 8, 2011 00:41
An extremely simple implementation of base64 encoding / decoding using node.js Buffers
/*
* base64.js: An extremely simple implementation of base64 encoding / decoding using node.js Buffers
*
* (C) 2010, Nodejitsu Inc.
*
*/
var base64 = exports;
base64.encode = function (unencoded) {
@Marak
Marak / dockerCheatSheet.md
Last active June 20, 2024 13:33
docker cheat sheet

Things I wish I knew before I started using Docker

Commands

Init docker on mac os

boot2docker init

Restart docker vm on mac os

boot2docker up
/*
Mustache templating library made available for the CommonJS environment using the
modules definition available at: http://wiki.commonjs.org/wiki/Modules/1.1
Shameless port of a shameless port
@defunkt => @janl => @aq => @voodootikigod
See http://github.com/janl/mustache.js for more info about Mustache itself.
*/
@Marak
Marak / vlcrc.js
Created October 5, 2011 21:32 — forked from garth/vlcrc.js
Remote control multiple VLC apps via the command line using nodejs
// To start vlc with telnet remote control:
// ./VLC --extraintf rc --rc-host 0.0.0.0:3000
//
// To connect to multiple vlc's
// node vlcrc.js host1:3000 host2:3000
var net = require('net');
var readline = require('readline');
//addresses of servers
@Marak
Marak / nerd refs list
Created April 17, 2011 09:45
creating a list of unique character names from nerd references, add more
Breaker
Clutch
Flash
Hawk
Scarlett
Ace
Doc
Duke
Torpedo
Roadblock
@Marak
Marak / echoHttpRequest.js
Last active May 31, 2021 20:25
Echo HTTP requests
module['exports'] = function echoHttp (hook) {
console.log("Console messages are sent to /logs");
console.log(hook.params);
console.log(hook.req.path);
console.log(hook.req.method);
@Marak
Marak / image.js
Last active September 10, 2019 09:29
hook.io image hook for manipulating images using ImageMagick
/*
http://hook.io/Marak/image
*/
var gm = require('gm');
module['exports'] = function image (hook, callback) {
@Marak
Marak / imageResize.js
Last active July 31, 2019 19:04
hook.io example microservice for resizing images
module['exports'] = function imageResize (hook, callback) {
// GraphicsMagick fully supported
var gm = require('gm');
// for a more complete example that supports file uploads and streaming uploads
// see: http://image.resize.hook.io
// grab an image as a url
// no file has been uploaded, fallback to the image "url" parameter
var stream = hook.open('https://hook.io/img/robotcat.png');
hook.res.writeHead(200, { 'Content-Type': 'image/png' });
gm(stream)
@Marak
Marak / haproxy_rate_limiting.md
Created April 20, 2019 15:12 — forked from procrastinatio/haproxy_rate_limiting.md
Rate limiting with HAproxy

Introduction

So HAProxy is primalery a load balancer an proxy for TCP and HTTP. But it may act as a traffic regulator. It may also be used as a protection against DDoS and service abuse, by maintening a wide variety of statistics (IP, URL, cookie) and when abuse is happening, action as denying, redirecting to other backend may undertaken ([haproxy ddos config], [haproxy ddos])