lae's notebook

kyoto.maidlab.jp

Notice: If you're here to find information about maidlab.jp, this is the wrong place. Maidlab.jp is a top level domain name whose use is shared through the non-profit DNS hosting services at afraid.org. I know nothing more than that, but thanks for visiting.

Second Notice (2013.06.29): Yes, the maintainer of maidlab.jp stealthed his domain on afraid.org. No, I don't know the reason behind it. That said, these links are mostly broken.

So, over this weekend I've set up kyoto.maidlab.jp to point to this server. I'm going to start using this virtual host for my own projects, I suppose. Right now, I've made a pretty front page in just a matter of minutes, and just today I've set up some form of a public upload site using restricted SSH. I've wrote a script to make the whole set-up and upload process not too difficult, but enough to prevent automated spam bots.

This is basically how I set it up and use it, though the instructions differ:

[liliff@hicari ~]$ wget -qO - http://kyoto.maidlab.jp/kmjp.sh > ./bin/kmjp
[liliff@hicari ~]$ chmod +x ./bin/kmjp
[liliff@hicari ~]$ kmjp bin/kmjp 
Downloading private key...
Private key now stored at /home/liliff/.ssh/kmjp-upload.
Uploading bin/kmjp...
kmjp                                      100% 1419     1.4KB/s   00:00    
Success! Uploaded file can be found at:
http://kyoto.maidlab.jp/p/kmjp

Pretty neat, isn't it? I'm basically giving access to SCP for anyone for a particular folder on the server. The major flaw I have right now is that files may be overwritten, which is something I'll be looking into resolving server-side. It's also somewhat amusing how the script itself auto-updates should there be a change on the server's version of the script. Useful.

Update (9:17): It's been updated to use rsync instead of scp now, to get around the overwriting files issue.

Update (16 Feb 2013): This didn't turn out to be very safe to unleash to the public. I wrote an article that goes into detail about public scp. As a result, the above script and associated private key are no longer available for download.

ZMonitor

I've spent the past few weeks working on a decent-sized project called ZMonitor to help at my current job. It is basically a client I developed in Ruby to show the Zabbix dashboard in a terminal, since there wasn't one available previously (other than this perl+curl mashup my workplace was using).

The main application basically calls the API twice through JSON calls to gather all of the information it needs, and then generates an array of strings and prints them at the end. There is an option to hide events that are in maintenance mode, which can help a lot from spamming you with an unusable list.

The acknowledgement function can accept most regular expressions to allow for mass acknowledgement (however, no wildcards since those can be abused too easily).

There are several TODOs for this application already, too, that I might not get to complete anytime soon. The major one is to use ncurses for rendering the dashboard, and quite a bit of functionality will come with that (such as acknowledging from the dashboard, and maybe interactive filtering). Additional functions for showing the history of a server is also planned, and a calibration function to determine time differences between the local computer and Zabbix master.

1.0.9.pre is for the most part very usable now. I personally think some of the code is a bit ugly since I'm not superb at Ruby yet, so all input is welcome. The whole application is also pretty colourful, don't you think?

First Dive Into Lua - A Battery Widget

So, it's come to the point where my laptop has unexpectedly turned off from a dead battery one too many times, so I decided to write a battery widget using Vicious for the window manager I'm using, Awesome. The configuration files are all written in Lua, and honestly I've never touched Lua or felt like programming in it since it looks so...confuzzling.

Nevertheless, I took a look at the Vicious and Naughty libraries, and some Lua documentation to get this up and running:

batmon = awful.widget.progressbar()
batmon:set_width(8)
batmon:set_vertical(true)
batmon:set_border_color("#3f3f3f")
batmon:set_color("#5f5f5f")
batmon_t = awful.tooltip({ objects = { batmon.widget },})
vicious.register(batmon, vicious.widgets.bat, function (widget, args)
	batmon_t:set_text(" State: " .. args[1] .. " | Charge: " .. args[2] .. "% | Remaining: " .. args[3])
	if args[2] <= 5 then
		naughty.notify({ text="Battery is low! " .. args[2] .. " percent remaining." })
	end
	return args[2]
end , 60, "BAT0")

What this basically does is create a progressbar widget with the Awful library, configure its settings, create a tooltip with detailed information, and registers the widget I created with Vicious. The Vicious portion of it uses the battery widget type and sets a timer to update it every 60 seconds, which updates the progressbar percentage and the tooltip. It also checks for a low battery, which for me pops up a little box at the upper right of my screen.

I'm probably not going to be touching Lua for a while again.

DNS Resolution and Site Moves

For now I have *.milkteafuzz.com and *.teppel.in currently pointing to the same server and document root. Anyone who's visiting for anime.milkteafuzz.com or some other service I previously had on my other servers should expect to see those come back up in the coming weeks (possibly this weekend) while I spent some time toying around with nginx' configuration.

With that said, some other special surprises may be in store.

Server Switch!

So, yesterday I had my first dedicated server provisioned, and I've been tinkering with it since then, getting it configured as nicely as I can, with LVM and all sorts of funky things.

This site has now moved to the new server~ The domain is still currently pointing to the old server, and the old server is actually proxying requests to the Jekyll daemon on the new server for the time being, until I get the rest all migrated over.

I'm also going to be working on getting a TremZ server online later - was intending to have it up by now but I guess I delayed myself a little with getting the actual dedicated server. Got a good deal though, through Vee from DediDirect!