Skip to content

Instantly share code, notes, and snippets.

View abahgat's full-sized avatar

Alessandro Bahgat abahgat

View GitHub Profile
@abahgat
abahgat / git-svn.sh
Created May 22, 2013 17:29
Checks out a project from SVN preparing it for import in git
git svn --authors-file /tmp/authors -s clone http://example.com/svn project-dir
@abahgat
abahgat / post_request.sh
Last active December 17, 2015 02:58
Send an XML request (stored in a file) to an URL (using curl)
curl -X POST -d @filename --header "Content-Type:text/xml" http://example.com/path/to/resource
@abahgat
abahgat / pythonorg-highlight.css
Last active December 20, 2015 21:59
CSS to make source code on wordpress.com display like the code examples in the Python documentation.
div.syntaxhighlighter {
border-radius: 3px;
border: 1px solid #AC9!important;
}
div.syntaxhighlighter, div.syntaxhighlighter div, div.syntaxhighlighter code, div.syntaxhighlighter table, div.syntaxhighlighter table td, div.syntaxhighlighter table tr, div.syntaxhighlighter table tbody {
font: 13px "Courier 10 Pitch", Courier, monospace!important;
}
div.syntaxhighlighter .line.alt1 {
@abahgat
abahgat / gae-memcache-decorator.py
Last active January 22, 2021 00:43
A Python decorator to cache method results using memcache on Google AppEngine
import functools
import logging
from google.appengine.api import memcache
def cached(time=1200):
"""
Decorator that caches the result of a method for the specified time in seconds.
Use it as: