Skip to content

Instantly share code, notes, and snippets.

View Sebastien-HATTON's full-sized avatar

=^..^= Sebastien-HATTON

View GitHub Profile
# Fortement inspiré de cet article: http://rabexc.org/posts/docker-networking
# Tester les performances réseaux de ses conteneurs docker
# avec docker-proxy
docker run -it --rm --name=iperf3-server -p 10000:5201 networkstatic/iperf3 -s
docker inspect --format "{{ .NetworkSettings.IPAddress }}" iperf3-server
iperf3 -c 172.17.0.2 ⇒ 37gbs
iperf3 -c localhost -p 10000
# désactiver docker-proxy
vi /etc/docker/daemon.json
if [[ $UID != 0 ]]; then
echo "Please run this script with sudo:"
echo "sudo bash $0"
exit 1
fi
CODE_URL=https://az764295.vo.msecnd.net/stable/19222cdc84ce72202478ba1cec5cb557b71163de/code_1.12.2-1494422229_amd64.deb
CHROME_URL=https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
GITKRAKEN_URL=https://release.gitkraken.com/linux/gitkraken-amd64.deb
var mongoose = require('mongoose')
, Schema = mongoose.Schema
, crypto = require('crypto')
/**
* User Schema
*/
var UserSchema = new Schema({
createdAt: { type: Date, default: Date.now, required: true },
exports.addCarPhoto = function(req, res) {
var userID = req.user._id;
var carsBaseURI = "http://sobrioapp.blob.core.windows.net/cars/";
// setup photo meta data
var type = req.files.photo.type;
var filename = req.params.id + "-" + req.files.photo.name;
var path = req.files.photo.path;
module.exports = {
development: {
root: require('path').normalize(__dirname + '/..'),
app: {
name: 'AppName Development',
nodefly: 'AppName Dev',
iosversion: "2.0.0",
androidversion: "0.6.0"
},
db: 'mongodb://localhost/appdev',
// Load configurations
var env = process.env.NODE_ENV || 'development'
, config = require('./config/config')[env];
// Bootstrap db connection
mongoose.connect(config.db);
relations.use(relations.stores.redis, {client: redis.createClient(config.redis.port, config.redis.host)});
// Setup App Version
var nconf = require('nconf');
var ldap = require('ldapjs');
var async = require('async');
ldap.Attribute.settings.guid_format = ldap.GUID_FORMAT_D;
var Users = module.exports = function(){
var options = this._options = {
url: process.env["LDAP_URL"],
base: process.env["LDAP_BASE"],
bindDN: process.env["LDAP_BIND_USER"],
var WebSocketServer = require('ws').Server;
var wss = new WebSocketServer({port: 8080});
var jwt = require('jsonwebtoken');
/**
The way I like to work with 'ws' is to convert everything to an event if possible.
**/
function toEvent (message) {
try {
function onlyStatic (middleware) {
return function (req, res, next) {
var match = /(\.css|\.eot|\.gif|\.html|\.js|\.png|\.svg|\.ttf|\.woff|\.jpg)($|\?.*$)/ig.exec(req.originalUrl);
if (!match) return next();
middleware(req, res, next);
};
}
//usage
this.use(onlyStatic(express.static(__dirname + "/public")));