Tag: python

CSO Compression and Decompression Tool



Introduction I have a number of backed up ISO files that were taking up quite a bit of space. I wanted to save some space and I decided to compress them. Instead of putting them into something like a ZIP archive, I decided that compressing into CSO would be... Continue reading

Full Text Search with Jekyll



Introduction When I switched from WordPress to Jekyll I gave up searching posts. I knew this was a limitation of running a static site and I didn’t think it would be too big a deal. After a year I’ve found I actually look up some old reference posts... Continue reading

Python Http Server



Introduction Quite often I find that I need to serve some files for viewing in a web browser. Most recently, I needed to do this with an in progress OpenAPI document as rendered by ReDoc. All I needed was something that can serve static files. I really didn’t... Continue reading

Python Self Signed Cert Gen



Introduction Sometimes I need to write a simple network server to emulate an application I’m integrating with. Typically, this is ends up being a throw away Python script that allows me to easily inspect at a request and returns a basic response. It’s handy to verify what I’m sending... Continue reading

Python Binary to C Header



Introduction Once again I needed to embed some text files into a C application. The right way to do this is turn the data into a byte array and compile it in. At least it’s the most portable way because some compilers have string length limitations. xxd... Continue reading

Binary Headers



Introduction Earlier in the year I wrote a Lua implementation of xxd -i (it’s at the bottom under the “Embedding” section). I wrote this because a few platforms I was working with didn’t support xxd. I didn’t want to attempt compiling and installing it. I had Lua installed... Continue reading

Cybook t4b Format Specification



The new epub thumbnail files (.epub.thn) are what Bookeen calls t4b files. They are very similar to the older t2b thumbnail files they were using in earlier versions of the Cybook firmware. As the name suggests instead of using 2 bits to represent color values 4 bits are now... Continue reading

Unidecoder



A while back I made a post about ASCIIizing Text. With it was a simple python application that would convert Unicode characters to ASCII equivalents. It doesn’t do a basic conversion but also Latinizes the characters when they are outside of the ASCII range. The uni2ascii package I... Continue reading

Niw Markdown Editor



For the past three weeks I’ve been working on an editor for working with plain text files and making it easy to add markdown syntax to them. My main goal is to make it easier to format the large number of ebooks I have. Almost all of them are plain... Continue reading

QPlainTextEdit With In Line Spell Check



Update: Simplified Highlighter.highlightBlock function One thing Qt lacks is an integrated spell check in the text entry components. For a project I’m working on this is necessary. Using python-enchant and the QSyntaxHighlighter I was able to implement this functionality. Here is how to add an in... Continue reading

Better QPlainTextEdit With Line Numbers



My last post was an implementation of a Qt widget which displays text with line numbers. I found that it has a few limitations. The biggest was a performance penalty when dealing with large documents. I’ve since re-factored and rewritten the class to make the performance acceptable. I’ve also cleaned... Continue reading

QTextEdit With Line Numbers



Here is a Qt4 widget written in Python that allows for line numbers next to a QTextEdit. Similar to what is seen in a number of text editors such as gedit and kate. from PyQt4.Qt import QFrame, QWidget<span... Continue reading

ASCIIize Text



One pet peeve of I have with my Cybook Gen 3 is its inability to properly display unicode characters in plain text files. I don’t need anything fancy like Japanese characters just simple things like “ and ” (as opposed to “ and “). To solve this problem I’ve been... Continue reading

History Drop Down With Model



Following is a bit of python code that illustrates how to create a QComboBox that attaches to a model for listing history items. The main features of this code are items entered in the text area of the combo are added to the history. Selected items and items... Continue reading

QCompleter and Comma-Separated Tags



Here is a python script demonstrating how to use QCompleter to complete multiple tags in a QLineEdit. A few features of this script are: removing tags from the drop down that already appear in the QLineEdit, caching the tags, and inserting a , after... Continue reading

Calibre Week in Review



Not much happened this week. A few bug fixes and a new output format, RTF. It produces acceptable results. It also embeds images into the file. The output could use some tweaking, but this will come with time. The only caveat is the output is ascii only. This is to... Continue reading

Changing Single Quotation Marks to Double in eBooks



As a person living in the USA I highly prefer double quotation marks to single quotes when denoting speech. Some authors use the single quote for effect but mostly it’s just a style choice. I find UK authors generally use the two interchangeably. Tolkien books are a good example. I... Continue reading

Kindle Detection Bug in Calibre



The Kindle has been very tricky to get working in Calibre. However, it is finally working correctly (at least it should be). The latest issue with the Kindle driver was in the usbms core. The main memory location was never being set. On Windows the driver loops over all attached... Continue reading

Cybook t2b Format Specification



The Cybook Gen 3 uses it’s own image file for thumbnails. The t2b file is generated by the device based upon the image found in the ebook. If there is no image a default one with the file name written across it is created. One of the feature request for... Continue reading

Calibre and New Driver Code



This Christmas Santa was very nice to me. He gave me a Cybook Gen 3 ebook reader. I’ve really been needing a new one since Tati has been monopolizing (this isn’t a bad thing) the Sony Prs505 we already had. Sadly the ebook management application I often use (Calibre) didn’t... Continue reading

json and blogger



Today I decided to learn about json. To help me with this I coded a little python script I call blogger-updates.py. It takes the name of a blogger blog and optionally a number designating the number of entries to retrieve. I used Google’s blogger api to get the data.... Continue reading

ARC ActiveX Apple B&N Base64 C lang COM DLL DNS Device Docker FLAC FT GUI GeR2 JNI Javascript Linux Lua Lua C API Mac N770 OS X Off Road OpenSSL REST API STR Shocks Sigil Suspension TLS TOC TRD TRD Pro TRD Sport Tacoma Toyota Vaultwarden Windows WireGuard about ad blocking algorithm amazon analysis android apnx app arch linux automotive backup bash batteries bitwarden book bookeen bookview bug bzr c++ calibre car cats certbot compression configuration container conversion copyright copyright infringement cover cso cybook data structure decoding decompression development device interfaces direction distros dmca donations downloader drm dropbox duplicity eReader ebook ebooks editor electronics encoding epub fb2 files focus st formats formatting future gadgets generic type get books git github gnome google gpl guide hardening headless heuristic hex hg htmlz iOS ideas image intel internationalization interop java jekyll json kernel kindle kwin language law lebookread legal library linode maintenance maintenance programming malware blocking markdown memory mobi mp3 music nginx nook objective-c opds openid opensearch opf packages palmdoc password manager pcre pdb pdf pgm plans play store plucker plugin pml pmlz pocket pro podcast podman ppa print project management prs prs300 prs505 prs700 prs900 pyqt python qt rb regex release restic reveiw reverse engineer reverse proxy review rtf s2n scm screen saver screenshot script search security server sort sorting source code specification spell check spideroak ssl store sync t2b t4b tcr textile thanks thread threading thumbnail tips translations truck txt txtz ubuntu unbound usb vault video vpn vps widget wordpress wpmu x11 xlib xorg xxd yubikey zip zsh ztxt