Skip to content

Instantly share code, notes, and snippets.

View abahgat's full-sized avatar

Alessandro Bahgat abahgat

View GitHub Profile
@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:
@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 / 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 / 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 / capture.sh
Last active March 18, 2016 00:04
Capture a screenshot of a window via command line
screencapture -iW /path/to/output.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@abahgat
abahgat / rete-metro-milano.geojson
Last active December 21, 2015 20:18
Rete linee metropolitana Milano. This is an elaboration of the Open Data published by the City of Milan obtained by converting the data to GeoJSON and trying to make the format a bit more useful. Base data file here: https://github.com/abahgat/opendata-milano/blob/master/geojson/fermate-metro.geojson
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@abahgat
abahgat / gpg-public.pub
Last active August 29, 2015 14:20
Public GPG key
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1
mQINBFVILfUBEADHQ9VolJCgonjLwstmvBls7Dh14iq5KTPIJ696xc+gEKu4q1MG
qMT9NrmOPXGniwa9Rg+XzFE2Moo9n8Rqs6ECyu2bEh9RYTszJJGcR9c90RwyUe9a
AI6RyiV3yyAPWM2KzdS14J0IDF6vaEQqknljm40IANzeHI8ltsP6InHOcLUPYiNz
FCoh4myvgjDY4YB+cN9Yipbe91p8HX758LX2T1KVJ0eGkSsrqQ3RgY8CD7h5nF9g
/IY2MAesFoLkXF/zCJIynRcNdZ2XawNA9v4rY9Hl1WKp2JicKyoMqUQ77I8ZKfnj
boUIz/3nINpV8WI/ExRfFP4DsRsRMbaPqmr19kwfU0v2mDNZ+n8vlSwWuOo98gNg
G6YtcJ8pmUpwsDoAr4NXh7ApmYQU8YnXTRN50OV02RhFiMWcXveBetKbPoRUT6mN
@abahgat
abahgat / keybase.md
Created May 7, 2015 04:12
Keybase verification

Keybase proof

I hereby claim:

  • I am abahgat on github.
  • I am abahgat (https://keybase.io/abahgat) on keybase.
  • I have a public key whose fingerprint is 2427 8152 1A73 452C 1DC8 CDA6 6BEA 6A36 8D50 0FAE

To claim this, I am signing this object: