Skip to content

Instantly share code, notes, and snippets.

View jmg's full-sized avatar
🎯
Focusing

Juan Manuel Garcia jmg

🎯
Focusing
View GitHub Profile
@jmg
jmg / Another_scraper.py
Created January 6, 2012 19:30
Another_scraper.py
from lxml import etree
from StringIO import StringIO
import urllib2
url = "http://www.ivao.aero/flightss/list.asp"
data = urllib2.urlopen(url).read()
parser = etree.HTMLParser()
tree = etree.parse(StringIO(data), parser)
@jmg
jmg / lxml_scraper.py
Created January 6, 2012 16:06
lxml scraper example
from lxml import etree
from StringIO import StringIO
import urllib2
url = "http://www.ivao.aero/atcss/list.asp"
data = urllib2.urlopen(url).read()
parser = etree.HTMLParser()
tree = etree.parse(StringIO(data), parser)
@jmg
jmg / TrailingWhiteSpaces
Created January 2, 2012 01:09
Remove Trailing WhiteSpaces from the current dir recursively
find . -not -path '.git' -iname '*.py' -type f -exec sed -i 's/ *$//' '{}' ';'
@jmg
jmg / replace.py
Created November 29, 2011 19:59
search and replace recursively with this python script
"""
Search and replace recursive
Usage:
~$ python replace.py [rootdir] [searched_text] [replace_text]
"""
import os
import sys
if len(sys.argv) <= 1: