View russian_roulette.py
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)
View sortncx.py
#! /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/"
View checkisbn.py
#! /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
View html_splitter.py
#! /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"
View simplewatermark.py
#! /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")
View previewbuilder.py
#! /usr/bin/env python
# by Gabriele Alese <gabriele@alese.it> / 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:
View attributealtfield.py
#! /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
View tweet.py
#! /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:
View annot2html.py
#! /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')