flak rss random

Delicious Posterous and Pocket

Remember when Delicious was going to shut down and you’d lose all your bookmarks? Fortunately there was time for me to download them all (to a hard drive I no longer have) before all was lost. Even more fortunately, Delicious never shut down and all my bookmarks are still there, years later and long after I’ve forgotten my password. Then came the news that Posterous was shutting down, but I didn’t care because I didn’t use it.

Recently I’ve been using Pocket not just to reformat and save articles for later, but also as an impromptu cross device bookmarking service. To that end I thought maybe I should flick through the old Delicious links and resave anything interesting to Pocket. Turns out I should have cared more about Posterous shuttering, some of the better content I wanted to save was hosted there and now it’s gone. Just one week too late! At least for now, it seems Google is still caching the original pages and not the error message, so I’ve populated Pocket with the cached view of such pages. I don’t know how much content they store on their servers, but I’ll have at least one offline copy on my iPad. What a mess.

The Archive Team’s effort to mirror Posterous may or may not have finished, but they haven’t updated their wiki page since a week before the shutdown and certainly haven’t put the archive back online.

Posted 06 May 2013 18:21 by tedu Updated: 06 May 2013 18:21
Tagged: web

pyggy the simple pygments server

flak uses pygments to generate the pretty highlighted code blocks. The original approach was to just shell out to the command line tool, but the performance is, ah, suboptimal. Caching mostly saves me, but at 0.1 secs per execution, highlighting five small samples pushes the initial page render up to half a second. Searching the intertubes for a pygments server didn’t reveal much. (The top hit is a random sample of highlighted code, not a highligher itself, and the other hits don’t seem very useful either.)

So here’s pyggy. It’s really simple. It listens on a port. You feed it a language, a length, and some code. It returns a length and some highlighted html. It’s not configurable. Maybe someone will find it useful.

import socket
import pygments
from pygments import formatters,lexers

html = formatters.get_formatter_by_name("html", noclasses=True, nowrap=True)
getlexer = lexers.get_lexer_by_name
highlight = pygments.highlight

serv = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
serv.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
serv.bind(('127.0.0.1', 7878))
serv.listen(10)

while True:
        con, addr = serv.accept()
        try:
                fd = con.makefile()
                lang = fd.readline().strip()
                amt = int(fd.readline())
                code = fd.read(amt)

                rv = ""
                try:
                        lex = getlexer(lang)
                        rv = highlight(code, lex, html)
                except:
                        pass

                fd.write(str(len(rv)))
                fd.write("\n")
                fd.write(rv)
                fd.close()
        except:
                pass
        con.close()

pyggy.py

Posted 03 May 2013 14:57 by tedu Updated: 10 Oct 2014 00:38
Tagged: flak programming python web

two captions one graphic

Today’s entrant for worst infographic comes to us courtesy of Esquire, April issue (Robert Redford cover), from a fluff piece about the TV show Mad Men.

We have two captions, each containing one fact, surrounding a single graphic. First, we have “nearly half” which might reasonably be presented as a pie chart. Then we have a pie chart of sorts, but with 34% in the middle. Then we have “34 percent more likely” which is the kind of fact that is not reasonably presented as a pie chart. I guess the artist decided to pick the format according to the first fact and the info from the second fact? What would have happened if the second statistic exceeded 100%? (Or worse, was negative? Would the colored region have started at the top and gone counter clockwise?)

poor infographic

Posted 02 May 2013 14:18 by tedu Updated: 18 Feb 2014 07:18
Tagged: magreview rants

Panic Prompt ssh client

One of the things I used to like about my phone was the fact that it didn’t have an ssh client. Going to a bar and drinking is a great accompaniment to reading about obscure server config tweaks, but less ideal a place for trying them out. I count the inability to screw things up as a feature. But then I wrote a mail system in ruby which required 24/7 care and feeding, and suddenly I couldn’t leave the house without a baby monitor.

