pbrisbin dot com
Using Notify-OSD for XMonad Notifications
Oct 15, 2013
In my continuing efforts to strip my computing experience of any non-essential parts, I’ve decided to ditch my statusbars. My desktop is now solely a grid of tiled terminals (and a browser). It’s quite nice. The only thing I slightly missed, however, was notifications when one of my windows set Urgency. This used to trigger a bright yellow color for that workspace in my dzen-based statusbar.
A Brief Tangent:
Windows have these properties called “hints” which they can set on themselves at will. These properties can be read by Window Managers in an effort to do the Right Thing. Hints are how a Window tells the Manager, “Hey, I should be full-screen” or, “I’m a dialog, float me on top of everything”. One such hint is WM_URGENT.
On Staticness
Sep 21, 2013
For almost 7 years, now I’ve had a desktop at home, running, serving (among many things) my personal blog. Doing so is how I learned much of what I now know about programming and system administration. It gave me a reason to learn HTML, then PHP, then finally Haskell. It taught me Postgres, Apache, then lighttpd, then nginx. Without maintaining this site myself, on my own desktop, I doubt I would’ve been sucked into these things and I may not have ended up where I am today.
Mocking Bash
Aug 24, 2013
Have you ever wanted to mock a program on your system so you could write fast and reliable tests around a shell script which calls it? Yeah, I didn’t think so.
Well I did, so here’s how I did it.
Cram 🔗Verification testing of shell scripts is surprisingly easy. Thanks to Unix, most shell scripts have limited interfaces with their environment. Assertions against stdout can often be enough to verify a script’s behavior.
Email Encryption
Aug 20, 2013
The recent hullabaloo with Snowden and the NSA is very scary. I agree with most Americans that The Government is doing some pretty evil things these days. That said, I also believe that we as cloud users are primarily responsible for the privacy of our own data. Thankfully, the problem of transmitting or storing data via a 3rd party without granting that party access to said data was recently solved.
The Advent of IO
Jul 28, 2013
What if we wanted to write a Haskell program to behave something like this:
$ runhaskell hello.hs Hello who? $ runhaskell hello.hs Pat Hello Pat $ runhaskell hello.hs -u Pat Hello PAT One implementation may look like this:
main :: IO () main = do args <- getArgs let name = case args of ("-u":n:_) -> map toUpper n ( n:_) -> n otherwise -> "who?" putStrLn $ "Hello " ++ name And almost immediately, the budding Haskell programmer is met with a number of confusing concepts: What the heck is IO ()? What does <- mean? When questions like these are raised, the answer is “well, because Monad.” Not very enlightening.
Cloud Music: A Comparison
Jun 29, 2013
For the longest time, my interaction with music was via MPD. I had a substantial collection playing on my always-on desktop. I could connect from anywhere to control the playlist and pick up the stream via its HTTP output. I had effectively built my own cloud music service.
While that was great, there were a few annoyances:
First, I had to juggle two interfaces while listening remotely. One to actually manipulate the playlist and another to hear the stream. Second, and more importantly, my collection was stagnant. I wanted smart recommendations, and I wanted a simple way to click through and add what I liked to my collection.
Parsing DATABASE_URL
Jun 7, 2013
A while back, I made a post about deploying yesod apps to heroku. The method used back then is no longer required (thank God!) and deploying to heroku is super simple these days. So simple, in fact, that I won’t reiterate those instructions here, this post is about something a bit more specific.
Chances are, your app is using a database. And you probably don’t want to hard-code those database credentials in your (probably shared) source code. What you’d rather do is parse them out of the DATABASE_URL environment variable provided by heroku.
For the Library Authors
May 31, 2013
Recently, Yesod released version 1.2. You can read the announcement here, the changelog here, and a detailed blog post about the subsite rewrite here. These resources do a great job of getting users’ apps up on 1.2. This post won’t rehash those, it is instead intended for those of you (like myself) who maintain libraries dependent on Yesod.
The large refactor to the transformer stack and its implications in how subsites are written made it non-trivial to port my markdown, comments, and pagination libraries over to 1.2; I imagine many other such authors are in the same position and might appreciate a little guidance.
Faster Mail
May 30, 2013
I hear and see a lot of passing complaints about dealing with a large amount of mail. I myself subscribe to a few mailing lists which get quite a bit of traffic and these are usually the first to be ignored when I get behind. Once a backlog of unread mail piles up it can be hard to get any traction. The sad part is I enjoy that content, so I definitely don’t want to be missing out just because I occasionally can’t keep up.
Disable All The Caps
May 6, 2013
If you’re like me and absolutely abhor the Caps Lock key, you’ve probably figured out some way to replace it with a more suitable function. I myself have settled on the following command to make it a duplicate Ctrl key:
$ setxkbmap -option ctrl:nocaps This works great when placed in ~/.xinitrc and run as X starts, but what about USB keyboards which are plugged in later? Perhaps your pair-programming, or moving your laptop between work and home. This happens frequently enough that I thought it’d be nice to use a udev rule to trigger the command auto-magically whenever a keyboard is plugged in.