Skip to content

Instantly share code, notes, and snippets.

View 3rd-Eden's full-sized avatar
💭
I have approximate knowledge of many things

Arnout Kazemier 3rd-Eden

💭
I have approximate knowledge of many things
View GitHub Profile

I would be happy if I could just provide a small bash script that's ran as root e.g:

apt-get update
apt-get install -y <packages>

mkdir -p stuff

That get's run automatically when I provision a server. If the bash script exits with an error code, just destroy the complete the server and if it passes, we're all happy.

@3rd-Eden
3rd-Eden / README.md
Created September 11, 2013 14:23
Primus plugins that I would love to see written or that are going to be written.

Crypto

Primus provides an API for transforming incoming and outgoing messages. This API can be leveraged by plugins to encrypt and decrypt the messages that pass through Primus. Node.js already provides a good solid crypto implementation using the crypto module. On the client side, crypto-js could be used for securely encrypting these the messages.

@3rd-Eden
3rd-Eden / advantages.md
Created August 7, 2013 18:24
Why you should use Primus instead of engine.io

The advantages of Primus over a plain Engine.IO server:

  1. Stream compatible interface for the client and the server
  • You can pipe data from the server the client
  • It uses the same data events you're used to with streams
  1. Build in reconnect, this one just works. Uses exponential backoff (randomized) to reduce server stress.
  2. Automatically runs your messages through the specified parser
  • JSON by default, but extendable by developers
  1. Comes with a plugin system as Primus was designed to say out of your way and developers all the freedom they need.
  • There are already community added plugins for EventEmitters, Rooms and Namespaces.
> dig +short isaacs.iriscouch.com
npm-dal01.sl.cdn.iriscouch.net.
67.228.31.147
67.228.31.146
{
"name": "socket.io.1.0",
"version": "1.0.0",
"description": "Socket.IO 1.0 using Primus",
"main": "socket.io.1.0.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
npm install jitsu -g ~ 1 ↵
npm http GET https://registry.npmjs.org/jitsu
npm http 304 https://registry.npmjs.org/jitsu
npm http GET https://registry.npmjs.org/colors/0.6.0-1
npm http GET https://registry.npmjs.org/complete/0.3.1
npm http GET https://registry.npmjs.org/dateformat/1.0.2-1.2.3
npm http GET https://registry.npmjs.org/flatiron/0.3.5
npm http GET https://registry.npmjs.org/flatiron-cli-config/0.1.4
npm http GET https://registry.npmjs.org/flatiron-cli-users/0.1.7
npm http GET https://registry.npmjs.org/fstream/0.1.22
@3rd-Eden
3rd-Eden / app.js
Last active December 16, 2015 06:59
simple socket htingy
var http = require('http');
var server = http.createServer(function (req, res) {
res.statusCode = 200;
res.end('<script src="/socket.io/socket.io.js"></script>');
});
var io = require('socket.io').listen(server);
io.sockets.on('connection', function (socket) {
---
No client certificate CA names sent
---
SSL handshake has read 960 bytes and written 412 bytes
---
New, TLSv1/SSLv3, Cipher is RC4-SHA
Server public key is 1024 bit
Secure Renegotiation IS supported
Compression: NONE
Expansion: NONE
@3rd-Eden
3rd-Eden / gist:5332108
Created April 7, 2013 19:29
broke node
[root@093a7deb-f52a-41a1-ae29-bd8ec925e8c7 ~/thor]# thor --amount 50000 --concurrent 250 ws://>
Thor: version: 1.0.0
God of Thunder, son of Odin and smasher of WebSockets!
Thou shall:
- Spawn 24 workers.
- Create 250 concurrent/parallel connections.
- Smash 50000 connections with the mighty Mjölnir.
var crypto = require('crypto');
console.time('iterations');
for (var i = 0; i < 100000; i++) {
crypto.createHash('md5').update(i + '').digest();
}
console.timeEnd('iterations');