Skip to content

Instantly share code, notes, and snippets.

View Marak's full-sized avatar

Marak

View GitHub Profile
@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 / 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 / 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])

@Marak
Marak / mockreadwritestream.js
Created May 20, 2011 06:29 — forked from indexzero/mockreadwritestream.js
A mock stream for node.js that is both Readable and Writeable.
var events = require('events'),
util = require('util');
var MockReadWriteStream = helpers.MockReadWriteStream = function () {
//
// No need to do anything here, it's just a mock.
//
};
util.inherits(MockReadWriteStream, events.EventEmitter);
module['exports'] = function (hook) {
var rest = require('restler'),
moment = require('moment');
var myGender = 'male',
myCountry = 'United States',
myDOB = '1986-05-01';
var currentDate = moment();
node_modules
secrets.js
@Marak
Marak / client.js
Created May 15, 2012 01:06
connecting to a dnode socket.io server from node
var io = require('socket.io-client');
var sock = io.connect('http://localhost:8080');
var dnode = require('dnode');
var Stream = require('stream');
var stream = new Stream;
stream.writable = true;
stream.readable = true;
stream.write = function (buf) {
sock.emit('message', String(buf));
app.router.get('/:slug', function (slug) {
var that = this;
Shortlink.find( {slug: slug} , function (err, shortlink) {
if (err) { throw new(Error)(err) }
console.log( that.req ); // This returns "undefined" and I think I understand why.
// How do I access request and response objects from within
// an anon callback like this one?
});
});
@Marak
Marak / hack.sh
Created March 31, 2012 22:30 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@Marak
Marak / gist:1505534
Created December 21, 2011 10:27 — forked from sontek/snowjob.sh
Make your terminal snow
#!/bin/bash
LINES=$(tput lines)
COLUMNS=$(tput cols)
clear
declare -A snowflakes
declare -A lastflakes