Tag Archives: html

Terminal coloring

Ah, the wonderful world of the command line. I wouldn’t be able to look at myself in the mirror (and by mirror, I mean reflection in my monitor) if I couldn’t play the shell as if it were a finely tuned 128-key instrument. But I like to add a little pizzaz to the very black-and-white (or black-and-amber, or black-and-green) world of Terminal.

To do this, one adds ANSI color codes to things. Pass a proper flag or two to ls, set CLICOLOR in your environment, and most of all, set your PS1 to something interesting. Here’s mine for my local machine:

PS1='\[\033[35m\]\u@\h\[\033[00m\]:\[\033[94m\]\w\[\033[96m\]\$\[\033[00m\] '

The result looks something like this:

gwynne@localhost:~/Desktop$ _
Continue reading

Highlighting source code in WordPress with Pygments

So I was playing around with the rather nice SyntaxHighlighter WordPress plugin. It worked pretty nicely. But it had some issues, IMO:

  1. It repurposes the class attribute to act like a pseudo-CSS ruleset with custom rules. To me that’s just ugly.
  2. It does all its work client-side. For some things that’s a nice touch, but for a blog with mostly static content it’s wasted time.
  3. It does almost everything in JavaScript. I have a personal distaste of working with JavaScript for no especial reason whatosever.
  4. It’s LGPLv3. I prefer less restrictive licenses for OSS.

On the other hand, I know the Pygments syntax highlighter pretty well, and I already had a written style plugin for it to get the syntax coloring I like. But there’s no mature Pygments plugin for WordPress that I could find. So I did what any good programmer would do and set out to write my own. I have the working knowledge of PHP (I’m a core dev, for mercy’s sake) and Python to do it with, after all. Not so much WordPress’ plugin API, though, so I took the SyntaxHighlighter plugin as a starting point.

Continue reading

Yet another blog

Well, why not. It took 40 minutes to shut off all the useless crap WordPress installs and turns on by default, and then another 15 minutes to kill the extra stuff DreamHost decided to install on top of that. This is what I call the overproliferation of Web technology; this application is an absolutely perfect example of the evolution of the Web into the single application used for everything you do on a computer. A stateless ancient protocol like HTTP, a twisted screwy markup language like HTML (yes, including XHTML and HTML5), a dangerous and badly misused active content language like JavaScript, absolutely ZERO standardization on audio and video formats (HTML5 lost its focus on Ogg when Apple turned up their noses at it), and even more “operating systems” (Safari, Firefox, IE, all the variants on them, and all the niche browsers) than a real computer (which is at least limited to Windows, Apple, and the *NIX variants). Sure, turn the world into one big network, I have no objection to that, but do it with modern technology instead of clinging to the ARPAnet!