Managing EC2 reservations with Scripts

The Story

Since we tend to hold our AWS EC2 VMs for a long time, we usually reserve them.
Reservations are like pre-buying instances - you pay AWS ahead of time for (let's say) a year, and get a discounted price.
The insterestng thing about EC2 reservations is that they ...

more ...

Scripting YUM provides search using Python

Update 24-06-15

Thanks to this page, I fixed my script. It no longer requires root privillages. I also muted informational messages because they were not very informational.

The Story

Today I had a list of files (nagios check scripts), and I wanted to check for every file if there's ...

more ...

Batch fitting pictures in ImageMagick

I recently bought a digital frame for some of my more elderly relatives.
The frame's firmware was quite retarded, and I had 2 issues with it:

1. Pictures were always displayed in order

This might be a "not a bug but a feature" type of situation, but still.
I ...

more ...

Resizing AWS root EBS in CentOS HVM

Update 04.07.15

This method doesn't work anymore because of some weird AWS restriction, which says you can't connect the root device of a marketplace AMI (like the CentOS one) to another VM, lest you discover its secrets.
I developed a better method which involves either rebooting ...

more ...

AWS's Block Device Mapping in CentOS

The Story

I'm using Amazon's EC2 for some of my VMs, which run CentOS. When viewing Block Device Mappings (mapping between the virtual storage - ebs, ephemerals etc. and the block devices inside the VM) in CentOS 6.5, I ran into an annoying issue. When inspecting my instance ...

more ...

Accessing a specific server in an HTTP cluster

The Problem

Part1 - Fault tolerence

A common configuration of web servers is setting up multiple servers to serve the same content, with a load-balancing method redirecting / forwarding clients to a specific server.
For instance, let's say I'm using servers server and otherserver to serve the site cluster-name.
The ...

more ...

Adding Repositories for Inspection

Sometime I want to inspect software repositories. However, I don't want my machine to actually install anything from it.
To do so, I made a small bash function that both adds the repository and pins it to priority -1, telling apt to never install anything from it (unless manually ...

more ...

Timing Execution By Output Lines

The Story

Today I got annoyed that some puppet agent runs took me over 90 seconds to complete, even though they actually did nothing (no change was needed).
I wanted to see which part of the run took the longest, so I tried this:

sudo puppet agent --test --debug

Unfortunately ...

more ...

Hijacking a process's i/o streams using gdb

The Story

I recently had a very annoying problem - some daemon failed, but ran fine when told to run at foreground (not daemonize). Running at foreground is the easiest way to debug processes, because that way you get their input / output / error streams in your terminal.
Said daemon had no ...

more ...

Automatically Mounting USB drives and Surviving Reconnects

Today I solved a problem that has been bothering me for a while - being unable to automatically "remount" my USB drive in case it disconnects and reconnects.

The Story

My raspberrySeed (rPi + Debian + Deluge) has a USB drive connected (to keep the downloaded content in). The filesystem on that drive ...

more ...