Skip to content

Instantly share code, notes, and snippets.

View touv's full-sized avatar

Nicolas Thouvenin touv

View GitHub Profile
cat /dev/urandom | od -A n -t x -N 4 -w | tr -d ' '
@touv
touv / stow-install.sh
Created August 31, 2011 10:01
Installing STOW in HOME Directory
#!/bin/sh
# Installing STOW in HOME Directory
export STOW_VERSION=1.3.3
mkdir ~/local/stow
mkdir -p ~/local/src
mkdir ~/local/bin
mkdir ~/local/info
mkdir ~/local/etc
@touv
touv / nodejs-install.sh
Created August 31, 2011 10:04
Installing NODEJS in HOME Directory with STOW
#!/bin/sh
#Installing NODEJS in HOME Directory with STOW
export NODEJS_VERSION=0.4.11
mkdir -p ~/local/lib/node_modules
cd ~/local/src
curl http://nodejs.org/dist/node-v${NODEJS_VERSION}.tar.gz | tar -xzf -
cd ~/local/src/node-v${NODEJS_VERSION}
@touv
touv / app
Created October 28, 2011 08:16
LSB launcher for express of nodejs
#! /bin/sh
# ------------------------------------------------------------------------------
# SOME INFOS : fairly standard (debian) init script.
# Note that node doesn't create a PID file (hence --make-pidfile)
# has to be run in the background (hence --background)
# and NOT as root (hence --chuid)
#
# MORE INFOS : INIT SCRIPT http://www.debian.org/doc/debian-policy/ch-opersys.html#s-sysvinit
# INIT-INFO RULES http://wiki.debian.org/LSBInitScripts
# INSTALL/REMOVE http://www.debian-administration.org/articles/28
@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
##
##
@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 / 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 / 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 / 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();
#!/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