Category Archives: Offtopic

San Francisco Muebles: A Website from the 90’s!

Several years ago (1999 to be precise!), i’ve started a simple website for my father’s business: San Francisco Muebles.

This is how it used to look like (thanks god for web.archive.org!)

san-francisco-muebles

Back then, iframes, simple javascript, fancy flash buttons… and some plain html was, pretty much, the gold standard for a personal (OR business) website.

Over the years, my dad’s website has evolved into many different incarnations: i’ve adopted Plain-PHP, Code Igniter, and jQuery to handle fancy transitions.

But at some point you hit a brickwall: how do i make this maintainable by anyone (not just me!) and extremely lightweight?. I do run my own Amazon Box… can i also have an extra backup layer, just in case i break my EC2 instance?

What is Jekyll?
It’s a simple tool, written in Ruby, that allows you avoid HTML duplication: if you’ve got many pages that should look the same way, you simply get to write a template, and reuse it all over.

Why Jekyll?
Jekyll is the engine behind Github Pages, and it simply caught my eye.

What is so great about having a website in Plain HTML?
Simply put, the resources required to host a Plain HTML website are extremely low.

Plus, you get to use Route53 Failover Mechanism: your website is constantly monitored. If anything goes wrong, Route53 takes over, and maps your domain elsewhere. In my case, Amazon S3 will just kick in, and serve the site.

Conclusions!
Implementing Jekyll has been a fun (and quite successful) experiment. It just took under 8 hours to do the whole thing.

However, some knowledge is still required: you need to execute a script, and upload the output to the server. Which is okay, but… there are many ways in which things can go wrong.

Bottomline: there is nothing easier, and more parent-friendly, than WordPress. Which is precisely the reason why the next incarnation will be WP based!

Git toggled folders as submodules!?

Few days ago, i had to struggle with a strange scenario in which git began tracking a folder, as if it was a submodule.

Now, what’s strange with that?: i didn’t set any submodules!. My .gitmodule file was empty (in fact, i didn’t even have that file).

Thanks to this stackflow question, i ended up figuring out this solution:

git ls-files --stage | grep 160000
git rm --cached [Paths retrieved from the command above]

Hopefully, this will help another lost soul!

Shrinking EBS Volume

It took me a while to shrink my EBS volume, but this post helped quite a lot.
For further reference, this are the exact steps i’ve performed:

  1. Created a snapshot of the EBS volume, for backup reasons.
  2. Added a new volume, based on the snapshot.
  3. Added another volume with the desired size.
  4. Attached both, the Normal and Shrunken volumes.
  5. Check the big volume, and resize it:

    [cc]
    e2fsck -f /dev/bigvolume
    resize2fs -M -p /dev/bigvolume
    [/cc]

  6. Note that ‘resize2fs’ will say something like:
    [cc]Resizing the filesystem on /dev/xvdg to 1035624 (4k) blocks.[/cc]
  7. Let’s calculate how many 16MB blocks we’ll need:
    [cc]x = 1035624 * 4 / 1024 / 16 = 253[/cc]
  8. Proceed copy’ing blocks to the small volume:
    [cc]dd bs=16M if=/dev/bigvolume of=/dev/smallvolume count=253[/cc]
  9. Resize + Check the small volume:
    [cc]
    resize2fs -p /dev/smallvolume
    e2fsck -f /dev/smallvolume
    [/cc]
  10. Stop the instance.
  11. Detach the 3 volumes: Root, Big and Small.
  12. Attach the Small volume at the same location as the previous root volume was. In my case, /dev/sda1.
  13. Ready!