Junk Food for the Brain

Open Source and Awesomesauce :)

Migrated to Webfaction

| Comments

FInally migrated to Webfaction. Whoa, for a static HTML only blog, load times have finally decreased dramatically.

Check out the difference in load times, based on Google Analytics’ site speed. I migrated to Octopress on the 19th of December, shaving load times from a peak of 16 seconds!! to 2 seconds. Moving to Webfaction made it 0.9 seconds :)

Migrated to Octopress

| Comments

So I say goodbye to Wordpress and hello to Octopress. Like it says, it does feel more hackerish, with the perfect amount hand-holding that jekyll doesn’t give.

I’m lucky in the sense I didn’t actively blog that much, (or a poor excuse for a blogger, depending on your POV) so I had like < 100 posts to migrate over. You could read more real life migration pains at Pixel-in-Gene.

For post conversion, I used Thomas Frössman’s exitwp plugin, which is written in Python. I then removed all the cruft personal posts that served no purpose, leaving only the technical bits in.

The none active comments are removed, but I’ll be adding a disqus section soon.

For now I’ll be working on optimizing my workflow for blog publishing, possibly through rsync, or maybe git.

Lftp Fatal Error: Certificate Verification: Not Trusted

| Comments

If you use lftp alot, occasionally you will encounter sites that just use ssl to secure transmission, but don’t actually purchase a proper SSL cert for the domain.

You would get the following error message:

Fatal error: Certificate verification: Not trusted

If you are sure its really the intended site (No Man in the Middle Attacks!), you can temporaryly disable certificate verification by the following command at the lftp prompt:

lftp > set ssl:verify-certificate no

To permanently set this for lftp, you could add this to your /etc/lftp.conf or in your home directory ~/.lfptrc file.

Fedora 16 Use Sun Java JDK

| Comments

Fedora 16 comes with OpenJDK by default. For certain application, you are required to use the SUN JDK. This post shows you how to download and install the latest Oracle Java Development Kit (JDK) and set Fedora to use it by default.

Download the latest Java JDK from here.


I used the tar.gz version. I choose to install it in /opt

tar -zxf /path/to/your/jdk/download/jdk-7u2-linux-x64.tar.gz -C /opt

This extracts the Java JDK to /opt/jdk1.7.0_02

Use the alternatives command to then set this as the default java.

# /usr/sbin/alternatives --install /usr/bin/java java /opt/jdk1.7.0_02/bin/java 200


  • –install - Command to add an ‘alternative’
  • /usr/bin/java - where the java program should be linked to
  • java - The type of ‘alternative’ we are installing
  • /opt/jdk1.7.0_02/bin/java - The full path to the java binary
  • 200 - The priority of this version, the higher the number, the higher the chance of it being used first

Test this in the command line by typing

$ java -version
java version "1.7.0_02"
Java(TM) SE Runtime Environment (build 1.7.0_02-b13)
Java HotSpot(TM) 64-Bit Server VM (build 22.0-b10, mixed mode)

You will now see that it uses the Oracle Java.

Fedora 16 Lighttpd Enable Directory Listing

| Comments

Directory Listing is disabled in Lighttpd on Fedora 16 by default. Sometimes you want quick and dirty file sharing over http. Lighttpd is perfect for that.

First install lighttpd:

yum install lighttpd

Enable directory listing in /etc/lighttpd/conf.d/dirlisting.conf

dir-listing.activate      = "enable"

IPTables: How to Open a Firewall Port in Linux

| Comments

Opening a specific port in Linux / Fedora 16. This should work on all ditros that use use iptables.

For example. lets open the default DNS port to allow incoming queries for addresses.

  1. List your exising firewall rules
iptables -L --line-numbers -n

This will list the current rules you have in your firewall configuration Sample output:-

[root@i7 ~]# iptables -L --line-numbers -n 
Chain INPUT (policy ACCEPT)
num  target     prot opt source               destination         
1    ACCEPT     all  --              state RELATED,ESTABLISHED
2    ACCEPT     tcp  --              tcp dpt:22
3    ACCEPT     icmp --             
4    ACCEPT     all  --             
5    REJECT     all  --              reject-with icmp-host-prohibited  
Chain OUTPUT (policy ACCEPT)
num  target     prot opt source               destination
  1. DNS Queries require a UDP packet to port 53 (by default). Since iptables rules are done on a first match basis, we’ll insert it to line 3 in the INPUT chain.
  2. The command to insert the rule:-
iptables -I INPUT 3 --proto udp --dport 53 -j ACCEPT
  1. Where:
    • -I INPUT 3: Insert rule into the INPUT chain at line number 3
    • –proto udp: Incoming Packets that are of the UDP Protocol
    • –dport 53: Packets destined for port 53
    • -j ACCEPT: Jump to the ACCEPT chain (let the packet through)
  2. When you list the iptables rules again, It should show the new rule in line number 3 of the input chain.
[root@i7 ~]# iptables -L --line-numbers -n 
Chain INPUT (policy ACCEPT)
num  target     prot opt source               destination         
1    ACCEPT     all  --              state RELATED,ESTABLISHED
2    ACCEPT     tcp  --              tcp dpt:22
3    ACCEPT     udp  --              udp dpt:53
4    ACCEPT     icmp --             
5    ACCEPT     all  --             
6    REJECT     all  --              reject-with icmp-host-prohibited  
Chain OUTPUT (policy ACCEPT)
num  target     prot opt source               destination
  1. Remember to then save your rules, else the next time the service is rebooted, your changes will be lost.

Fedora 16 Configure Network Interface With Static IP Address

| Comments

This post is just a reminder to myself. Due to the new Fedora Consistent Network Device Naming, a quick guide to how to ‘release’ it from the hassle of Network Manager.

  1. Determine the name of your device
[root@i7 ~]# ifconfig 
lo        Link encap:Local Loopback  
          inet addr:  Mask:
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:424 errors:0 dropped:0 overruns:0 frame:0
          TX packets:424 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:31696 (30.9 KiB)  TX bytes:31696 (30.9 KiB)  
p34p1     Link encap:Ethernet  HWaddr 20:CF:30:0F:37:4A  
          inet addr:  Bcast:  Mask:
          inet6 addr: fe80::22cf:30ff:fe0f:374a/64 Scope:Link
          RX packets:297754 errors:0 dropped:0 overruns:0 frame:0
          TX packets:190679 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:426415608 (406.6 MiB)  TX bytes:15724959 (14.9 MiB)
          Interrupt:69 Base address:0x6000 

In my case, the device is called p34p1.

  1. Create a file in /etc/sysconfig/network-scripts called ifcfg-p34p1
  2. Contents of file:
  1. Important points to note:
    • NM_CONTROLLED=no: Tell NetworkManager not to control this device
    • DNS1= The DNS Server to use
    • HWADDR: The MAC address of the NIC