All posts in Other…
The CoffeeCopter
The Coffee Copter from screenturner on Vimeo.
Customizing CoreOS images
For quite a while I’m impressed by the Docker and CoreOS projects and it has been quite a while on my todo list to look into it…
Since I’ve access to some playground with some old Workstations… I decided to start playing around with it, using PXE boot (this was already set up on that environment).
So I followed the instructions for PXE as described on the CoreOS PXE Boot page, although it kept complaining about an “invalid or corrupt kernel image“, while the checksums (MD5/SHA1) were OK. Since the TFT server is running on RHEL5, I did had an old version of pxelinux, so after the downloading the latest syslinux binary from kernel.org the system booted.
After I had the system booted the system ‘alerted’ me on the fact that the test-environment is using an MTU of 9000 (JumboFrames)…
This could not be fixed by the cloud-config configuration over HTTP method as far as I consider… because the cloud-config is loaded by the OS and therefore it requires up-and-running network-interface (with a correct MTU set);
So I had to modify the CoreOS initrd, to update the MTU in /usr/lib/systemd/network/99-default.link:
MTUBytes=9000
So the we need to unpack the initial ramdisk.
Unpacking the CoreOS Ramdisk
Step 1) Create a temporary location in /tmp:
# mkdir -p /tmp/coreos/{squashfs,initrd,original,custom}
Step 2) Download or copy the ramdisk /tmp/coreos/original:
# cd /tmp/coreos/original/
# wget http://storage.core-os.net/coreos/amd64-usr/alpha/coreos_production_pxe_image.cpio.gz
Step 3) unzip the ramdisk:
# gunzip coreos_production_pxe_image.cpio.gz
# cd ../initrd
# cpio -id < ../original/coreos_production_pxe_image.cpio
Step 4) Unsquash the squash filesystem and move the original-container:
# cd ../squashfs/
# unsquashfs ../initrd/usr.squashfs
# mv ../initrd/usr.squashfs ../usr.squashfs-original
Please note… that you need at least the squashFS 4.0 tools… but you can download the source and compile the binaries (at least it works on RHEL5).
And now you can access the unpacked image via /tmp/coreos/squashfs/squashfs-root and perform modifications, but please use the path minus the usr-prefix and relative to /tmp/coreos/squashfs/squashfs-root. So summarized:
/usr/lib/systemd/network/99-default.link can be found in:
/tmp/coreos/squashfs/squashfs-root/lib/systemd/network/99-default.link
So hack around and apply modification where needed.
Packing the CoreOS Customized Ramdisk
Now we have to repack the ramdisk, so we can load it…
Step 1) Repack the squashfs
# cd /tmp/coreos/squashfs
# mksquashfs squashfs-root/ ../initrd/usr.squashfs -noappend -always-use-fragments
Please ensure you use squashfs tools 4.0!
Step 2) Make it all a cpio archive and zip it
# cd /tmp/coreos/initrd
# find . | cpio -o -H newc | gzip > ../custom/coreos_CUSTOM_pxe_image.cpio.gz
Now boot it and use the custom image as initrd.
Use maildrop to forward a mail to another mail box
I recently had the need to forward e-mail based on the from field to another mailbox. I know, it’s possible with a simple .forward in your $HOME, but that will forward all the mail.
So after some further searching I end up with the following rule for your maildrop filter… it simply checks if the mail (in this example) is from [email protected] and will forward it to [email protected]:
if ( /^From: .*[email protected].*/ )
{
dotlock “forward.lock” {
log “Forward mail”
to “|/usr/sbin/sendmail [email protected]”
}
}
And that’s all you need to put add to your $HOME/.mailfilter
Use Picasa RSS Feed to show album on my own website
Recently I’ve moved the web albums of my kids from my own webserver to Google Picasa. But… I wanted to keep my nice javascript based carousel
In the current code I already had some PHP-code that creates the content of the carousel using an array. Now I added two new features in the ‘website’.
- Config files
- Downloading the RSS (XML) feed and cache it
- Extract the URLs with the photos from the XML feed.
1. Config files
One ‘global’ config:
<?php
cacheLocation=”/tmp/picasa-cache/”;
$cacheTTL = 60;
?>
Per album I’ve a config.php in that directory, so for example we’ve the following content:
<?php
$xmlURL=’http://picasaweb.google.com/data/feed/base/user/k/id/123456970123ASBD1?alt=rss’;
$AlbumDescription=”Rick de Rijk”;
$PicasaURL=”http://picasaweb.google.com/paderijk/Rick”;
$ShortName=”rick”;
$xmlFile=”$cacheLocation/$ShortName.xml”;
?>
2. Download the RSS (XML) feed and cache it:
<?php
# Code that takes care of the caching
#
if (!(file_exists($xmlFile) &&
(time() – $cacheTTL < filemtime($xmlFile))
)) {
//unlink($xmlFile);
$data = file_get_contents($xmlURL);
$f = file_put_contents($xmlFile, $data);
}
?>
3. Extract the URLs with the photos from the feed
<?php
$foto_array = array();
$xml = new SimpleXMLElement($xmlFile, null, true);$urls = $xml->xpath(“channel/item/enclosure/@url”);
foreach ($urls as $image_url)
{
array_push($foto_array, $image_url);
}
?>
That’s all
Mozilla Labs Weave
In one of the last Linux Magazine issues, there was an article with the title “Untangling the Web with Mozilla Weave“. I really recognized the issue of having several Firefox instances with their own bookmarks/tabs/et cetera.
So I thought… let’s give it a try, and so far… it works fine for me. I’ve now set up Weave on my Linux Laptop and Linux workstation at home. The upcoming week I will set up weave for my Linux workstation at work and on my Portable Apps Firefox on ahum Windows Vista workstation.
FUN: Living with First-Person Shooter Disease
Bleeding edge, is indeed bleeding edge
Yesterday I thought let’s play with FC12 (aka Rawhide, aka FC11.90). So I enabled the Rawhide-repositories on my FC11 laptop and entered “yum -y update”. And after a while it was there… bleeding edge kernel and other packages.
The first issue I run into, was that Firefox 3.5 was not able to run, it caused a segfault. There seems to be a bug in the xulrunner package. So I was able to fix it, by “downgrading” Firefox to 3.0.11, but that one crashed on pages using “Adobe Flash plugin”. So I removed the flash plugin, because I wanted bleeding edge Fedora. So having that “sort out” I wanted to suspend my laptop, and guess what… It didn’t want to suspend… so after some hacking around… it still didn’t work.
So my final decision was Go back to FC11. I was able to “downgrade” my system in about 60 minutes. At home I’ve a mirror repository with al the backups, so during installation I added these repositories, so I also had all the updates in one go.
Lesson learned: “Bleeding edge… is indeed bleeding edge!”
I need my work for my daily work… If I won’t need it for my daily work I would have keep FC12 (aka Rawhide, aka FC11.90) on it to participate in developing FC12.
TLS/SSL slow down HTTP-traffic with a factor 57!
Recently I wrote about the impact of SSH-tunnels on HTTP-traffic. So I discussed with a collegue the results and he was wondering in the impact of TLS/SSL on HTTP-traffic. And I found out, that TLS/SSL slows down the communication about a factor …
Use the Nintendo WII console for Desktop VR
Someone pointed my out of the next video at youtube… This is really cool!!!