Skip to content

Instantly share code, notes, and snippets.

View touv's full-sized avatar

Nicolas Thouvenin touv

View GitHub Profile
@touv
touv / mongodb-local
Created November 7, 2014 12:57
Local launcher for mongodb
#!/bin/sh
#
# init.d script with LSB support.
#
# Copyright (c) 2007 Javier Fernandez-Sanguino <[email protected]>
#
# This is free software; you may redistribute it and/or modify
# it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2,
# or (at your option) any later version.
@touv
touv / gist:8cfa99ae6a82af5cea38
Created September 11, 2014 12:28
necessary ubuntu packages for nodejs
sudo apt-get install libssl-dev build-essential
@touv
touv / express-jsdav.js
Last active March 16, 2016 16:29
webdav for nodjes with express middleware
"use strict";
var express = require('express');
var app = express();
var jsDAV = require("jsDAV/lib/jsdav");
app.use(function (req, res, next) {
if (req.url.search(/^\/webdav/) >= 0) {
jsDAV.mount({
node: __dirname + "/data",
mount: "/webdav",
@touv
touv / markdown-express-render.js
Created March 10, 2014 13:08
Render Markdown files as templates
'use strict';
var fs = require('fs')
, marked = require('marked')
;
module.exports = function (options) {
if (!options) {
options = {};
}
#!/bin/sh
sudo add-apt-repository ppa:fkrull/deadsnakes
sudo apt-get update
sudo apt-get install python2.5 python2.5-dev libxml2 libxml2-dev libxslt libxslt1-dev build-essential
wget http://lxml.de/files/lxml-2.1.1.tgz
cd lxml-2.1.1/
sudo python2.5 setup.py build
sudo python2.5 setup.py install
@touv
touv / splitline.js
Created October 3, 2012 11:50
Split stdin by line with nodejs
#!/usr/bin/env node
process.stdin.resume();
process.stdin.setEncoding('utf8');
var remainder = ''
process.stdin.on('data', function (chunk) {
var lines = chunk.toString().split('\n');
lines.unshift(remainder + lines.shift());
remainder = lines.pop();
@touv
touv / http-stream-test.js
Created June 1, 2012 21:47
pause and resume on an http stream
var http = require('http');
var server = http.createServer(function (req, res) {
var nb_chunk = 0;
res.write('Shifting ...');
req.pause();
req.setEncoding('utf-8');
req.on('data', function(chunk) {
nb_chunk++;
res.write('Request Chunked #'+nb_chunk+' : '+chunk[0]+chunk[1]+chunk[2]+'\n');
@touv
touv / gist:1885426
Created February 22, 2012 14:54
exemple de config git
[branch "master"]
remote=origin
merge=refs/heads/master
[remote "origin"]
url = http://github.com/touv/node-xml-mapping.git
fetch = +refs/heads/*:refs/remotes/origin/*
@touv
touv / lsb-for-express.sh
Created December 9, 2011 11:08
Create directories for Express/NodeJS compilant with the LSB
#!/bin/sh
mkdir -p ./bin
mkdir -p ./etc/init.d
mkdir -p ./etc/default/
mkdir -p ./var/log/express
mkdir -p ./var/run
touch ./etc/init.d/express
touch ./etc/default/express
@touv
touv / startup-app.sh
Created November 4, 2011 13:16
Startup script for Express / Node.js application with the forever module
#!/bin/sh
##3.5...10...15...20...25...30...35...40...45...50...55...60...65...70...75...80
##
## Debian / Linux / Ubuntu / LSB
## Startup script for Express / Node.js application with the forever module
##
##
## A modification of "init.d.lsb.ex" by Nicolas Thouvenin
##
##