Skip to content

Instantly share code, notes, and snippets.

View pelletier's full-sized avatar

Thomas Pelletier pelletier

View GitHub Profile
<html>
<head>
</head>
<body>
<script type="text/javascript" charset="utf-8">
function getInternetExplorerVersion()
// Returns the version of Internet Explorer or a -1
// (indicating the use of another browser).
{
var rv = -1; // Return value assumes failure.
@pelletier
pelletier / gist:836271
Created February 20, 2011 20:26
Backup your favorites locally using Flickmator.
cd photos/favorites
wget `curl "http://flickmator.heroku.com/<unique_key>/text"` -nc
@pelletier
pelletier / Wo.sh
Created February 18, 2011 15:23
Projects workflow toolkit for bash-like shells.
#
# Wo
#
# Projects workflow toolkit for bash-like shells (tested with zsh).
# (c) 2011 Thomas Pelletier <http://thomas.pelletier.im/> under MIT License
# (see http://www.opensource.org/licenses/mit-license.php)
#
# Works with virtualenvwrapper and rvm.
#
@pelletier
pelletier / gist:774755
Created January 11, 2011 17:25
PIP sucks, this gist saves my day.
for dir in `ls .`
do
if [ -d $dir ]; then
if [ $dir != "." ]; then
if [ $dir != ".." ]; then
echo $dir
cd $dir && python setup.py install && cd ..
fi
fi
fi
@pelletier
pelletier / wp2rst.py
Created January 1, 2011 17:41
Convert a Wordpress weblog to many rst files you can use with Pelican for instance.
# -*- coding: UTF-8 -*-
import sys
import datetime
import subprocess
from xml.dom.minidom import parse, parseString
def html2rst(html):
@pelletier
pelletier / fabfile.py
Created November 28, 2010 12:50
Deployment script for Python-based web applications which use Gunicorn following the Capistrano way.
"""
Thomas Pelletier's Python deployment script.
MIT Licensed.
We assume that:
* deploy.py lives in the root of your project.
* In the same directory, there is a dependencies.txt file, in PIP format.
* Remote host has a working Python+VENV+PIP environment.
* You have enough privileges.
require 'rubygems'
require 'rexml/Document'
def parse_opml(content)
opml = REXML::Document.new(content)
body = opml.elements['opml/body']
feeds = []
body.elements.each('outline') do |el|
class SourcesController < ApplicationController
before_filter :authenticate_user!
protected
def load_sources
@sources = current_user.sources
end
;; Coloration syntaxique (global-font-lock-mode t)
;; Afficher numéro de ligne et de colone
(column-number-mode t) (line-number-mode t)
;; Selection PC (avec Shift)
(custom-set-variables '(pc-selection-mode t nil (pc-select)))
;; Mollette pour le defilement
(custom-set-variables '(mouse-wheel-mode t nil (mwheel)))
;; Afficher l'heure et la date
(setq display-time-24hr-format t)
(setq display-time-day-and-date t)
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This is a simple Twitter to email script.
You need:
- An SMTP server (such as Sendgrid.net).
- A Redis server.
- Python.
Don't forget: