lae's notebook

A Simple Bash Alarm Clock

Someone on IRC linked to a script called DEADLINE, which got me to thinking, a simple alarm clock script should be easy to concoct in bash if that's what the end goal is. I did a quick Google search but didn't find any simple solutions - they were all excessive in some way. So, here I ended up creating a bash one-liner in a few minutes to see it in practice and confirm I wasn't crazy:

sleep $(( $(date --date="7 pm Feb 23, 2012" +%s) - $(date +%s))); echo "It's been a year since you touched this, and the sky is dark! Lalala."

I could easily expand this to request a simple date and play an audio file:

printf "What time are you setting this alarm for? "
read date
echo Okay! Will ring you on $(date --date="$date").
sleep $(( $(date --date="$date" +%s) - $(date +%s) ));
echo Wake up!
while true; do
  /usr/bin/mpg123 ~/alarm.mp3
  sleep 1

This can accept date inputs like "january 1 next year", "tomorrow", "23:00 today" and so forth. In fact, one could expand this script to test for valid dates, or replace the prompt with argument parsing for the same behaviour as "Deadline." I would also probably suggest adding nohup to the script, to relay its execution from the shell and into the background after the date has been inputted.

In fact, I may update this later when I have the time with a more robust (but still short and inexpensive) version.

There are a lot of things you can do with native UNIX utilities, and I'm not quite understanding why they aren't taken more advantage of.

Postler and it's "INBOX is locked" message

I'm sure some of you have had Postler stop being able to receive messages from your email account one day or another, but have had no idea why.

Running postler in a command line, I would see the following when attempting to "receive mail":

    • (postler-service:2376): DEBUG: postler-service.vala:67: Line/ input: Connection is now encrypted ** (postler-service:2376): DEBUG: postler-service.vala:67: Line/ input: Logging in... ** (postler-service:2376): DEBUG: postler-service.vala:67: Line/ input: Opening slave local... ** (postler-service:2376): DEBUG: postler-service.vala:67: Line/ error: Error: channel :remote:INBOX-:local:INBOX is locked ** (postler-service:2376): DEBUG: postler-service.vala:303: Done: 0 new messages

I couldn't figure it out at first, and the first time it happened I thought it was a transitory issue since it seemed to have been fixed when I reinstalled Postler and move the old configuration directory out of the way. Then, it happened again and I had stopped using Postler to check mail.

Just yesterday, however, when I had a process to kill, I saw a postler-mbsync process while I wasn't running Postler. I killed it (killall postler-mbsync) and then started up Postler today, and lo and behold, the inbox is no longer locked and I am able to receive mail~

Finally set up Jekyll!

Tah-dah! This site is now officially powered by Jekyll.

I did put this off for a few days, but all the content I had generated up to now was being created so that I all I really needed to do was get some layouts created for these posts and pages. It's really flexible, I can tell!

I will be writing some articles on Jekyll seeing as it's not very simple to delve in if you're not already familiar with it (it took me the entire day to push this out) both for my reference and for others who might have trouble. There doesn't really seem to be a lot of documentation with setting up a Jekyll site on the internet yet, so hopefully this will come in handy.

Update: Just pushed an initial commit for this site's source at Github.

Knights of Reason / Tremulous server

Per request by a old fellow KoR member, I've set up a tremulous 1.2 server at You should be able to connect normally with Trem's client or Segfault. The server's name is since it seems my friend, with some support from Aaron (the main KoRx developer) wants me to have it be their official 1.2 server.

I'm going to look into possibly modifying a QVM, too. I can't go all full-fledged with porting KoRx to 1.2 (despite the huge want for it...) since I don't know C, and Aaron is both too busy with school and too lazy to port it himself, heh.

Starting a new project!

So, I started a new project called Project Himari (and it's being hosted on github) that I'd like to become a complete maintenance suite for my server and perhaps servers owned by other people. There's not much in it for now, and I'm sure development will be slow since I'm not that well-versed in Ruby yet, but hopefully I can get a lot done within the next few months~

It will basically be something like cPanel/WHM, but coded in Ruby and meant for Lighttpd (and I'm looking into incorporating nginx as an option, too), regular websites (with standard support for PHP, of course) and Rails applications.

All that's been done so far is some planning and layout, along with a script to create an account (but it doesn't create one yet actually, mostly everything up to that point has been completed - the prompts and options, etc.). Learning and going for the time being.

I think I'm going to read another Ruby book now, specifically Zed A. Shaw's Learn Ruby The Hard Way, and work on the project afterwards. It has been a few years since I touched why's poignant guide to ruby (I happen to have a copy I printed out, too, it seems - I might go over it, too).