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
@3rd-Eden
3rd-Eden / nodejs_zip.js
Created July 15, 2010 13:10
Zipping files in Node.js
var zip = require('./zip'),
sys = require('sys'),
fs = require('fs');
fs.readFile( '/etc/hosts', function( err, res ){
var data = res.toString(),
unzip = data.length,
start = +new Date,
deflate = zip.deflate( data ),
zipper = deflate.length,
@3rd-Eden
3rd-Eden / README.md
Created March 16, 2015 13:04
BigPipe & React sitting a tree.
  • BigPipe and React
  • React components
  • Share state
  • Server Side rendering
  • Modularization of components
  • Re-initialization
    • checksum
    • event adding
    • html bloat
  • JSX
@3rd-Eden
3rd-Eden / README.md
Last active January 4, 2021 10:20
Protecting against POODLE in node.js

[Google recently announced][poodle] that there is an exploit in SSLv3, this vulnerability is know as POODLE. There is no other option than to disable SSLv3 in order to combat this major flaw. There have already been [guides on how to disable this in different servers][guides]. But nothing excised for Node.js yet, until now. In order to resolve this for Node.js we need to use various of undocumented options and modules.

In the index.js file below you can see an example of how you can protect your HTTPS server against the POODLE attack. It uses the secureOptions option to pass in constants in to the SSL context which is created by node.

// Build the https based part & read the key and crt file that is required to encrypte the server / client connection
var ssl = https.createServer({
key: fs.readFileSync( "./ssl/ssl.private.key" ).toString()
, cert: fs.readFileSync( "./ssl/ssl.crt" ).toString()
});
// This is the part what it's all about, we are going to route all
// https based requires to the default app handler
ssl.addListener( "request", function sllRequestListener( req, res ){
req.ssl = true; // just add an extra flag so we can see if it was forwarded from https
/** @jsx React.DOM **/
<div>
<FormattedMessage
message={getIntlMessage('post.meta')}
num={props.post.comments.length}
ago={<FormattedRelative value={props.post.date} />}
/>
<span>{random}</span>
</div>
function Car() {
this.type = 'fo sho'
}
Object.defineProperty(Car.prototype, 'is', {
get: function getterson() {
var car = this;
function named(args) {
args = named.curry.concat(Array.prototype.slice.call(arguments, 0));
@3rd-Eden
3rd-Eden / monitrc
Created May 10, 2011 08:18
monit nodejs deployment
###############################################################################
## Includes
###############################################################################
##
## It is possible to include additional configuration parts from other files or
## directories.
#
# include /etc/monit.d/*
#
#
@3rd-Eden
3rd-Eden / LICENSE.txt
Created May 20, 2011 10:59 — forked from 140bytes/LICENSE.txt
JSON date parser
Copyright (c) 2011 Arnout Kazemier, <http://blog.3rd-Eden.com>
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
npm WARN using --force I sure hope you know what you are doing.
npm http GET http://registry.nodejitsu.com/primus
npm http 304 http://registry.nodejitsu.com/primus
npm http GET http://registry.npmjs.org/primus/-/primus-1.5.2.tgz
npm http 200 http://registry.npmjs.org/primus/-/primus-1.5.2.tgz
npm http GET http://registry.nodejitsu.com/load
npm http GET http://registry.nodejitsu.com/extendable
npm http 304 http://registry.nodejitsu.com/load
npm http 304 http://registry.nodejitsu.com/extendable
npm http GET http://registry.npmjs.org/extendable/-/extendable-0.0.6.tgz
@3rd-Eden
3rd-Eden / gist:8481349
Created January 17, 2014 20:56
Fixing chrome's font-rendering issues.
(function () {
//
// Set name of the visibility change event.
//
var visibilityChange, hidden;
if (typeof document.hidden !== 'undefined') {
hidden = 'hidden';
visibilityChange = 'visibilitchange';
} else if (typeof document.webkitHidden !== 'undefined') {
hidden = 'webkitHidden';