Getting started with Docker + Parallels on OS X (using Homebrew)
Update: Sep 2016: This is no longer relevant; best to download Docker for Mac which uses xhyve to virtualize the Docker Engine environment and Linux kernel-specific features on OS X. This allows for much easier sharing of files between your local machine and docker containers.
Want to use Docker on OS X? At the moment, the OS X kernel does not directly support containers like Docker or OpenVZ. So you have to run a VM with docker installed. You then use the Docker CLI to interact with the Docker (daemon) running on the VM. The whole process is actually very easy to setup now that Docker Machine supports the Parallels driver.
$> brew update # need to brew with a recent version $> brew upgrade $> brew install docker docker-machine docker-machine-parallels … grab some coffee… $> docker-machine create -d parallels dev1 $> eval `docker-machine env dev1` $> docker run hello-world
You are now ready to use Docker, Docker Composer and even Docker Swarm.
Using #iptables to forward a whole IP address to another (server)
iptables -A PREROUTING -t nat -d $src -j DNAT --to $dst iptables -A POSTROUTING -t nat -d $dst -j MASQUERADE
Connections from anywhere to $src will get forwarded to $dst (though source IP will be changed to that of eth0 or default outbound device). Useful when moving servers; keeps the old address alive for a bit. Though we lose ‘real’ source address.
For example, if forwarding IP address used by an SMTP server, all email will appear to come from $eth0. If $eth0 (could be the same as $src, but not guaranteed) is privileged, in the sense that it is allowed to relay, then anyone will be able to relay through the SMTP server. But works in a pinch, while DNS changes are propogating through the ‘net.
A somewhat more concrete example. Say you have IP address 184.108.40.206; if you do
iptables -A PREROUTING -t nat -d 220.127.116.11 -j DNAT --to 18.104.22.168 iptables -A POSTROUTING -t nat -d 22.214.171.124 -s 126.96.36.199 -j MASQUERADE
188.8.131.52 is now forwards to Google’s Public DNS Server. You can now use 184.108.40.206 as if it were 220.127.116.11.
“If Java had true garbage collection, most programs would delete themselves upon execution.”
“C++ : Where friends have access to your private members.”
– Gavin Russell Baker
“If debugging is the process of removing bugs, then programming must be the process of putting them in.” – Edsger W. Dijkstra
I just had to resize a virtual disk and it was harder than I thought; writing down what I did so it’s easy to find …
- shutdown VM
qm shutdown 108
- resize disk image
qemu-img resize vm-108-disk-1.qcow2 +20G
- attach pmagic CD; boot to pmagic (using proxmox management web interface)
- extend physical partition
pvdisplay; lvdisplay; fdisk -u=sectors /dev/sda delete partition 2 (remember starting sector) (‘d’, 2) create new partition (n) starting at same sector as before; end is defaulted
- extend pv
pvresize –v /dev/sda2
- extend lv
lvresize –L +20G VolGroup/lv_root
- resize filesystem
e2fsck –f /dev/sda2 resize2fs /dev/sda2
- detach pmagic cdrom
- start VM
qm start 108
Good instructions for working with Windows (NTFS) disk images is here: http://cauldrondevelopment.com/blog/2009/02/26/resize-qemu-ntfs-image/
Microsoft provides updated fonts in a hotfix which is available from here: http://support.microsoft.com/kb/2496898. The hotfix works with Office, Excel, Word and most Windows applications, including browsers.
After installing the hotfix, you can enter unicode characters using “charmap.exe”. In Windows, press the WIN and R keys, type charmap and press enter.
Whether you use the official (Microsoft supplied) hotfix or download a font like Foradian, people who you send your document to, may not have the requisite fonts. Word, Excel, PDF allow you to embed your own fonts, but there’s not much you can do for websites (sure you can do a lot of CSS work and embed your own fonts, but it won’t work with a lot of browsers out there). When sharing docs with people, you can also use the older U+20A8 symbol (₨).
Inserting the older symbol is not much different, and you can use charmap.
|Old Rupee symbol||U+20A8||₨|
|New Rupee symbol||U+20B9||₹|
Another side-effect of installing the hot-fix is that Excel’s “currency format” dropdown now has a Rupee format available:
To use Indian formatting for numbers (i.e. Lakh, Crore instead of Millions) see this article: “Indian Currency format in Excel”