Skip to content

Instantly share code, notes, and snippets.

View gaubert's full-sized avatar

Guillaume Aubert gaubert

View GitHub Profile
@gaubert
gaubert / simple-nginx-webdav.sh
Created July 4, 2011 07:45 — forked from dysinger/simple-nginx-webdav.sh
A simple nginx/webdav setup for use with things like mobile-org
#!/bin/sh
# on ubuntu: need some utils & dev libs
sudo apt-get install apache2-utils openssl libssl-dev libpcre3-dev
# compile nginx
cd /tmp
curl http://nginx.org/download/nginx-0.7.64.tar.gz | tar xz
cd nginx*
./configure --with-http_ssl_module --with-http_dav_module \
@gaubert
gaubert / .lftp.mockup.rc
Created February 11, 2011 08:56
~/.lftp.rc parameters detailed
########## SETTINGS
# On startup, lftp executes ~/.lftprc and ~/.lftp/rc. You can place aliases and 'set' commands
# there. Some people prefer to see full protocol debug, use 'debug' to turn the debug on.
# Certain commands and settings take a time interval parameter. It has the format Nx[Nx...], where N is time amount
# (floating point) and x is time unit: d - days, h - hours, m - minutes, s - seconds. Default unit is second. E.g.
# 5h30m or 5.5h. Also the interval can be 'infinity', 'inf', 'never', 'forever' - it means infinite interval. E.g.
# 'sleep forever' or 'set dns:cache-expire never'.
@gaubert
gaubert / mtrelay.py
Created December 15, 2010 16:15
0MQ zguide mtrelay implementation
"""
Multithreaded relay
Author: Guillaume Aubert (gaubert) <guillaume(dot)aubert(at)gmail(dot)com>
"""
import threading
import zmq
@gaubert
gaubert / mtserver.py
Created December 15, 2010 15:19
0MQ zguide mtserver python implementation
"""
Multithreaded Hello World server
Author: Guillaume Aubert (gaubert) <guillaume(dot)aubert(at)gmail(dot)com>
"""
import time
import threading
import zmq
@gaubert
gaubert / msgqueue.py
Created December 15, 2010 14:43
0MQ msgqueue.py zguide implementation
"""
Simple message queuing broker
Same as request-reply broker but using QUEUE device
Author: Guillaume Aubert (gaubert) <guillaume(dot)aubert(at)gmail(dot)com>
"""
@gaubert
gaubert / lruqueue2.py
Created December 15, 2010 08:45
lruqueue2 example implementation
"""
Least-recently used (LRU) queue device
Demonstrates use of the multipart messages in python
Author: Guillaume Aubert (gaubert) <guillaume(dot)aubert(at)gmail(dot)com>
"""
import threading
@gaubert
gaubert / lruqueue.py
Created December 14, 2010 14:22
0MQ lruqueue implementation
"""
Least-recently used (LRU) queue device
Clients and workers are shown here in-process
Author: Guillaume Aubert (gaubert) <guillaume(dot)aubert(at)gmail(dot)com>
"""
import threading
@gaubert
gaubert / curl_post
Created October 21, 2010 14:39
quick and dirty script for posting a file content with curl (second file also changes the HTTP Header
#!/bin/bash
if [ ! -e "$1" ]; then
echo "Error: Need a file to post"
echo "Usage: curl_post file_to_post.file"
exit 1
fi
if [ -c "$1" ]
then
@gaubert
gaubert / websocketserver.py
Created August 13, 2010 11:52 — forked from mumrah/websocketserver.py
websocket server
import struct
import socket
import hashlib
import sys
from select import select
import re
import logging
class WebSocket(object):
handshake = (
# Echo server program
import socket
HOST = '' # Symbolic name meaning the local host
PORT = 9001 # Arbitrary non-privileged port
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind((HOST, PORT))
s.listen(1)
print "listenning on %s , port = %d"%(HOST,PORT)
while 1: