Skip to content

Instantly share code, notes, and snippets.

View jldupont's full-sized avatar

Jean-Lou Dupont jldupont

View GitHub Profile
@jldupont
jldupont / Simple_Message_Bus.py
Created January 28, 2010 16:30
Simple publish/subscribe Message Bus
"""
Simple "Bus" based message publish/subscribe
Created on 2010-01-28
@author: jldupont
"""
__all__=["Bus"]
@jldupont
jldupont / daemonize_glib_dependency.sh
Created February 17, 2010 13:57
Daemonize with dependency on glib/dbus
#!/usr/bin/bash
#
# @author: Jean-Lou Dupont
#
# need to adjust DISPLAY setting before daemonize
# of application relying on gobject/glib/dbus
#
## Example:
export DISPLAY=:0.0
@jldupont
jldupont / local_email.py
Created September 15, 2010 21:16
Sending mail to local user
"""
Sending local email
Created on 2010-09-15
@author: jldupont
"""
import smtplib
import getpass
SERVER = "localhost"
@jldupont
jldupont / backup_rb.bash
Created October 1, 2010 12:16
Backup rhythmbox db to Google Docs
#!/bin/bash
#
# Backup my rhythmbox database over to Google Docs
#
DATE=`date +%d%m%g`
zip /tmp/rb${DATE} ~/.local/share/rhythmbox/rhythmdb.xml
/usr/local/bin/google docs upload --folder=_backup --title=rb${DATE}.zip /tmp/rb${DATE}.zip
@jldupont
jldupont / get_mac.sh
Created March 24, 2011 12:30
Retrieve MAC address of eth0 (bash)
ip link | grep "link/ether" | awk -F" " '{print $2}'
@jldupont
jldupont / get_ip.sh
Created March 24, 2011 12:31
Retrieve IP address associated with eth0 (bash)
ip address | grep eth0 | grep inet | awk -F" " '{print $2}'
@jldupont
jldupont / runner.js
Created August 20, 2011 07:25
Lightweight Javascript Proc & Task Runner
/*
* A lightweight proc & task runner
*
* runner.js
*
* @author Jean-Lou Dupont
*
* @dependencies:
* - oo.js ('method')
*/
@jldupont
jldupont / mswitch.js
Created August 20, 2011 07:28
Lightweight Publish/Subscribe Message Switch
/*
* Message Switch
*
* @desc Each subscriber gets at least the first occurence of a message-type:
* it is the responsibility of the subscriber to return its "interest"
* for a particular 'message type'.
*
* Suscribers must implement the 'mailbox' method.
*
* NOTE: 'no interest' map stored in the Agent
@jldupont
jldupont / map.java
Created September 2, 2011 11:58
GWT Map
/**
* Map
*
* @author jldupont
*/
package com.cdf.front.types.client;
import java.util.Iterator;
import java.util.Set;
@jldupont
jldupont / partial.py
Created December 12, 2011 19:27
Partial Function application in python
def partial(fn, *pargs):
"""
Partial Function builder
>>> f=lambda p1,p2: p1+p2
>>> pf=partial(f, 66)
>>> pf(44)
110
"""
def _(*args):
plist=list(pargs)