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:
iface lo inet loopback
# bridge to local network with an address for PVE host
iface vmbr0 inet static
# anonymous bridge to the internets with no IP for the host
iface vmbr1 inet manual
Then create a VM with a network bridged through vmbr1 and assign your external internet address (18.104.22.168 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?
ruby-1.9.3-p194 speedup 30%
I applied funny-falcon's patch for p194 ruby and got ~30% speedup on launching padrino:
time `padrino console`
time `padrino console`
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
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.