I was vaguely familiar with Panic when they announced their ssh client, Prompt. There were two things I liked. First, Panic had reputation for building things which worked (I think, no personal experience). Second, some of the best iPhone apps come from established companies who build them either as an experiment or to meet their own needs, not trying to make a quick buck. The main problem was that at $7.99, Prompt was a full $7.99 more than I’d ever paid for an ssh client. Finally the price dropped temporarily to $1.99 and I took the plunge.

Short version: it works. There are a few bugs, but nothing major. It is almost certainly worth the full price, which only seems expensive in comparison to App Store pricing (and openssh). And now I can finally use my phone to suspend my laptop without getting out of bed.

There are also some free or lite ssh clients available, which are universally so bad as to not be worth naming. From terminal emulation too poor to run top to rejecting hostnames that didn’t contain a dot, the bugs are many and varied.

Posted 30 Apr 2013 17:00 by tedu Updated: 30 Apr 2013 17:00
Tagged: review software

ok computer

The early reviews of Google Glass are starting to arrive. Most seem enthusiastic, but I doubt I’d pay $1500 to beta test a gadget unless I was more than a little prejazzed to begin with. In the midst of processing these thoughts came the news that Google Now is available for the iPhone as well, giving me two things to complain about.

more...

Posted 30 Apr 2013 15:18 by tedu Updated: 12 Feb 2014 08:19
Tagged: computers thoughts

Amdahl's bugs

Quote from a friend who develops mobile apps: “Amdahl’s law generalizes nicely outside of performance gains to mobile software platforms. Once you’ve fixed all the bugs that are fixable, all you are left with are the fundamental limits of the platform, which users don’t understand.” (And he’s not even talking about iPhone.) Mobile platforms are certainly the most common situation where the same app running on two different phones will have different features, but I’d say it even generalizes to all software.

Posted 26 Apr 2013 16:09 by tedu Updated: 26 Apr 2013 16:09
Tagged: quote software

m4 msata upgrade and OpenBSD

When my T430s arrived, OpenBSD didn’t yet support Sandy/Ivy Bridge graphics, so I stuck with Windows and OpenBSD in VMWare. Things change and now I want to run OpenBSD natively. I’m using TrueCrypt on the whole drive and trying to resize that while introducing another boot loader seemed a risky proposition, so I cheated a little by taking advantage of my laptop’s mSATA port and installed a 64GB Crucial m4 mSATA SSD, a trivial upgrade.

more...

Posted 25 Apr 2013 15:58 by tedu Updated: 25 Apr 2013 16:05
Tagged: computers gadget openbsd review

laptop CPU transplant

Don’t try this at home. I gave up on my HP Pavilion g4 laptop as is and decided to try reviving it with a new CPU. The price for the A8 part was down to $30 on ebay. In theory, I was hoping the new integrated GPU would be sufficient to drive gaming on an external monitor at 1080p. According to the source of all true knowledge, stepping from the A4-3300M to the A8-3500M should give a substantial boost to graphics performance.

more...

Posted 24 Apr 2013 03:34 by tedu Updated: 10 Oct 2014 00:38
Tagged: computers project

OpenBSD softraid crypto boot

The upcoming OpenBSD 5.3 release includes boot support for crypto softraid partitions, which allows for full disk encryption. The installer has all the pieces, but they aren’t automatically put together. Some assembly required. The basic installation procedure has been outlined by Ryan Kavanagh, but here’s the summary. Only the initial configuration is even remotely tricky, after that it just works.

Boot install CD or bsd.rd. Either pick shell or escape to one by pressing ! during installation before getting to the disk setup part. Create new disk devices by running sh MAKEDEV in dev. Run fdisk and disklabel to create a RAID partition on the physical drive. Run bioctl with all the magic options to create the softraid drive. bioctl -c C -l /dev/sd0a -r auto softraid0 Continue the installer and install to sd1. Magic.

Posted 21 Apr 2013 17:35 by tedu Updated: 10 Oct 2016 17:35
Tagged: openbsd security

standard integer promotions

A followup of sorts to the previous post on integer types. Let’s start with a little quiz of sorts. What does this function print?

more...

Posted 12 Apr 2013 20:07 by tedu Updated: 19 Apr 2013 06:54
Tagged: c programming