This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#http://docs.python.org/2.7/library/csv.html | |
import csv, codecs, cStringIO | |
class UTF8Recoder: | |
""" | |
Iterator that reads an encoded stream and reencodes the input to UTF-8 | |
""" | |
def __init__(self, f, encoding): | |
self.reader = codecs.getreader(encoding)(f) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<p>“I am an optimist who worries a lot,” Madeleine Albright said Monday night when asked about the future of democracy. It’s a quotable phrase, but the former secretary of state is serious—both about her belief in the power of democracy and the fact that today, there’s substantial reason to worry about it.</p> | |
<p>In a wide-ranging conversation with <em>The Atlantic</em>’s editor-in-chief Jeffrey Goldberg in Washington, Albright spoke about the 20th-century history of fascism that she details in her new book, <em>Fascism: A Warning. </em>Albright, whose family was driven out of Czechoslovakia twice (once during World War II, and again by the Communist regime in 1948), discovered late in life that 26 members of her family were murdered in the Holocaust. This personal history, as well as Albright’s long career as a diplomat and politician, have helped inform her understanding of fascism—both what it is and what it’s not.</p> | |
<p>Albright, who served as secretary of state in the Clinton administration from 1997 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Prerequisites: | |
(1) You'll first need to open up the developer console in e.g. Chrome (cmd-shift-c) | |
(2) Locate the div element with id "main" (should be relatively easy to find as it's the main enclosing div in the body) | |
(3) Copy all the inner html of that div (easy way- right-click and select "Edit as HTML", then copy normally) | |
(4) Save that to a file somewhere (e.g. /tmp/tracklist.html) | |
(5) Open up a python shell (preferably iPython!) and execute the following | |
""" | |
import lxml.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Steps: | |
(1) You'll first need to open up the developer console in e.g. Chrome (cmd-shift-c) | |
(2) Locate the div element with id "main" (should be relatively easy to find as it's the main enclosing div in the body) | |
(3) Copy all the inner html of that div (easy way- right-click and select "Edit as HTML", then copy normally) | |
(4) Save that to a file somewhere (e.g. /tmp/tracklist.html) | |
(5) Open up a python shell (preferably iPython!) and paste the function below into it | |
(6) Call the function passing in the path to the file from step 4 | |
(7) profit | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
s/\"\(http[s]*:\/\/.+?\)\"/\'\1\'/g |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Hi mom | |
..and other people |