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
#! /usr/bin/env python | |
# Brain-dead simple utility to dump a list of annotations from a Sony Reader .db | |
# Usage: $ python annot2html.py [int number of annot to fetch] | |
import sys | |
import sqlite3 as sql | |
import xml.etree.ElementTree as ET | |
# Mac-path! | |
file_db = sql.connect('/Volumes/READER/Sony_Reader/database/books.db') |
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
#! /usr/bin/env python3 | |
from twitter import * | |
import os, sys | |
CONSUMER_KEY = <your_consumer_key> | |
CONSUMER_SECRET <your_consumer_secret_key> | |
MY_TWITTER_CREDS = os.path.expanduser('~/.token_cache') | |
if not os.path.exists(MY_TWITTER_CREDS): | |
try: |
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
#! /usr/bin/env python | |
# file: attributealtfield.py | |
# Make a list of every img alt attribute in htmls and print to stdout | |
# Usage: from the command line, python attributealtfield.py <epub.epub> | |
from __future__ import print_function | |
import os | |
import sys | |
import zipfile as ZIP |
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
#! /usr/bin/env python | |
# by Gabriele Alese <[email protected]> / http://www.alese.it | |
# Released in Public Domain where applicable: http://creativecommons.org/publicdomain/zero/1.0/ | |
# *** | |
# REQUIREMENTS: | |
# this script makes use of pyepub 2.0.9 | |
# download here: https://github.com/gabalese/pyepub | |
# *** | |
# USAGE: |
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
#! /usr/bin/env python | |
import os | |
from pyepub import EPUB # see https://github.com/gabalese/pyepub | |
from StringIO import StringIO | |
from PIL import Image | |
import stepic | |
epub = EPUB("startepub.epub","a") |
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
#! /usr/bin/env python | |
try: | |
import lxml.etree as ET | |
except ImportError: | |
from xml.etree import ElementTree as ET | |
from StringIO import StringIO | |
import sys | |
pub_id = "-//W3C//DTD XHTML 1.1//EN" |
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
#! /usr/bin/env python | |
import sys | |
import re | |
def is_valid(isbn): | |
sum = 0 | |
isbn = re.sub(r"[-–—\s]", "", isbn) | |
# in case of isbn13 | |
if len(isbn) == 13 and isbn[0:3] == "978" or "979": # is it a ISBN? Thanks @librarythingtim |
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
#! /usr/bin/env python | |
from lxml import etree as ET | |
import zipfile as ZIP | |
import sys | |
import os | |
namespaces = { "opf":"http://www.idpf.org/2007/opf", | |
"dc":"http://purl.org/dc/elements/1.1/", | |
"ncx":"http://www.daisy.org/z3986/2005/ncx/" |
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
from microbit import * | |
import random | |
choices = [1,2,3,4,5,6] | |
death_number = random.choice(choices) | |
click_counter = 0 | |
while True: | |
display.show(Image.ASLEEP) | |