Things I wish I knew before I started using Docker
boot2docker init
boot2docker up
var EventEmitter = require('events').EventEmitter; | |
var request = new EventEmitter; | |
function Proxy(emitter, callbacks) { | |
if (!(this instanceof Proxy)) return new Proxy(emitter, callbacks); | |
var self = this; | |
// callbacks... | |
Object.keys(callbacks).forEach(function(event){ |
// Copyright 2006-2008 the V8 project authors. All rights reserved. | |
// Redistribution and use in source and binary forms, with or without | |
// modification, are permitted provided that the following conditions are | |
// met: | |
// | |
// * Redistributions of source code must retain the above copyright | |
// notice, this list of conditions and the following disclaimer. | |
// * Redistributions in binary form must reproduce the above | |
// copyright notice, this list of conditions and the following | |
// disclaimer in the documentation and/or other materials provided |
#!/bin/bash | |
# Bash script to install latest version of ffmpeg and its dependencies on Ubuntu 12.04 or 14.04 | |
# Inspired from https://gist.github.com/faleev/3435377 | |
# Remove any existing packages: | |
sudo apt-get -y remove ffmpeg x264 libav-tools libvpx-dev libx264-dev | |
# Get the dependencies (Ubuntu Server or headless users): | |
sudo apt-get update |
#!node | |
if(!process.send) { | |
console.log("Not started with accessible parent IPC."); | |
process.exit(1); | |
} | |
process.on('message', function(json) { | |
console.log('parent->child message passed', json); | |
process.send({type:'got', payload:json}); | |
if(json.type === 'exit') process.exit(0); | |
}); |
-- ref https://www.macosxautomation.com/applescript/sbrt/sbrt-06.html | |
on replace_chars(this_text, search_string, replacement_string) | |
set AppleScript's text item delimiters to the search_string | |
set the item_list to every text item of this_text | |
set AppleScript's text item delimiters to the replacement_string | |
set this_text to the item_list as string | |
set AppleScript's text item delimiters to "" | |
return this_text | |
end replace_chars |
# Given a single argument, being the folder to a local copy of the npm package to "install" | |
# copy it to the local node_modules folder, then make sure it has no node_modules of its own. | |
# This way you can npm install locally afterwards to cover remaining dependencies and | |
# everything will work right. | |
function npm_import { | |
export pkgname=`basename $1` | |
export pkgdir="node_modules/$pkgname" | |
if [ -d "$pkgdir" ]; then | |
rm -rf "$pkgdir" | |
fi |
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])