A totally amazing mind
Anonymous ipless bridge on Proxmox KVM

Here’s a simple howto for setting up Proxmox VE host on 2 ethernet devices looking into local network and the internets. ISP gives me with only one IP to use in a /29 network, so I want to create an anonymous (or ipless) bridge to allow my VM to have this very internet address. Here’s some /etc/network/interfaces:

auto lo
iface lo inet loopback

# bridge to local network with an address for PVE host
auto vmbr0
iface vmbr0 inet static
    address 10.6.7.70
    netmask 255.255.255.0
    gateway 10.6.7.19
    bridge_ports eth0
    bridge_stp off
    bridge_fd 0

# anonymous bridge to the internets with no IP for the host
auto vmbr1
iface vmbr1 inet manual
    bridge_ports eth1
    bridge_stp off
    bridge_fd 0

Then create a VM with a network bridged through vmbr1 and assign your external internet address (173.194.32.3 for example) inside the guest OS. Okay, you got a VM looking into the internets with your only external IP. Oh, and if you want your VM to look into the local network too, just add an interface bridged through vmbr0 (add the device with PVE management interface). Now you can setup the guest VM to balance IP traffic coming from outside to your local VMs with something like nginx. Much cooler than NAT, right?

I did 4 clean installations of debian 6 and checked time of `time apt-get install build-essential`. XFS: 3:12, btrfs: 2:45, ext3: 0:30, ext4: 0:50. What the flying fuck with first two? 6 times slower than ext3? Am I doing something wrong?

I did 4 clean installations of debian 6 and checked time of `time apt-get install build-essential`. XFS: 3:12, btrfs: 2:45, ext3: 0:30, ext4: 0:50. What the flying fuck with first two? 6 times slower than ext3? Am I doing something wrong?

ruby-1.9.3-p194 speedup 30%

I applied funny-falcon's patch for p194 ruby and got ~30% speedup on launching padrino:

Before:

time `padrino console`
user 0m4.116s

After:

time `padrino console`
user 0m2.876s

Yay.

Reverse pagination

Reverse pagination is a trick to make paginated content more bookmarkable and SEO-friendly. Pages are numerated from big numbers (fresh content) to small numbers (oldest content), and each page keeps its content through time.

There is though a nasty drawback. If you have 15 records, 5 per page, everything seems OK. But if you have 16, you have a problem: you get 4 pages, the first one contains one record and the rest are OK, 5 per page. This is outrageous!

So, here is a solution I came to. In my example the first (latest) page should contain more than 5 records (from 5 to 9), and the rest pages stay the same (5 per page). In this case we have all-pretty first page with enough data to dig into, and no duplicate content on the following pages.

Precious git option for rm

You forgot to add a dir to gitignore and then added everything to commit:

git add .

To clear up trash from commit, not touching real files do:

git rm —cached -r public/cache

Voilà!

The most valuable git command

git checkout -f

-f, —force: when switching branches, proceed even if the index or the working tree differs from HEAD. This is used to throw away local changes.

Forget about hard resets. I did.

IE z-index and position:absolute

If you intend to have 2 stacks of absolutely positioned elements, make sure that you set z-index of top parents of both stacks to a natural value. IE 7 and lower fucks up z-order if you don’t set it manually.