tag:blogger.com,1999:blog-43724717140607028622024-03-21T10:51:48.012+05:30Bot CyborgA Cyborg's Gibberish Jabbering That Will Leave Your Brain Wobbling.Sambithttp://www.blogger.com/profile/10315454465933047223noreply@blogger.comBlogger30125tag:blogger.com,1999:blog-4372471714060702862.post-16922291626952820082012-11-20T21:40:00.000+05:302012-11-20T21:43:58.552+05:30Force an application to use VPN, using iptables in Linux<div dir="ltr" style="text-align: left;" trbidi="on">
Enforcing an application, for example a torrent client like <a href="http://www.transmissionbt.com/">Transmission</a>, to always use the VPN interface or any particular network interface for that matter, is trivially simple using iptables on Debian, Ubuntu or any other GNU/Linux distro.<br />
Personally, I am running Debian Sid on the <a href="http://www.raspberrypi.org/">Raspberry Pi</a>. Occasionally I use it for downloading files ( legal stuff, seriously, believe me :D ) using Transmission Bittorrent client over a VPN connection. Sometimes it happens that the VPN connection fails and doesn't reconnect for whatever reason and Transmission continues pulling stuff directly over my internet connection, which I would like to avoid. Fortunately it is very straightforward to enforce rules based on application owner UID. Transmission runs under the owner <i>debian-transmission</i> in Debian (use <i>htop</i> to check this) and the following two lines of iptables ensures that any process with owner having UID, <i>debian-transmission</i>, will not use any other network interface apart from the OpenVPN tunnel interface <i>tun0</i><br />
<br />
<code>pi@sam-berry ~ $ sudo iptables -A OUTPUT -m owner --uid-owner debian-transmission -d 192.168.0.100 -j ACCEPT
</code><br />
<code>
pi@sam-berry ~ $ sudo iptables -A OUTPUT -m owner --uid-owner debian-transmission \! -o tun0 -j REJECT
</code>
<br />
<br />
The first line ensures that, my Mac-mini having IP address 192.168.0.100 on the lan, can always access the web interface of transmission. The second line makes sure, no outgoing traffic can leave via anything other that <i>tun0. </i><br />
Peace of mind restored, thanks to iptables.</div>
Sambithttp://www.blogger.com/profile/10315454465933047223noreply@blogger.com9tag:blogger.com,1999:blog-4372471714060702862.post-36355582892817033422012-11-07T22:47:00.000+05:302012-11-07T22:47:03.557+05:30Intel 520 SSD upgrade on unibody Mac Mini - mid 2011<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="separator" style="clear: both; text-align: justify;">
With the SSD prices dropping significantly in last few weeks, I couldn't
resist the temptation to open up my Intel Mac Mini (unibody mid 2011
model) and pop in one.<br />Although, Apple prohibits users to upgrade
anything apart from the RAM, I love voiding warranties. Apple uses a
proprietary connector to hook up the SATA disk. Fortunately the people
at <a href="http://eshop.macsales.com/item/OWC/DIYIMM11D2/">Other World Computing</a> and <a href="http://www.ifixit.com/Apple-Parts/Mac-Mini-Dual-Hard-Drive-Kit/IF171-005">iFixit</a> are selling DIY second hard disk installation kit with nicely made video tutorials. iFixit, was showing out of stock, which made my task of choosing, whom to order from, much easier. For the SSD I went with 240 GB one from the trusted and reliable <a href="http://www.intel.com/content/www/us/en/solid-state-drives/solid-state-drives-520-series.html">Intel 520 series.</a></div>
<div class="separator" style="clear: both; text-align: justify;">
Some, Mac users were cursing at SSDs from other brands at various forums, though it wasn't very clear whether the problem was with the competence of the SSD manufactures in making their products compatible with Apple (or vice versa) or with the incompetence of the users performing the DIY upgrades! Anyway, most were satisfied with this particulars series, so I just decided to play safe. </div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
The video tutorials from both the sites are pretty comprehensive, so I am not bothering to add any more jabberings! Just dumping some pics that I had taken during the process!<br /><br /><br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgL_BnHV5hOOTy9Et0X9oLJFy_3QDpLI7DZuTjSBnfaquXKshPBLSJucLGfb1NbBykgEv-grZAQuTibZ_7XISikL-rcg6gCmgiFEbkjtrthmd7ficqNynfhN8OqJnftKnSb1jcIxvB2djge/s1600/DSC04065.JPG" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" height="150" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgL_BnHV5hOOTy9Et0X9oLJFy_3QDpLI7DZuTjSBnfaquXKshPBLSJucLGfb1NbBykgEv-grZAQuTibZ_7XISikL-rcg6gCmgiFEbkjtrthmd7ficqNynfhN8OqJnftKnSb1jcIxvB2djge/s200/DSC04065.JPG" width="200" /></a></div>
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEit_HJxRE6IKCcekXaHN9cLXxZE6o1JMbxbVZG72eq6jrQNJLNMyDjATJhAg9cPywaJP1sy-LaHbNXk2G0jZd8SG2ZiAe7WWTBgO5ivBkD4RNk9pa8Z_7HuLaS82muoM7vONQ9vlSA09Sjh/s1600/DSC04056.JPG" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEit_HJxRE6IKCcekXaHN9cLXxZE6o1JMbxbVZG72eq6jrQNJLNMyDjATJhAg9cPywaJP1sy-LaHbNXk2G0jZd8SG2ZiAe7WWTBgO5ivBkD4RNk9pa8Z_7HuLaS82muoM7vONQ9vlSA09Sjh/s320/DSC04056.JPG" width="320" /></a><br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh1gKyqXREk_TqC3U3ZSAgmN2Vm531vqCuK48tpTGrgkvtjCY130fp6i7tp7YnfC3A4j2TuIihgLVTzvkskZnreiCkUmo_2R0jYAcRDjP7BL9rs2kPszG1nawvw3b5FfL1Q6KgmW3lbohER/s1600/DSC04085.JPG" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="150" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh1gKyqXREk_TqC3U3ZSAgmN2Vm531vqCuK48tpTGrgkvtjCY130fp6i7tp7YnfC3A4j2TuIihgLVTzvkskZnreiCkUmo_2R0jYAcRDjP7BL9rs2kPszG1nawvw3b5FfL1Q6KgmW3lbohER/s200/DSC04085.JPG" width="200" /></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgNReIARb64fkx17upmmncDPKrHQqnM9Cfr9c9d_gYuSnKHCRmNsFvOmtqnl2uCmTXd7JlObvs9uZIpbK-EsSxG0Nq_zj7VWzSBJuLAzSBQykBkektYVo7G_YvDsL05KtBK9gdHwKKoui4L/s1600/DSC04074.JPG" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" height="150" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgNReIARb64fkx17upmmncDPKrHQqnM9Cfr9c9d_gYuSnKHCRmNsFvOmtqnl2uCmTXd7JlObvs9uZIpbK-EsSxG0Nq_zj7VWzSBJuLAzSBQykBkektYVo7G_YvDsL05KtBK9gdHwKKoui4L/s200/DSC04074.JPG" width="200" /></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj8PE8Py7LjAiax0xljkODVCQofl-axr_UsRpvLkpiZvKbnmBjgVePgID98pl2AoSfaBRkBwTypfU3AUenqNE3N-N_PBLwog1BZafmpOicBANzqTNon9hyjJAiyot_4UWBy0tG3OJwGsqqz/s1600/DSC04070.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="150" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj8PE8Py7LjAiax0xljkODVCQofl-axr_UsRpvLkpiZvKbnmBjgVePgID98pl2AoSfaBRkBwTypfU3AUenqNE3N-N_PBLwog1BZafmpOicBANzqTNon9hyjJAiyot_4UWBy0tG3OJwGsqqz/s200/DSC04070.JPG" width="200" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgOu4AP8YQzuOzzY4zsBTyqHLo1P52uN2GpfrM5VCaGUmayYs9wxxrwwLjTi1Kwwrbq45Px3a4_Lzg1XmchyphenhyphenmlifY_IcOf-gQGwXiEWgo2wU8bYixqbNCvBX_uJNVNbXd-t6MDmPWqPOIYd/s1600/DSC04068.JPG" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="300" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgOu4AP8YQzuOzzY4zsBTyqHLo1P52uN2GpfrM5VCaGUmayYs9wxxrwwLjTi1Kwwrbq45Px3a4_Lzg1XmchyphenhyphenmlifY_IcOf-gQGwXiEWgo2wU8bYixqbNCvBX_uJNVNbXd-t6MDmPWqPOIYd/s400/DSC04068.JPG" width="400" /></a></div>
<br />
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgnDJxF6FdNqHXGYtnLFEy-eOpKvU_tmFx5CHdifiTtb05acM9iMi_kmuuoMAHykRKY08Tz8SSVAl6b01WEgPHAZgrfQt2_vcb9MYAKhUKvZ9KiBstGoOycpFuM9_9FTC82hGDnU9oQ_XcQ/s1600/DSC04078.JPG" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" height="300" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgnDJxF6FdNqHXGYtnLFEy-eOpKvU_tmFx5CHdifiTtb05acM9iMi_kmuuoMAHykRKY08Tz8SSVAl6b01WEgPHAZgrfQt2_vcb9MYAKhUKvZ9KiBstGoOycpFuM9_9FTC82hGDnU9oQ_XcQ/s400/DSC04078.JPG" width="400" /></a></div>
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjEQn3j0YCeGA13ZGzGIp9QkrNqaE4BBZtltWX2TL2YtucK_NiaTHMrK_S1guZW-y9Z9J3YyIdGmKqILkPDEPutiiwjy2-AvBEpWzo_VzTbHYdnEMNd7O0LTxVVcqDhJjvtCLX5ppu6bwMC/s1600/DSC04093.JPG" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" height="150" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjEQn3j0YCeGA13ZGzGIp9QkrNqaE4BBZtltWX2TL2YtucK_NiaTHMrK_S1guZW-y9Z9J3YyIdGmKqILkPDEPutiiwjy2-AvBEpWzo_VzTbHYdnEMNd7O0LTxVVcqDhJjvtCLX5ppu6bwMC/s200/DSC04093.JPG" width="200" /></a><br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiY1FqFuseIfhwdRy-8gZD8HeZ_gF7FZIyI9BNYlkmWfa4YMsLmL-92m-dNUG_nc9f-w9QqTtIEuR_RCjbg4sYv55Irjacal70rBgFRDl1F54UDr9rPL_Egixbc-4ALSdyIe2v9N0xMzQxu/s1600/DSC04090.JPG" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="150" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiY1FqFuseIfhwdRy-8gZD8HeZ_gF7FZIyI9BNYlkmWfa4YMsLmL-92m-dNUG_nc9f-w9QqTtIEuR_RCjbg4sYv55Irjacal70rBgFRDl1F54UDr9rPL_Egixbc-4ALSdyIe2v9N0xMzQxu/s200/DSC04090.JPG" width="200" /></a><br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<br />
<br />
<br /></div>
Sambithttp://www.blogger.com/profile/10315454465933047223noreply@blogger.com0tag:blogger.com,1999:blog-4372471714060702862.post-15528786389209433642012-06-23T00:34:00.000+05:302012-10-28T23:29:25.494+05:30Raspberry Pi -- Installing Samba (Windows Share) File server<div dir="ltr" style="text-align: left;" trbidi="on">
Having <a href="http://www.botcyb.org/2012/06/running-debian-on-raspberry-pi-and-sd.html" target="_blank">successfully run</a> Debian Wheezy on my Raspberry Pi, I went forward with my initial idea of setting up a low cost power efficient file server for accessing my external hard disks from my Windows7 desktop, HP-Mini running Ubuntu and Mac Mini running OS X Lion (yeah I do like bragging about my machines :D ).<br />
<br />
This turned out to be pretty straight forward.<br />
<br />
As expected, the external Seagate USB disk immediately got recognized and appeared as /dev/sda<br />
<pre>[ 579.948350] usb 1-1.2: New USB device found, idVendor=0bc2, idProduct=3001
[ 579.948384] usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 579.948405] usb 1-1.2: Product: FreeAgent
[ 579.948421] usb 1-1.2: Manufacturer: Seagate
[ 579.948447] usb 1-1.2: SerialNumber: 2GEX323R
[ 579.967638] scsi0 : usb-storage 1-1.2:1.0
[ 580.970520] scsi 0:0:0:0: Direct-Access Seagate FreeAgent 102D PQ: 0 ANSI: 4
[ 589.142942] sd 0:0:0:0: [sda] 1953525168 512-byte logical blocks: (1.00 TB/931 GiB)
[ 589.144669] sd 0:0:0:0: [sda] Write Protect is off
[ 589.144717] sd 0:0:0:0: [sda] Mode Sense: 1c 00 00 00
[ 589.146298] sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[ 589.171762] sda: sda1
[ 589.180680] sd 0:0:0:0: [sda] Attached SCSI disk
</pre>
<br />
Next step is to create a mount point <br />
<pre>pi@raspberrypi ~ $ sudo mkdir /media/terradisk</pre>
Add the correct entry to /etc/fstab (edit this with your preferred editor)
<br />
<pre>pi@raspberrypi ~ $ sudo vim /etc/fstab
</pre>
So that it looks like the following,<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh1DdgF8vhl-XzBcCqOZE8vTA9yg-VDx06erOnEnwNo5RDtGg-1w7YKqA6BAWep0e1kSX3Hsi0bvDuFfR5VZcbvO4VUV3i1i6m6FjEh6xZOhBmfZdUTNMCbg0iF9aR0JM8sv27E6w6S0skg/s1600/Screen+Shot+2012-06-23+at+2.25.32+AM.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="271" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh1DdgF8vhl-XzBcCqOZE8vTA9yg-VDx06erOnEnwNo5RDtGg-1w7YKqA6BAWep0e1kSX3Hsi0bvDuFfR5VZcbvO4VUV3i1i6m6FjEh6xZOhBmfZdUTNMCbg0iF9aR0JM8sv27E6w6S0skg/s640/Screen+Shot+2012-06-23+at+2.25.32+AM.png" width="640" /></a></div>
<br />
And mount it
<br />
<pre>pi@raspberrypi ~ $ sudo mount -a
</pre>
The new usb drive should now show up<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgfJqDZT8NAxkbA4PMNUC9VXefeAIPVkf8WJEyIne3kbwPQ3R-XdzoSkOyiBI-HbTM-a6S7DdzEuIJ4T6JIz9lFpiriHugID1jP6DBaCtu_OZx5D-kn-Fw5MJBiL5CaX5kcj-kXEX6N0uSh/s1600/Screen+Shot+2012-06-23+at+2.31.35+AM.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="165" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgfJqDZT8NAxkbA4PMNUC9VXefeAIPVkf8WJEyIne3kbwPQ3R-XdzoSkOyiBI-HbTM-a6S7DdzEuIJ4T6JIz9lFpiriHugID1jP6DBaCtu_OZx5D-kn-Fw5MJBiL5CaX5kcj-kXEX6N0uSh/s400/Screen+Shot+2012-06-23+at+2.31.35+AM.png" width="400" /></a></div>
Next install samba,<br />
<pre>pi@raspberrypi ~ $ sudo apt-get install samba samba-common-bin
</pre>
Once finished, open the samba configuration file
<br />
<pre>pi@raspberrypi ~ $ sudo vim /etc/samba/smb.conf
</pre>
and edit as follows. <br />
In the Authentication section, uncomment
<br />
<pre> security = user
</pre>
and add the following section in the end
<br />
<pre>[SamDataDump]
comment = Data Dump on Sam Raspberry Pi
path = /media/terradisk
writeable = yes
guest ok = no
</pre>
Remember to change <br />
<pre>[SamDataDump]</pre>
with the share name you want and <br />
<pre>path = /media/terradisk</pre>
with the path to wherever you mounted your external disk.<br />
Add the smb password for the default <i>pi</i> user
<br />
<pre>pi@raspberrypi ~ $ sudo smbpasswd -a pi
</pre>
Set permissions so that <i>pi</i> user can access the share,
<br />
<pre>pi@raspberrypi ~ $ sudo chown -R pi:pi /media/terradisk/
</pre>
Restart samba<br />
<pre>pi@raspberrypi ~ $ sudo /etc/init.d/samba restart
</pre>
And done!<br />
Try accessing the share,<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh7kjYK-j5twaK02lhvIF1mJSupwRUbgAEFb9td7dWLWPwbe2uxWK0u1g_zzpv78Jjly8WAASry1vQK8JoVYgaV7mYsG-2RX3i4uI4NYE5lV4-I-YLOEc-jyKHe0iV2wlHlKMnoOQha0dP_/s1600/Screen+Shot+2012-06-23+at+2.49.14+AM.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="257" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh7kjYK-j5twaK02lhvIF1mJSupwRUbgAEFb9td7dWLWPwbe2uxWK0u1g_zzpv78Jjly8WAASry1vQK8JoVYgaV7mYsG-2RX3i4uI4NYE5lV4-I-YLOEc-jyKHe0iV2wlHlKMnoOQha0dP_/s400/Screen+Shot+2012-06-23+at+2.49.14+AM.png" width="400" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjk1fNHZ0xJdIROsI2fA4WWJFqGlhq872Ak9SnVQoGKqWfHm8snVxsitAcWDnM3bmlosjlhDk9fAJUsOIoDiNbt5NeakYU-pckvH5N9uOonZnlLleM5F418LW4Ez0rCLj2KlUY3WI8QadoF/s1600/Screen+Shot+2012-06-23+at+2.50.10+AM.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="301" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjk1fNHZ0xJdIROsI2fA4WWJFqGlhq872Ak9SnVQoGKqWfHm8snVxsitAcWDnM3bmlosjlhDk9fAJUsOIoDiNbt5NeakYU-pckvH5N9uOonZnlLleM5F418LW4Ez0rCLj2KlUY3WI8QadoF/s400/Screen+Shot+2012-06-23+at+2.50.10+AM.png" width="400" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjzbtU51hkMOwz6BLFqDNm01mAXX_nkYhIiM8i8moWH0Q02Bs5HQU0g1Wb9TwZuIGbP5hz4uStohFnkGTFhjRoEZ2K79uCTCoADJ0a1y5PjT14jcUGunEhyphenhyphenwxqvwS7lBaQaov7JY5nLSeTz/s1600/Screen+Shot+2012-06-23+at+2.50.25+AM.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="296" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjzbtU51hkMOwz6BLFqDNm01mAXX_nkYhIiM8i8moWH0Q02Bs5HQU0g1Wb9TwZuIGbP5hz4uStohFnkGTFhjRoEZ2K79uCTCoADJ0a1y5PjT14jcUGunEhyphenhyphenwxqvwS7lBaQaov7JY5nLSeTz/s400/Screen+Shot+2012-06-23+at+2.50.25+AM.png" width="400" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEix8-hU5QFw_ZaqbIs2dxOJoHUUHHWttzTgmusizYiIs_4lLrJ2Aqx1d7MLnGI3EKEAihy99fk5SxBSoyyx6njl1Trv0b36-S2HlJME3H1yplJMmmHtWD418QBbNMthmUOG-FujrNFxTu1U/s1600/Screen+Shot+2012-06-23+at+2.56.08+AM.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="440" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEix8-hU5QFw_ZaqbIs2dxOJoHUUHHWttzTgmusizYiIs_4lLrJ2Aqx1d7MLnGI3EKEAihy99fk5SxBSoyyx6njl1Trv0b36-S2HlJME3H1yplJMmmHtWD418QBbNMthmUOG-FujrNFxTu1U/s640/Screen+Shot+2012-06-23+at+2.56.08+AM.png" width="640" /></a></div>
And it works!</div>
Sambithttp://www.blogger.com/profile/10315454465933047223noreply@blogger.com23 Science Drive 2, Singapore 1175431.296675 103.7802391.2946905 103.7777715 1.2986595 103.78270649999999tag:blogger.com,1999:blog-4372471714060702862.post-52527816340131539122012-06-22T23:20:00.001+05:302012-06-22T23:27:25.488+05:30Running Debian on Raspberry Pi (and SD card woes)<div dir="ltr" style="text-align: left;" trbidi="on">
After waiting for nearly 3months, I finally got my <a href="http://en.wikipedia.org/wiki/Raspberry_Pi" target="_blank">Raspberry Pi</a> last week from Element14. Plan was to set it up as a file server for network enabling my external hard disks.<br />
<br />
<br />
<table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: left; margin-right: 1em; text-align: left;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhZ5h497jDsAjMkoKWG9emJXPdHpQu8aAqZ01qFnAMaT1G6gE81lgJ65t1kbKDMb7ZhNv58sYoizGgjiRSPyq58Wul2Kq6gjPGcTvRq3RGKtI1zhcfBU0aTlWTHBDqa-bGpyRX2SySGJWYp/s1600/21062012705.jpg" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-left: auto; margin-right: auto;"><img alt="Raspberry Pi debugging setup" border="0" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhZ5h497jDsAjMkoKWG9emJXPdHpQu8aAqZ01qFnAMaT1G6gE81lgJ65t1kbKDMb7ZhNv58sYoizGgjiRSPyq58Wul2Kq6gjPGcTvRq3RGKtI1zhcfBU0aTlWTHBDqa-bGpyRX2SySGJWYp/s320/21062012705.jpg" title="Raspberry Pi debugging setup" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Debugging setup</td></tr>
</tbody></table>
Attempts to use a SandDisk 8GB Class 10 Extreme SD card and Debian Squeeze image, following the instructions <a href="http://elinux.org/RPi_Easy_SD_Card_Setup" target="_blank">here</a>, were completely futile. Tales of my woes and subsequent hardware level debug attempts can be found in this <a href="http://www.raspberrypi.org/phpBB3/viewtopic.php?p=104955#p104955" target="_blank">thread</a>.<br />
Plugging in the card and attempting to boot the RasPi failed miserably initially.<br />
<table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: right; margin-left: 1em; text-align: right;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhPiUubZudHup9Zlf8Vig2N4oz3SAPdwQ_zx7a6RS-uicqlDmwFSvin8XXtnGoGbfUA_xjVwcteCHlQxasQpGEJMoIp4_VIqi_bTapr6Auzp7NJK9dnt2RdE-WwmsUJwHPy7u_eljRkqVsq/s1600/21062012700.jpg" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-left: auto; margin-right: auto;"><img border="0" height="150" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhPiUubZudHup9Zlf8Vig2N4oz3SAPdwQ_zx7a6RS-uicqlDmwFSvin8XXtnGoGbfUA_xjVwcteCHlQxasQpGEJMoIp4_VIqi_bTapr6Auzp7NJK9dnt2RdE-WwmsUJwHPy7u_eljRkqVsq/s200/21062012700.jpg" width="200" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Damn ugly pull up resistors on the<br />
SD IO lines</td></tr>
</tbody></table>
Implementing the pull-up resistor hack suggested by <a href="http://www.raspberrypi.org/phpBB3/viewtopic.php?p=102598#p102598" target="_blank">jhasler</a>,
resulted in a fugly looking but partially working RasPi. It was atleast
attempting to boot now, although it was throwing up a kernel panic
immediately after loading the kernel.<br />
<br />
<br />
<br />
<table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: right; margin-left: 1em; text-align: right;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEipxca-0UximAqT91ICSUWbpi3O3zTTqmAe9OMiKVElii6XBsTC1KeDXsWhzByFVCiht7cSPtvpt-CcUaHfoBjibfzZ2TACDVH6OhxlEuja7yhCOoGr_ry9Cd6jkFayqBG6p-xIgmwg0LCE/s1600/scope_2.png" style="clear: right; margin-bottom: 1em; margin-left: auto; margin-right: auto;"><img border="0" height="125" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEipxca-0UximAqT91ICSUWbpi3O3zTTqmAe9OMiKVElii6XBsTC1KeDXsWhzByFVCiht7cSPtvpt-CcUaHfoBjibfzZ2TACDVH6OhxlEuja7yhCOoGr_ry9Cd6jkFayqBG6p-xIgmwg0LCE/s200/scope_2.png" width="200" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">After loading kernel card drivers</td></tr>
</tbody></table>
<table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: right; margin-left: 1em; text-align: right;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhmX3hNNYADYFeBiUNsSvfww3a4UfSITPXvw59maMW-ymIYKwxBO2blSlmJOztTmAN_ubbgVQK_eizDy5t74zcaz1ZZkjr6r-ShJI-uSAFcMU2o_7tYlgboflw66so46hyfuJ6rvY8U7A5R/s1600/scope_0.png" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-left: auto; margin-right: auto;"><img border="0" height="125" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhmX3hNNYADYFeBiUNsSvfww3a4UfSITPXvw59maMW-ymIYKwxBO2blSlmJOztTmAN_ubbgVQK_eizDy5t74zcaz1ZZkjr6r-ShJI-uSAFcMU2o_7tYlgboflw66so46hyfuJ6rvY8U7A5R/s200/scope_0.png" width="200" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">SD DAT0 line, before kernel is loaded.</td></tr>
</tbody></table>
Probing the SD card IO lines with a high BW scope, revealed some glaring anomalies. The SD Clk speeds up and the pulses on the SD DAT lines become terribly distorted once the kernel mmc driver is loaded. Apparently the kernel driver is pushing things outside the hardware specs of the RasPi. Hopefully this will be addressed in the future firmware or patched kernel releases.<br />
<br />
Anyway, finally had great luck with a 4GB SanDisk Class 4 SD card and the <a href="http://downloads.raspberrypi.org/images/debian/7/2012-06-18-wheezy-beta.zip" target="_blank">2012-06-18-wheezy-beta</a> image. It immediately booted up and within a few seconds, I was greeted by the friendly raspi-config menu similar to the one below, which lets the user configure the GPU memory share, KB layout, locale and a few other useful stuff.<br />
<br />
<table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: left; margin-right: 1em; text-align: left;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj7pwLpdBHC8ihb18BbnufLRHOHxZXXse-edZtunOVermn678wOH3inJcB1gvowj3WNGfeP1Uw1SoxRr7oBZCKIOYZTCEruREPezQiueKPuNiQLI40O2Vztjt22viiIVX6f3SS3RtOW85YV/s1600/Screen+Shot+2012-06-23+at+1.07.56+AM.png" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-left: auto; margin-right: auto;"><img border="0" height="123" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj7pwLpdBHC8ihb18BbnufLRHOHxZXXse-edZtunOVermn678wOH3inJcB1gvowj3WNGfeP1Uw1SoxRr7oBZCKIOYZTCEruREPezQiueKPuNiQLI40O2Vztjt22viiIVX6f3SS3RtOW85YV/s200/Screen+Shot+2012-06-23+at+1.07.56+AM.png" width="200" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">raspi-config menu inside a ssh session.</td></tr>
</tbody></table>
A few simple choices and finally I get the much awaited Debian login prompt!<br />
<br />
For powering the RasPi I was initially using my Nokia 5800 (yes I am still using this pre-historic phone!) micro-usb cable connected to my desktop but later on replaced it with a Belkin powered usb hub.<br />
<br />
<br />
<br />
<table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: right; margin-left: 1em; text-align: right;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhbHAwt8H8CeCm_yxwhBULlvrsTqOCK2LQevA3uxx4ooenzT0iVK7zs0YWelU09593szi4Bg_Rgib1tkXMNEa72zr1uLDKki5pcKn12xVDlzZNElLjyfXMpdQ_jSxUSGzbOX4UKZFq-Hq0O/s1600/22062012710.jpg" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-left: auto; margin-right: auto;"><img border="0" height="150" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhbHAwt8H8CeCm_yxwhBULlvrsTqOCK2LQevA3uxx4ooenzT0iVK7zs0YWelU09593szi4Bg_Rgib1tkXMNEa72zr1uLDKki5pcKn12xVDlzZNElLjyfXMpdQ_jSxUSGzbOX4UKZFq-Hq0O/s200/22062012710.jpg" width="200" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">RasPi powered by Belkin USB Hub.</td></tr>
</tbody></table>
One of the downstream ports of the hub powers the RasPi. while the upstream port of the hub is plugged back to the USB port of the Pi. The arrangement looks a bit funny though ( no, this is not a perpetual machine, the external power connector to the hub is yet to be connected :P )<br />
<br />
The external HDD, one additional USB to ethernet connector (I am connected to 2 different subnets) and keyboard (temporarily) were all plugged into the HUB. My Mac Mini's HDMI to DVI connector, was of great help during the initial setting up. Once that was done, SSH is now working just fine for me, no longer need the KB or display.<br />
I'll keep jabbering about my further experiences with this tiny beast, in the next few posts!!<br />
<br />
<a name='more'></a><br />
<br />
<br />
<br />
<div style="text-align: left;">
</div>
</div>Sambithttp://www.blogger.com/profile/10315454465933047223noreply@blogger.com0National University Of Singapore, Singapore 1190771.2941205 103.7810591.278246 103.761318 1.309995 103.8008tag:blogger.com,1999:blog-4372471714060702862.post-73348257320716559742012-04-06T16:53:00.002+05:302012-04-06T16:53:22.963+05:30What quantum physicists and movie/music industry have in common<div dir="ltr" style="text-align: left;" trbidi="on">
Recent attempts to purchase 780 nm laser diodes for my experiment, made me realize how much atomic physics and laser cooling labs have become entangled with the optical disk industry. Rapid developments in optical drive industry, which made Rubidium so easily accessible to every Tom, Dick and Harry working on atomic physics few years back is now making our lives difficult by rendering, once easily available technology, obsolete faster than ever. 150 mW 780 nm laser diodes which formed the heart of 48X CD burners, could be picked up for a few bucks from Digikey or Farnell, a few years back. Diodes with similar specs are now only available from specialized industrial and research laser vendors for a price that is atleast 2 orders of magnitude higher than the price when CD burners were ubiquitous.<div>
Ofcourse the silver lining is, with the shift towards Blu-ray, wavelengths around 400nm, which once could only be achieved with the not-so-cheap non-linear frequency doubling crystals, have now become much more easily accessible.</div>
<div>
<br /></div>
<div>
(Anyway, have been successful in getting a handful of obsolete 150mW 780nm diodes from some random Chinese seller on eBay at dirt cheap prices! Yet to check their mode stability though, but quite hopeful from the specs! All hail the great Chinese manufacturers. Someone said it right-- God made the Chinese, rest was "Made in China"!)</div>
</div>Sambithttp://www.blogger.com/profile/10315454465933047223noreply@blogger.com03 Science Drive 2, National University of Singapore, Singapore 1175431.296675 103.7802391.2946905 103.7777715 1.2986595 103.78270649999999tag:blogger.com,1999:blog-4372471714060702862.post-3480897538167191162012-01-01T17:14:00.000+05:302012-01-01T23:23:27.843+05:30BSNL Self Care Portal on Chrome/Firefox in Linux<div dir="ltr" style="text-align: left;" trbidi="on">
BSNL has recently (not sure how recent, since I returned to India after quite a few months) made some changes to their accounting system and the old intranet site (10.240.43.216) for checking unbilled usage no longer seems to be working. It has been replaced with an ultra crappy, barely functional, CRM portal from <a href="http://en.wikipedia.org/wiki/Siebel_Systems">Siebel</a> and it manages to suck better than the most powerful vacuum cleaner ever made. To make matters worse, it is labelled as "<i>Internet Exploder</i> only", so any other standards compliant browser, which doesn't cause the internet to explode doesn't seem to work. Having nothing better to do, I delved a bit deeper to find out why non-IE browsers fail to render this piece of shit. A little bit of Googling made me stumble upon this - <a href="http://www.linuxquestions.org/questions/linux-general-1/bsnl-website-cannot-be-used-with-linux-847256/">link</a>. Apparently the login window seems to be some kind of popup with some applet inside. Whichever brain-dead retard designed it, something seems to be horrendously wrong with the way the login window captures the mouse focus. Clicking on the username and password field doesn't work! Some users have reported success (see the posts on the above mentioned link) after resizing the window to a very small size and then clicking on the username field. This works most of the time, but the rest of the site after logging in, remains still unusable with a mouse. Fortunately "TABbing" seems to work and makes it possible to navigate around the site.
<br />
(BTW this - <a href="http://selfcare.edc.bsnl.co.in/" target="_blank">http://selfcare.edc.bsnl.co.in</a> is the portal I am referring to.)</div>Sambithttp://www.blogger.com/profile/10315454465933047223noreply@blogger.com4Kharagpur, West Bengal, India22.3304 87.31810822.2716485 87.239144 22.3891515 87.397072tag:blogger.com,1999:blog-4372471714060702862.post-6268774651146190022011-12-16T20:41:00.004+05:302011-12-25T15:16:23.577+05:30Experiences with new Mac MiniEarlier this month I bought a Core i5 Mac Mini. It was quite an impulsive decision, partly influenced by the fact that it was a bit annoying frequently rebooting my office Dell desktop to switch back and forth between Windows and Linux. I have been using Linux for everything (like browsing, programming, creating Tex documents as well as for music and movies) since the last 4+ years. However, when I joined as a Grad student in <a href="http://www.quantumlah.org/">CQT</a>, earlier this year, my requirements changed a bit, which made be quite a bit dependent on Windows. I got involved in some device driver development in Windows, creating/maintaining several VIs in Labview and working in AutoDesk occasionally to coordinate with workshop technicians. Moreover the lab-notebooks were traditionally being maintained in MS OneNote. Since I am heavily reluctant to completely move away from *nix for my computing needs, I tried dual-booting my Core i7 desktop with Windows 7 and Ubuntu 11.10. Primarily I was using Ubuntu, but had to frequently reboot into Windows for either Labview/Autodesk/Onenote.
At this point wanted to give OS X a try and ordered the base version of the new Core i5 Mac Mini online. It came with a 500GB HDD and 2GB DDR3 RAM. It was pointless giving $$$ to Apple for memory upgrade, when 4GB Kingston DDR3 modules are available in the market at a fraction of Apple's price. Even before my Mac Mini arrived, I headed off to <a href="http://en.wikipedia.org/wiki/Sim_Lim_Square">Sim Lim Square</a> to get a pair of 4GB, 1333MHz DDR3 Kingston modules for 78 SGD.<br />
When the Mini arrived in my office, before switching it on, I took off the back cover and replaced the 2GB modules with the 8GB ones. I had a Dell 23" display and Microsoft wireless keyboard/mouse, so without wasting anymore time, hooked them and booted the Mini. First time startup configuration was highly "Idiot Friendly". All I had to do, was enter my Apple ID, everything else was done automagically.<br />
Ofcourse, having used a Hackintosh for sometime, the OS X experience was nothing new. But I was pissed off a bit by the fact that the new computer didn't come with any inbuilt system recovery option. Even though I didn't have any urgent need to do a system recovery, I tried the much famed "Lion Internet Recovery", where the Mac downloads a recovery image of Lion directly off Apple's server. But I was heavily disappointed to find that it doesn't work reliably. A little bit of Googling revealed that, I am not the only one, it fails to work reliably for most Earthlings.<br />
Anyway, I used <a href="http://www.shirt-pocket.com/SuperDuper/SuperDuperDescription.html">SuperDuper</a> to create a full disk image and stored it away in a external USB drive safely, in case I manage to bork the system in the future.Sambithttp://www.blogger.com/profile/10315454465933047223noreply@blogger.com0Centre for Quantum Technologies, Singapore 1175431.352083 103.8198361.098096 103.503979 1.6060699999999999 104.13569299999999tag:blogger.com,1999:blog-4372471714060702862.post-80139922458200691482011-11-10T23:05:00.001+05:302011-11-10T23:30:22.811+05:30Back after an year<div dir="ltr" style="text-align: left;" trbidi="on">
My last post was an year ago! Lot of things have happened in between. I had completed my Masters, majoring in Physics from <a href="http://www.iiserkol.ac.in">IISERK</a>, last May and have moved to Singapore to join the Centre for Quantum Technologies (<a href="http://www.quantumlah.org">CQT</a>) at <a href="http://www.nus.edu.sg/">NUS</a> for a PhD. My current work is on <a href="http://qmatter.quantumlah.org/">ultracold molecules</a>, where we are aiming to probe quantum many-body physics in an ultracold Fermi-Fermi mixture of <sup>40</sup>K and <sup>6</sup>Li.
</div>Sambithttp://www.blogger.com/profile/10315454465933047223noreply@blogger.com1Singapore1.352083 103.8198361.098096 103.503979 1.6060699999999999 104.13569299999999tag:blogger.com,1999:blog-4372471714060702862.post-90798586982195397482010-11-12T01:44:00.000+05:302010-11-12T01:44:53.732+05:30Inquivesta"<a href="http://inquivesta.iiserk.net/">Inquivesta</a> is envisaged to be the first science fest of its kind in India.<br />
Hosted by <a href="http://www.iiserk.net/">IISER Kolkata</a>, <a href="http://inquivesta.iiserk.net/">Inquivesta 2011</a> is two days packed to the brim with excitement, innovations, challenges, and horns locked in historic show-downs.<br />
<br />
Students from all Indian colleges are welcome. So come, join us. Let our forces unite, and we shall make history!"<br />
.... For more details visit <a href="http://inquivesta.iiserk.net/">Inquivesta</a>Sambithttp://www.blogger.com/profile/10315454465933047223noreply@blogger.com0tag:blogger.com,1999:blog-4372471714060702862.post-66140562323759614512009-12-21T00:29:00.002+05:302009-12-21T12:26:07.610+05:30Website updatedWhile updating some contents in my site - <a href="http://sam.botcyb.org/">http://sam.botcyb.org</a>, I thought of changing the looks as well. After spending almost a day fiddling with the stylesheet I couldn't come up with a design that pleased me. Frustrated, I came up with the best solution - dump all stylesheet and images. Pure text in pure html, nothing else!<br />
<br />
(UPDATE: Finally added a css once again! - 21/12/09 )Sambithttp://www.blogger.com/profile/10315454465933047223noreply@blogger.com0tag:blogger.com,1999:blog-4372471714060702862.post-45995846868960099382009-12-16T01:59:00.000+05:302009-12-16T01:59:12.698+05:30Wikileaks blocked by BSNL - India follows China in censorshipAt last it seems like India is following China's footsteps in restricting her citizens' access to the Internet. <a href="http://wikileaks.org/">Wikileaks.org</a> - a well known site that "publishes anonymous submissions and leaks of sensitive governmental, corporate, organizational, or religious documents, while attempting to preserve the anonymity and untraceability of its contributors" (description from <a href="http://en.wikipedia.org/wiki/Wikileaks">wikipedia entry</a> ) has been apparently blocked by the Sarkari ISP- <a href="http://bsnl.co.in/">BSNL</a>. Tonight, while trying to lookup a "confidential" (alas! no longer confidential) working paper (<a href="http://wikileaks.org/wiki/Confidential_plans_for_1.2_billion_ID_cards:_Creating_a_Unique_ID_for_every_resident_in_India%2C_Nov_2009">wikileaks link</a>) about India's proposed "Multipurpose National Identity Card" (<a href="http://en.wikipedia.org/wiki/Multipurpose_National_Identity_Card">link</a>), I was unable to reach <a href="http://wikileaks.org/">Wikileaks.org</a> from my BSNL Broadband connection directly, although the site could be opened through most public proxy servers. Just to verify that it is indeed the Sarkari BSNL who is trying to act smart, I connected through Airtel Mobile Office EDGE connection and I could easily view the page. What a shame for a "Democratic Republic". It seems India is really trying to join the "elite" league of countries like China and Iran. (Others kindly check if your ISP allows access to <a href="http://wikileaks.org/">Wikileaks.org</a> , if not try this mirror at a different IP address - <span style="font-family: arial,sans-serif;"><a href="http://www.wikileaks.se/">wikileaks.se</a></span> .)Sambithttp://www.blogger.com/profile/10315454465933047223noreply@blogger.com1tag:blogger.com,1999:blog-4372471714060702862.post-17437407195797438242009-10-09T01:56:00.003+05:302009-10-09T12:45:23.917+05:30My new Nokia 5800 XpressmusicRecently I bought a <a href="http://www.forum.nokia.com/devices/5800_XpressMusic">Nokia 5800 Xpressmusic Smartphone</a> to replace my aging Nokia 6600. 5800 is Nokia's first device based on the S60 5th Edition platform, running Symbian OS v9.4 on a 434MHz ARM11 CPU. Notable features include large(3.2inch 640x360) resistive touchscreen with tactile feedback, HSDPA(3.5G), 802.11b/g WLAN support, GPS (with optional AGPS), accelerometer, stereo FM radio with RDS, 3.2Mpixel camera with Carl Zeiss Optics, blah blah... the list is quite long. For a complete list of specifications see the link to the device specs page, there is no point in copy-pasting the list here.<br />
<br />
After unpacking I plugged in an Airtel 2G SIM and the 8GB MicroSD that came with the device. Unfortunately the state owned BSNL is the only mobile service provider in India providing 3G connectivity. Though BSNL has excellent 2G coverage all over the country, their 3G coverage is limited only to few cities. Other operators are yet to receive licenses to roll out 3G networks. So for the time being, I'll have to remain contended with 2G services, which means no high speed data and no video call.<br />
<br />
The sound quality of the device didn't really disappoint me, however being an Xpressmusic phone, I had expected better quality headphones. The HS-45 headphone that comes with it, is of average quality. I plugged in my friend's Sennheiser headset and the audio quality simply blew me away. So there is nothing inherently wrong with the device's audio output, it is just that the supplied headphones are of mediocre quality.<br />
<br />
The inbuilt browser is nice. Adobe Flash is properly supported (in fact excellent flash support, one can watch YouTube videos smoothly over a WLAN connection).<br />
<br />
GPS reception is good, I could get my location even indoors. However the initial lock-in time is variable. Sometimes is takes upto 5mins to lock-in to the satellite signals, whereas at other times it takes less than a minute. However with AGPS enabled, startup becomes lightning quick. AGPS allows the device to download the ephemeral data about the GPS satellites from Nokia's AGPS server through the internet, rather than decoding the same from the GPS signals. AGPS works only if a cellular packet data connection is available (for some strange reason it can't use WLAN).<br />
The Nokia Maps application is utter crap, atleast for me. It doesn't provide any detail about any location in eastern India. On the other hand Google Maps just rocks. In the satellite view, I could even figure out the room of the building, where I was. Google Maps also provides turn by turn navigation instruction for traveling from point A to point B on the map. With inbuilt Google Latitude, selected friends can see my instant location on the planet at anytime and I can see them on the map as well.<br />
<br />
The inbuilt mail client is simple with minimal features but works quite well. I configured it for periodically monitoring my Gmail Inbox and a few other IMAP Folders and alert me whenever a new mail arrives.<br />
<br />
The music player app is good enough for playing wma, mp3, aac, aac+, awb and perhaps someother formats as well. However syncing the music folder with my GNU/Linux computer was a bit troublesome. I'll write about this in a subsequent post. Initially I had to use Nokia Music(part of Ovi Suite) on Windows XP to transfer tracks.<br />
The device comes with a subscription to Nokia music store, which allows downloading of first 100 tracks from the site free of cost. Unfortunately all the songs in Nokia's music store incorporates Microsoft's DRM, making them unplayable in my GNU/Linux laptop. Really annoying! I can't freely play songs that I have legally downloaded.<br />
<br />
Anyway as a concluding remark, I must add that the phone is quite hackable(though nothing compared to a Freerunner!), in the sense that Nokia freely provides the SDK/S60 emulator as well as the Symbian C++, Open C++ and Java API for accessing the device features. Nokia has also ported Python to the S60 platform and I could easily get a Python shell running on the device. I could access the shell through a serial console emulated over a bluetooth link. The well documented APIs, helped me to very easily write simple Python scripts to play around with the sensors(accelerometer, rotation, ambient light, proximity and gps positioning) scattered throughout the device. I haven't written any full fledged application, but the potentials are limitless.Sambithttp://www.blogger.com/profile/10315454465933047223noreply@blogger.com1tag:blogger.com,1999:blog-4372471714060702862.post-78420697335802082342009-04-11T22:36:00.010+05:302009-04-11T23:09:20.672+05:30Making inactve USB Hard Disk spin down automatically in Linux.<p>I have a 400GB Seagate IDE HDD connected to Mars, our hostel's file-server using an USB enclosure. The USB enclosure is a cheap "Made in China" product. Consequently it has some special "features". One such notable "feature" is that the disk is kept spinning by the controller even if there has been no disk I/O for a long time. I have three other USB disks connected to the same machine, a 1TB Seagate FreeAgent Desk External Drive, a 500GB Maxtor Basics External Drive and a 2.5" 60GB Fujitsu SATA Disk inside a Transcend USB enclosure. All of these spin down themselves if there has been no I/O for sometime. Keeping the hard disk spinning unnecessarily for ever, not only wastes power but also overheats the drive, thereby reducing its life.<br />
</p><p>I tried noflushd, which is supposed to force idle hard disks to spin down, but found it to be of no help. USB enclosure generally work by performing an SCSI emulation over USB. sdparm is an utility which can be used to send simple SCSI commands. A peep into its manpage revealed that the disk could be ordered to spin down by <code>sudo sdparm -C stop /dev/sdb1</code> where <code>sdb1</code> is the required disk <i>(the disk has a single partition, "sdparm -C stop /dev/sdb1" and "sdparm -C stop /dev/sdb" did the same thing here, however if there are multiple partitions, it is more meaningful to specify "/dev/sdb" rather than "/dev/sdb1", since it is the disk that stops spinning).</i><br />
</p><p>However I need to do this automatically whenever the disk is idle. First, it is necessary to check whether the disk is active or idle. Info about disk I/O is available from /proc/diskstats.<br />
<code>cat /proc/diskstats | grep sdb1</code><br />
shows info about sdb1, the output is something line this:<br />
<code>8 17 sdb1 210583 56943 24739612 2328860 11777 24804 292648 69260 0 1209770 2397450</code><br />
<p>It has several fields after "sdb1", denoting the following:<br />
Field 1 -- No. of reads issued<br />
Field 2 -- No. of reads merged<br />
Field 3 -- No. of sectors read<br />
Field 4 -- No. of milliseconds spent reading<br />
Field 5 -- No. of writes completed<br />
Field 6 -- No. of writes merged<br />
Field 7 -- No. of sectors written<br />
Field 8 -- No. of milliseconds spent writing<br />
Field 9 -- No. of I/Os currently in progress<br />
Field 10 -- No. of milliseconds spent doing I/Os<br />
Field 11 -- weighted No. of milliseconds spent doing I/Os <br />
</p><br />
Field 9 is of importance here, a nonzero value indicates disk activity. Any particular field can be dug out easily using grep and AWK (mawk interpreter is the obvious choice here).<br />
<code>cat /proc/diskstats | grep $DISKNAME | mawk '{ print $(NF-2) }'</code> does the trick.<br />
<code>mawk '{ print i }'</code> prints the ith field.<br />
The variable NF is equal to the number of fields. We are interested in the field 3rd from the end. Hence $(NF-2).<br />
Now this is probabilistic, if there is no I/O in that particular instant<br />
<code>cat /proc/diskstats | grep $DISKNAME | mawk '{ print $(NF-2) }'</code><br />
will yield <code>0</code>. To ensure that the disk is really inactive, the check has to be carried out quite a few times.<br />
</p><p>There is another pitfall, there are 4 USB disks connected to the machine. Which one would be named sdb is not fixed. At every reboot this may change. On the other hand uuid of a disk never changes (unless the partition table is modified). So the name of the disk has to determined from its uuid. grep, AWK, and sed comes to our rescue once again.<br />
<code>DISKNAME=`ls -l /dev/disk/by-uuid/ | grep "c5df6a02-b7a6-4f39-ad26-7eb915b76709" | mawk '{ print $(NF) }' | sed s_\.\.\/\.\.\/__`</code><br />
What this essentially does is explained below.<br />
<code>"ls -l /dev/disk/by-uuid/"</code> gives the following output<br />
<code><br />
sambit@mars:~$ ls -l /dev/disk/by-uuid/<br />
total 0<br />
lrwxrwxrwx 1 root root 10 2009-04-07 14:20 0db6e806-8d4b-4968-8ccc-c00af59bb065 -> ../../sdc1<br />
lrwxrwxrwx 1 root root 10 2009-04-07 14:20 4294e561-df28-4ddd-a689-0aba31d4d663 -> ../../sda2<br />
lrwxrwxrwx 1 root root 10 2009-04-07 14:20 4cb989c6-87b7-4179-bb4d-81b2b0193ab2 -> ../../sdd1<br />
lrwxrwxrwx 1 root root 10 2009-04-07 14:20 4cf2093e-f08c-4127-ae75-fff11edd81ae -> ../../sdd2<br />
lrwxrwxrwx 1 root root 10 2009-04-07 14:20 87ba9975-056d-4635-85e4-53f1c76d57fb -> ../../sda3<br />
lrwxrwxrwx 1 root root 10 2009-04-07 14:20 a74b47fb-a33c-4a5a-ad62-0bc831f6ffda -> ../../sdd3<br />
lrwxrwxrwx 1 root root 10 2009-04-07 14:20 af0c007b-a15c-4661-84eb-7dc689dec861 -> ../../sda1<br />
lrwxrwxrwx 1 root root 10 2009-04-10 22:09 c5df6a02-b7a6-4f39-ad26-7eb915b76709 -> ../../sdb1<br />
</code><br />
<code><br />
ls -l /dev/disk/by-uuid/ | grep "c5df6a02-b7a6-4f39-ad26-7eb915b76709"</code> narrows it to:<br />
<code>lrwxrwxrwx 1 root root 10 2009-04-10 22:09 c5df6a02-b7a6-4f39-ad26-7eb915b76709 -> ../../sdb1<br />
</code><br />
<code><br />
ls -l /dev/disk/by-uuid/ | grep "c5df6a02-b7a6-4f39-ad26-7eb915b76709" | mawk '{ print $(NF) }'</code> prints the last field:<br />
<code>../../sdb1<br />
</code><br />
Finally sed puts some finishing touches, by replacing <code>"../../"</code> in <code>"../../sdb1"</code> with <code>""</code>.<br />
<code><br />
ls -l /dev/disk/by-uuid/ | grep "c5df6a02-b7a6-4f39-ad26-7eb915b76709" | mawk '{ print $(NF) }' | sed s_\.\.\/\.\.\/__ <br />
<br />
sdb1<br />
</code><br />
So putting everything together, the script at-last looks something like this:<br />
<code><br />
#################################################################################################################################<br />
#!/bin/bash<br />
DISKNAME=`ls -l /dev/disk/by-uuid/ | grep "c5df6a02-b7a6-4f39-ad26-7eb915b76709" | mawk '{ print $(NF) }' | sed s_\.\.\/\.\.\/__`<br />
let a=0<br />
#check 100 times with 0.1s gaps,<br />
#and go on adding<br />
for i in `seq 0 100`<br />
do<br />
let a=`cat /proc/diskstats | grep $DISKNAME | mawk '{ print $(NF-2) }'`+a<br />
sleep 0.1s<br />
done<br />
echo $a<br />
if [ $a == 0 ]<br />
then<br />
echo "No Activity"<br />
sdparm -C stop /dev/$DISKNAME<br />
else<br />
echo "Disk Active"<br />
fi<br />
exit 0<br />
#################################################################################################################################<br />
</code><br />
<p>I added this to crontab and made it run hourly. The hard disk can rest in peace for sometime in between heavy work now.<br />
</p>Sambithttp://www.blogger.com/profile/10315454465933047223noreply@blogger.com6tag:blogger.com,1999:blog-4372471714060702862.post-50057128039948285172009-02-07T23:35:00.058+05:302009-02-08T00:34:22.786+05:30IISERK Haringhata CampusMaking a post after quite a long time. In the meantime a lot of things have changed here. This is my first post after moving to the Haringhata Campus. From the hustle and bustle of Kolkata we were suddenly "teleported" to the calm and serene atmosphere of Haringhata, quite a bit jump it was.<br />The location didn't quite disappoint me, though many "mall hoppers" and a few "privileged ones" (their homes are in Kolkata) who earlier could slip into the comfort of their homes every weekend easily were unhappy, it has become a bit more difficult for them to do so now. However one thing that I really miss is the 2Mbits connection. There is no broadband connection yet in the hostel, and currently we are trying hard to manage using a 17KBytes Wireless Dialup connection over CDMA. There is little chance of getting any high speed connection in this remote location. The administrative building does have a decent leased line, but it is at a few minutes of walking distance from the hostel making it difficult to land up there late at night.<br />Apart from this annoyance, life is quite peaceful here. Being located far from the city, the night sky remains glare-free, which provoked a few of my friends to plan to buy a telescope for star-gazing. I am too looking forward for this.Sambithttp://www.blogger.com/profile/10315454465933047223noreply@blogger.com1tag:blogger.com,1999:blog-4372471714060702862.post-88650076484282209042009-01-08T00:35:00.004+05:302009-03-17T12:15:14.393+05:30Adventures with IPv6I spent the past couple of days, tinkering with an old Linux box, trying to set up a fully functional IPv6 network, complete with an IPv6 webserver, nameserver, mailserver, network router and firewall.<br />The job is partly done.<br />The nameserver, webserver, network router and firewall are working quite well.<br />The website can be accessed here <a href="http://oak.ipv6.iiserk.net">http://oak.ipv6.iiserk.net</a>(Provided you have IPv6 connectivity). It runs on a rickety PIII running Ubuntu 8.04.1 and connected to my friend's home ADSL connection. Power failure are quite a common affair in our region (in almost the whole country, to be honest!) and there is no power backup for the server, so if it appears to be down, kindly check back sometime later.<br />The nameserver <b>ns1.ipv6.iiserk.net</b> manages the DNS records for the subdomain <b>ipv6.iiserk.net</b>.<br />I hope to get the mailserver up and running quite soon.<br />I'll also come up with a detailed documentation on how I got the things running, sometime in the near future.<br />Anyway for this half-crappy IPv6 implementation, I got this from <a href="http://ipv6.he.net/">Hurrican Electric</a> Internet Services:<br /><!--<script type="text/javascript" language="javascript" src="http://ipv6.he.net/certification/badge.js"></script><br /><script type="text/javascript">/*<![CDATA[*/var user = "sambit";display_swf(user);//]]></script>--><br /><i>(It is a certificate, but removed the JScript, as it was causing the page to load slowly)</i><br />It started with "newbie" level, and is improving!<br />More on IPv6 soon... may be in a day or two.Sambithttp://www.blogger.com/profile/10315454465933047223noreply@blogger.com0tag:blogger.com,1999:blog-4372471714060702862.post-38313933128711243642008-12-21T16:17:00.003+05:302008-12-22T11:22:03.759+05:30Linux Hard Disk Issue - Excessive Load_Cycle_Count<p><i>Prologue:</i> My 2 year old laptop's harddisk had died a few weeks ago, and I replaced it with a Seagate Momentus 5400.3 160GB SATA Drive. I have been running only Linux for a long time on my laptop. (Running Ubuntu Intrepid at present)</p><p>While trying to ascertain the cause of this premature death, I came to notice the abnormally high Load_Cycle_Count. This can be checked using <b>smartmontools</b> by issuing the command <pre>sudo smartctl -n standby -a /dev/sda</pre>where /dev/sda has to be replaced with the appropriate disk name. The option -n ensures that if the disk is already in standby, smartctl doesn't wake it up. A little bit of Googling returned quite a lot of stuffs about this issue. Laptop Harddisks, in order to improve power efficiency while on battery, have quite aggressive power management features by default. Now this is not really bad. When the disk is not accessed for sometime it spins down itself. So far so good, the disk stops spinning unnecessarily thereby cutting down power consumption. However no sooner than the disk stops spinning, something causes it to spin up again. This not only defeats the whole purpose of spindown, but also causes unnecessary wear and tear of the disk components. Most modern HDDs have a mechanism which parks the head (loads it up a ramp) when the disk spins down. The head is unloaded back over the platter, once the disk spins up again. However each load and unload cycle causes wear of the loading and unloading mechanism. Seagate HDDs (most others as well) have specifications of maximum of 60,000 load unload cycles. This is quite high. But what I found in my case was, the Load_Cycle_Count was increasing at the rate of about 5-6 per min. That meant the head was parking and unparking every 10sec on avarage. This was quite alarming.<br />
To stop such insane behavior, I set the Advanced Power Management to 254 using hdparm. A value of 254 meant least aggressive power management. By default Ubuntu sets it at 128. This did stop the Load_Cycle_Count from increasing increasing insanely. But the disk now stopped spinning down, and its temperature was shooting up. Within a hour it went up above 60degC (room temp was around 20degC). Now that is even more alarming than the increasing load cycle count. The rated maximum operating temperature for my drive is 60degC. Operating at high temperature severely shortens the life of the disk. At a power management value of 180, the temperature settled at around 55degC. This was better, but not quite good, the disk was 35degC above ambient temperature. During peak summer, the ambient temperature at Kolkata hovers around 40degC. So my disk will get fried up in the summer if I use my laptop in a room without airconditioning.<br />
So preventing the disk from spinning down is not a solution. It has to be ensured that once the disk spins down, it stays like that as long as possible, without spinning up.<br />
I needed to find out who was accessing the disk so frequently. <a href="http://guichaz.free.fr/iotop/">iotop</a> is a nice utility for this. wpa-supplicant was at the top of the list. I am using a wireless connection, and wpa-supplicant frequently logs something. Next was gconf-d, followed by gnome-do and console-kit-daemon. As soon as the disk spins down, one of this will try to do a read/write causing the disk to spin up again. On top of that, every time the disk is accessed, kjournald will write the filesystem journals, update the atime, ctime and mtime of file inodes. All these together keep the disk always busy and wakes it up as soon as it tries to catch a nap.</p><p>However there is a utility called laptop-mode-tools which performs some tweaks and tries to keep the hard disk in standby mode as long as possible.<br />
To enable it, first install laptop-mode-tools.<br />
<pre>sudo apt-get install laptop-mode-tools</pre>Then it has to be enabled in /etc/default/acpi-support by changing the line<br />
<pre>ENABLE_LAPTOP_MODE=false</pre>to<br />
<pre>ENABLE_LAPTOP_MODE=true</pre>I changed the configuration file a bit, so as to optimize things as far as possible.<br />
The configuration is there at /etc/laptop-mode/laptop-mode.conf<br />
<pre>###### Config file for laptop-mode-tools
## Verbose output on
VERBOSE_OUTPUT=1
## Laptop mode enabled always
ENABLE_LAPTOP_MODE_ON_BATTERY=1
ENABLE_LAPTOP_MODE_ON_AC=1
ENABLE_LAPTOP_MODE_WHEN_LID_CLOSED=1
# When to enable data loss sensitive features
# -------------------------------------------
#
# When data loss sensitive features are disabled, laptop mode tools acts as if
# laptop mode were disabled, for those features only.
#
# Data loss sensitive features include:
# - laptop_mode (i.e., delayed writes)
# - hard drive write cache
#
# All of the options that follow can be set to 0 in order to prevent laptop
# mode tools from using them to stop data loss sensitive features. Use this
# when you have a battery that reports the wrong information, that confuses
# laptop mode tools.
#
# Disabling data loss sensitive features is ACPI-ONLY.
# Disable all data loss sensitive features when the battery level (in % of the
# battery capacity) reaches this value.
#
MINIMUM_BATTERY_CHARGE_PERCENT=3
# Disable data loss sensitive features when the battery reports its state
# as "critical".
#
DISABLE_LAPTOP_MODE_ON_CRITICAL_BATTERY_LEVEL=1
# The drives that laptop mode controls.
# Separate them by a space, e.g. HD="/dev/hda /dev/hdb". The default is a
# wildcard, which will get you all your IDE and SCSI/SATA drives.
#
HD="/dev/[hs]d[abcdefgh]"
# The partitions (or mount points) that laptop mode controls.
# Separate the values by spaces. Use "auto" to indicate all partitions on drives
# listed in HD. You can add things to "auto", e.g. "auto /dev/hdc3". You can
# also specify mount points, e.g. "/mnt/data".
#
PARTITIONS="auto /dev/mapper/*"
ASSUME_SCSI_IS_SATA=1
# Maximum time, in seconds, of work that you are prepared to lose when your
# system crashes or power runs out. This is the maximum time that Laptop Mode
# will keep unsaved data waiting in memory before spinning up your hard drive.
#
LM_BATT_MAX_LOST_WORK_SECONDS=900
LM_AC_MAX_LOST_WORK_SECONDS=600
#
# Should laptop mode tools control readahead?
#
CONTROL_READAHEAD=1
# 10MB readahead in laptop mode
LM_READAHEAD=10240
NOLM_READAHEAD=128
# Disks will be mounted with noatime in laptop mode, atime updates to file inodes will be
# stopped.
CONTROL_NOATIME=1
# Don't use relatime instead of noatime
USE_RELATIME=0
# set hdd timeout
CONTROL_HD_IDLE_TIMEOUT=1
LM_AC_HD_IDLE_TIMEOUT_SECONDS=60
LM_BATT_HD_IDLE_TIMEOUT_SECONDS=30
NOLM_HD_IDLE_TIMEOUT_SECONDS=7200
# set HDD power management
CONTROL_HD_POWERMGMT=1
BATT_HD_POWERMGMT=1
LM_AC_HD_POWERMGMT=127
NOLM_AC_HD_POWERMGMT=254
# enable write cache
CONTROL_HD_WRITECACHE=1
NOLM_AC_HD_WRITECACHE=1
NOLM_BATT_HD_WRITECACHE=0
LM_HD_WRITECACHE=1
CONTROL_MOUNT_OPTIONS=1
#
# Dirty synchronous ratio. At this percentage of dirty pages the process
# which calls write() does its own writeback.
# At 80percent of dirty pages disk write is performed. This holds up things in memory and
# prevents frequent disk writes
LM_DIRTY_RATIO=80
NOLM_DIRTY_RATIO=40
#
# Allowed dirty background ratio, in percent. Once DIRTY_RATIO has been
# exceeded, the kernel will wake pdflush which will then reduce the amount
# of dirty memory to dirty_background_ratio.
# Once writeout has commenced write as much as possible to disk, without keeping back anything.
# So this has been set to 1 percent
LM_DIRTY_BACKGROUND_RATIO=1
NOLM_DIRTY_BACKGROUND_RATIO=10
#
# kernel default settings -- don't touch these unless you know what you're
# doing.
#
DEF_UPDATE=5
DEF_XFS_AGE_BUFFER=15
DEF_XFS_SYNC_INTERVAL=30
DEF_XFS_BUFD_INTERVAL=1
DEF_MAX_AGE=30
#
# This must be adjusted manually to the value of HZ in the running kernel
# on 2.4, until the XFS people change their 2.4 external interfaces to work in
# centisecs. This can be automated, but it's a work in progress that still
# needs some fixes. On 2.6 kernels, XFS uses USER_HZ instead of HZ for
# external interfaces, and that is currently always set to 100. So you don't
# need to change this on 2.6.
#
XFS_HZ=100
#
# Seconds laptop mode has to to wait after the disk goes idle before doing
# a sync.
#
LM_SECONDS_BEFORE_SYNC=2
</pre></p><p>After enabling laptop-mode, the hdd is being able to sleep peacefully for quite sometime in between spinups. Also the operating temperature is rarely exceeding 50degC now. The load cycle count is still increasing but at a much slower rate. Hopefully this HDD is going to last longer than the previous one.</p>Sambithttp://www.blogger.com/profile/10315454465933047223noreply@blogger.com6tag:blogger.com,1999:blog-4372471714060702862.post-27740379065452052432008-12-06T00:29:00.003+05:302008-12-21T19:07:27.858+05:30Evolution Of A Linux UserA message taken from <a href="http://kulua.org">Kulua</a> mailing list.<br />
<pre>From - Tue Dec 14 13:22:38 1999
Received: from kuhub.cc.ku.edu by lark.cc.ku.edu (8.8.7/1.1.8.2/12Jan95-0207PM)
id PAA0000031643; Mon, 13 Dec 1999 15:07:29 -0600 (CST)
Received: from DIRECTORY-DAEMON by KUHUB.CC.KU.EDU (PMDF V5.2-32 #39821)
id <01JJGH1JNK6800TMXQ@KUHUB.CC.KU.EDU>; Mon,
13 Dec 1999 15:07:27 CST (UTC -06:00)
Received: from violet.jayhawks.net
("port 1826"@violet.jayhawks.net [24.124.24.226])
by KUHUB.CC.KU.EDU (PMDF V5.2-32 #39821)
with ESMTP id <01JJGH1G9GT400TIKN@KUHUB.CC.KU.EDU>; Mon,
13 Dec 1999 15:07:23 -0600 (UTC -06:00)
Received: (from listserv@localhost) by violet.jayhawks.net (8.9.3/8.9.3)
id PAA19912; Mon, 13 Dec 1999 15:06:33 -0600
Resent-date: Mon, 13 Dec 1999 15:06:33 -0600
Date: Mon, 13 Dec 1999 15:06:20 -0600 (CST)
Resent-from: kulua-l@kulua.org
From: Jeffrey Watts <watts@jayhawks.net>
Subject: Evolution Of A Linux User [LONG]
Resent-sender: kulua-l-request@kulua.org
To: KULUA List <kulua-l@kulua.org>
Reply-to: kulua-l@kulua.org
Resent-message-id: <7T62ND.A.52E.M_VV4@violet.jayhawks.net>
Message-id: <Pine.LNX.4.10.9912131505140.15239-100000@violet.jayhawks.net>
MIME-version: 1.0
Content-type: TEXT/PLAIN; charset=US-ASCII
Precedence: list
X-Loop: kulua-l@kulua.org
X-Authentication-warning: violet.jayhawks.net: listserv set sender to
kulua-l-request@kulua.org using -f
X-Mailing-List: <kulua-l@kulua.org> archive/latest/8103
---------- Forwarded message ----------
Subject: Evolution Of A Linux User
Evolution Of A Linux User
November 28, 1999
During the past year, the scientists in Humorix's Vast Research Lab Of
Doom have studied the behavior and attitude of the typical Windows and
Linux user. They have found that the average Linux user goes through ten
stages of development from a "Microserf" to an "Enlightened Linux User".
An eleventh stage, "Getting A Life", has also been observed, but only on
extremely rare occasions.
The 11 stages of evolution are summarized below. Note, however, that this
life cycle is not universal. Many pundits, Microsoft stock holders, and
PHBs never advance beyond Stage 0 ("Microserf"). Moreover, many extreme
Slashdot addicts are stuck between Stages 6 and 7 ("Linux Zealot") and
never evolve to Stage 9 ("Enlightened Linux User"). And, unfortunately,
far too many people are unable to leave Stage 8 ("Back to Reality") and
achieve Geek Self-Actualization due to problems outside of their control.
STAGE 0. MICROSERF
You are the number one member of the Bill Gates fan club. Your life
revolves around x86 computers running the latest version of Microsoft
solutions: Windows, Office, Internet Explorer, Visual Basic, and even Bob.
You have nothing but hate for those eccentric Mac weenies with their
click-n-drool interfaces and those stone-age Unix oldtimers with their
archaic command lines.
You frequently send angry letters to your elected representative about
Microsoft's "freedom to innovative". You think lawyers are evil (unless
they are defending innovative companies like Microsoft). You own an
autographed copy of a book that was ghostwritten by Bill Gates. Your
blood boils when somebody forwards you a so-called Microsoft "joke" by
email.
In short, you are a Microserf.
STAGE 1. FEAR, UNCERTAINTY, DOUBT... ABOUT MICROSOFT
Your world-view begins to sour as you encounter a growing number of
annoyances with Microsoft products. The number of Blue Screens increases,
however you ascribe the problem (at first) to conflicts with poorly
written drivers that came with your peripherals. Icons keep jumping
around the desktop unpredicatably. You spend 30 minutes one day idly
searching for an obscure configuration option in the Control Panel.
Slowly but surely, you begin to have doubts about the quality of Microsoft
software. Then, the Microsoft Network, to which you have dutifully
subscribed since 1995, begins to double bill your credit card. You
attempt to rectify the problem, but are stymied by the burgeoning
bureaucracy of Microsoft's Customer Support Department. Fear sets in...
will you get your money back?
Meanwhile, something called "Linux" appears on the fringe of your radar.
You immediately dismiss the idea of a viable and quality Microsoft
alternative (Linux is Unix-based and therefore must suck, you conclude).
Nevertheless, you wish something could be done for some of the annoyances
in Windows. But you do nothing about it.
STAGE 2. FEAR, UNCERTAINTY, DOUBT... ABOUT LINUX
You keep hearing about this Linux thing, and Open Source, and Apache, and
FreeBSD as well. One of your friends installs Linux and says, "It's cool,
dude!" You discover that the selection of Windows books at your local
bookstore has remained constant while the Linux and Unix books are
multiplying like rabbits. You argue, "Well, this just means Linux sucks...
if there was such a large demand for it, there wouldn't be many books on
shelves."
Nevertheless, as time wears on and Windows becomes more fragile, the
temptation to give Linux a try becomes more and more irresistable. While
at your local SuperMegaOfficeSupplyStore, you pick up a boxed version of
Red Hat on impulse.
With much hubris, you completely ignore the documentation and attempt to
install the OS by the seat of your pants. The installation is a failure;
Linux simply cannot work with the WinModem, WinSoundCard,
WinIDEController, WinPrinter, WinMonitor, and WinDRAM that came with your
"Windows 98 Ready" machine from CompUSSR. You don't realize this however,
since you didn't read the FAQs and HOWTOs. You immediately blame the
problems on Linux and give up. You ditch your Red Hat copy by selling it
on eBay.
After the installation fiasco, you leave fearful, uncertain, and doubtful
about this "alternative" operating system. Windows may have its problems,
but Microsoft will fix them in the next upgrade, you reckon.
STAGE 3. BORN-AGAIN MICROSERF
"Linux sucks" is your new attitude towards life. Windows, all things
considered, ain't so bad. You resolve to become a better Microsoft
customer by participating in the Microsoft Developer Network and the Site
Builder Network. You buy a bunch of "study guides" to pass the MCSE
examination.
You launch a Windows advocacy site on some dinky free webpage provider,
utilizing the latest innovations in VBScript, ActiveX, and other
IE-specific features. Instead of lurking, you now actively participate
in Linux and Macintosh bashing on various Usenet groups. Upon discovering
Slashdot for the first time, you assume the role of the Bastard Anonymous
Coward From Hell by posting countless flamebait posts about how cool
Microsoft is and how much "Linsux" (as you call it) is a crappy OS.
You proudly wear an "All Hail Chairman Bill" T-shirt and display numerous
pro-Microsoft bumper stickers ("Honk if you hate anti-trust laws") on your
car. You never leave home without your Windows CE-based palmtop computer.
You make a pilgrimage to Redmond to marvel at the glory that is the
Microsoft Campus.
STAGE 4. DISGRUNTLED USER
Your Microserf ways come to an abrupt end when everything goes wrong. You
lose a vital work-related document to a Windows crash. You lose your job
as an indirect result. You find that applying for jobs is difficult...
everyone wants your resume in the latest version of Word, but you have an
older version that has an incompatible file format.
You waste more and more time tinkering with Windows and other Microsoft
programs to keep them in working order. You encounter serious problems
with Windows, but your calls to technical support only yield the dreaded
response, "re-install the OS".
After much grief you finally land another job at a software company, only
to find out a month later that Microsoft has announced a competing product
to be "integrated" with the next version of Windows. You soon lose your
job.
You can't take it much longer. You are now an official Disgruntled User,
and are ready for a way to escape from the depths of Microsoft Hell. You
are ready for anything at all... even a primitive, archaic,
hard-to-install, grief-laden alternative like Linux.
STAGE 5. A RELIGIOUS EXPERIENCE
You resolve to install Linux now, for real. Your friends say "It's about
time", and tell you to RTFM this time. After losing yourself in the
documentation for several days, you figure out why your previous encounter
with Linux was a disaster: you need real hardware, not WinCrap.
With a new computer at your desk, and a Red Hat CD-ROM in hand, you embark
on a voyage of discovery to the land of Linux. Your life is changed
forever; words cannot describe the rush you feel when you first log in as
"root" after the successful installation. You stare blankly at the screen
in awe; you are unable to utter a word, unable to think of anything else
except "HOLY SHIT THIS IS SO DAMN COOL!!!!"
You spend hours, and then days, exploring the depths of the Linux system:
a filesystem layout that actually makes sense (no "My Documents" crap),
a command line so powerful it makes MS-DOS look like the Stone Age
technology that it is... and best of all, no Blue Screen!
"Why have I wasted my life with Microsoft? I'm never going back!" you
exclaim wildly. You have thrown off the yoke of Redmond Oppression.
STAGE 6. LINUX CONVERT
You still keep a copy of Windows around, but you find yourself booting
into Linux more and more. The meager amount of diskspace you set aside
for your first Linux install dwindles; you decide to buy a second hard
drive exclusively for Linux.
You re-install everything, including the kitchen sink (Emacs). Once you
finally get PPP working (it was a nasty challenge, but you're so enamored
with Linux that you hardly notice), you go on a Freshmeat Binge:
downloading and installing every piece of Free Software you come across.
STAGE 7. LINUX ZEALOT
Your enthusiasm for Linux is unbounded. You do anything and everything
to advocate Linux and spite your old master, Microsoft. Usenet, Slashdot,
and LinuxToday are your hangouts. You have a strong opinion about the
GNU GPL and you're not afraid to share it.
Linux World Domination is your new life's ambition; you put career,
wealth, and dating on the back burner. You participate in flamefests
against those braindead Windows lusers (stuck in Stage 3) that inhabit
Usenet and ZDNet. You purchase all kinds of tacky made-in-Taiwan Linux
merchandise (T-shirt, mouse pads, stuffed penguins, etc.) to show your
support.
You rearrange books in a bookstore so that the Linux tomes are displayed
more prominently. You get in trouble with your boss because you spend
all your time surfing Slashdot at work. You petition your local
government to migrate their computer systems to free software. You move
to another residence just so you can say you live on Apache Street.
Instead of a novel, you read the Linux kernel source for pleasure. You
establish your own regional Linux User Group in the hope that you can
invite a guest speaker in the future and get their autograph. You learn
Perl with the goal of automating common tasks, but you spend more time
tinkering with "just one more perl script" than actually getting stuff
done.
STAGE 8. BACK TO REALITY
Your zealotry subsides as you are forced to re-enter the Real World. Your
boss demands that you submit documents in the latest Word format, nothing
else will do. Some of your favorite websites become harder to use because
they keep incorporating features enhanced for Windows and IE. The new
peripherals you bought from BigEvilProprietaryCo don't work with Linux
and probably never will.
Your ISP is acquired by another company, a very Microsoft-friendly
company, to be exact. They "upgrade" the system; however, the only change
you can notice is that Linux and PPP no longer work without extensive
hacking. Then, citing "customer-driven demand", your ISP makes more
"enhancements", and Linux no longer works at all. Calling their tech
support is an exercise in futility, they simply say, "Linux? What is
that? Whatever it is we don't support it, and never will. Go use Windows
like everybody else."
Reality sets in: you are forced to use Windows more and more. Your blood
pressure rises, you have more headaches, you waste hours and hours due to
Windows "issues", but you have no choice.
STAGE 9. ENLIGHTENED LINUX USER
Then you have an inspiration: you do have a choice, you can hack your own
drivers for your hardware, you can find another ISP, you can get another
job. Everything comes into focus, you have become a Linux Guru.
You kludge together drivers for your "Windows-compatible" hardware. You
finally (after much searching) locate a local ISP that's actually run by
competent geeks, not MCSEs and PHBs. You find a new, better job at a
Linux-friendly company.
In your spare time, you work on various Open Source projects. You build
up a reputation and receive "The Letter" to participate in the IPO of a
Linux business. You join the bandwagon and create your own Linux portal
website.
You're at the pinnacle of evolution for a Linux user. With much joy, you
become 100% Microsoft free. You ditch your Windows partition and burn
all of the Windows disks and manuals that you own.
STAGE 10. GET A LIFE
You become bored with Linux, and computers in general. You're still a
hardcore geek, of course, but you wonder if there isn't something better
you could be doing. You've been told to "get a life" countless times
during your existence on Earth, but now you wonder if maybe you should
have heeded that advice.
Unexpectedly, a media conglomerate (i.e. Andover, Ziff-Davis,
Internet.com, etc.) offers to buy your Linux portal website and domain
name for an obscene price that contains a significant number of digits.
Without hesistation you accept; this windfall, combined with your earnings
from Linux stocks, is enough to retire on.
And that's exactly what you do. You move off to a small tropical island,
and get a life.
--------------------------------------------------------------------------
* Please read the FAQ: http://kulua.org/index.phtml?body=Info/FAQ.phtml
* To unsubscribe: Send an email to <kulua-l-request@kulua.org> with the
following in the body: "unsubscribe <your email address>"
</pre>Sambithttp://www.blogger.com/profile/10315454465933047223noreply@blogger.com1tag:blogger.com,1999:blog-4372471714060702862.post-18135675357602400762008-11-29T18:50:00.006+05:302008-11-30T16:43:23.891+05:30Mumbai Nov 2008 Terror Attacks"Terror attack on Mumbai" -- this is the headline on every news channel, be it Indian or foreign since the last few days. People seem to have got accustomed to indiscriminate killings and bombings every now and then, terror attacks have become almost a part of our daily life. Some discussion about the need to combat terror after every attack, some blame-game and finally everything settles down. Everything returns back to normal, until another attack kills a few hundred more. The cycle then repeats. People blames the Govt. for being ineffective, state Govt. will blame center, center will put the blame on state, both will then blame neighboring countries. The drama soon gets over, people forget the incident, Govt. forgets the culprits and things move on.<br />Go to a mall, restaurant, railway station or board a train, you never know the next moment you might be blown up in several pieces or reduced to ashes. We just hope we are lucky enough not to meet that fate. Each time a massacre happens we thank God, that someone else but not myself was killed.<br />After every attack, the media talks about the audacity of the terrorists, how a few of them can kill so many. Frankly speaking, it doesn't take much to cause a widespread massacre. Blowing up a mall or hotel or train full of hundreds of people doesn't require much resources neither does it take much effort to spray bullets on unarmed people on the streets.<br />The persons responsible claim to be waging a "holy" war to eliminate the "unholy", to protect their faith. So deep is their "respect" for their religion, that human life seems too insignificant for them. Islamic jihadis will try to establish their supremacy, Hindu extremists will try to establish "Hindutva", some other religion will try to establish their domination and curb down the power of others.<br />The simple reason: <span style="font-style: italic;">Each one holds their religion and religious ideas supreme.</span><br />The consequence: <span style="font-style: italic;">Ordinary men, who are least interested in any of the extremists' dreams of world domination has to pay with their lives.</span><br />The only net thing that religious fanaticism has taught us, since the history of mankind is intolerance and hatred. No matter how much any particular religion bluffs about harmony and unity, deep down it builds up a sense of self supremacy over other religions and the moment one starts valuing religious ideals over humanity, it leads to one and only one consequence - <span style="font-style: italic;">disrespect of humanity and loss of innocent lives</span>. "Terrorists" are like the rest of us, only difference - they have been brought up to hold their so called "religious ideals" over and above everything, even above human lives both of their own as well as that of others.<br />Given the current state of affairs there is very little reason to be optimistic. All each one of us can do is hope, that the next bullet or bomb does not hit any of us.Sambithttp://www.blogger.com/profile/10315454465933047223noreply@blogger.com7tag:blogger.com,1999:blog-4372471714060702862.post-90005352051358870532008-11-22T23:22:00.012+05:302008-11-23T12:53:57.694+05:30Setting up local Ubuntu & Debian mirror using apt-mirror<i>Prologue:</i> Our institute was moving to it's new campus. For a central Govt. run research institute, the huge land requirements forced it to be located quite far off from the city. It is a remote place around 50km from Kolkata, WB, India. Leased line internet connectivity is there in the Institute, but there was a "rumour" that internet connectivity will not be provided in the student's hostel. There is a large number of Ubuntu and Debian GNU/Linux users among the students. Whether the rumour was true or not, I could not have taken any chance. I had a spare 60GB Seagate USB HDD. It was big enough to hold the main, universe, multiverse and restricted packages for Intrepid and the main, contrib and non-free packages for Lenny. In addition to that I also mirrored a few other extra stuffs. We had a about a month to go, before we left for the new campus, so I set out for finishing the job before that. Ofcourse the biggest hurdle was bandwidth. We had a 2Mbit/s ADSL link in the hostel. So I knew it was going to take a few days to finish the download.<br />There are several ways to make a offline copy of ubuntu or debian repo. I found apt-mirror most easiest to use. I have documented the steps here, just in case someone else finds it useful.<br />i) The first job is ofcourse to install apt-mirror, it is there in the repo, so this step is trivial<br /><pre>sudo apt-get install apt-mirror</pre><br />ii) The next step is to tell apt-mirror, whats stuffs to mirror. The configuration files for apt-mirror is in /etc/apt/ubumirror.list and /etc/apt/debmirror.list<br />Here are the two files:<br /><br />ubumirror.list<br /><pre>### ubumirror.list<br />############# config ##################<br />#<br />set base_path /home/sambit/stjet/mirror<br />#<br /># if you change the base path you must create the directories below with write privlages<br />#<br /># set mirror_path $base_path/mirror<br /># set skel_path $base_path/skel<br /># set var_path $base_path/var<br /># set cleanscript $var_path/clean.sh<br /># set defaultarch <running host architecture><br />set nthreads 20<br />set _tilde 0<br />#<br />############# end config ##############<br />#Packages<br />deb http://ftp.twaren.net/Linux/Ubuntu/ubuntu/ intrepid main restricted universe multiverse<br />#Updates<br />deb http://ftp.twaren.net/Linux/Ubuntu/ubuntu/ intrepid-updates main restricted universe multiverse<br />#Security updates<br />deb http://security.ubuntu.com/ubuntu/ intrepid-security universe main multiverse restricted<br />#Proposed<br />deb http://ftp.twaren.net/Linux/Ubuntu/ubuntu/ intrepid-proposed restricted main multiverse universe<br />#Backports<br />deb http://ftp.twaren.net/Linux/Ubuntu/ubuntu/ intrepid-backports restricted main multiverse universe<br />#Openoffice3<br />deb http://ppa.launchpad.net/openoffice-pkgs/ubuntu intrepid main<br />#Partner repo<br />deb http://archive.canonical.com/ubuntu intrepid partner<br />#Medibuntu packages<br />deb http://packages.medibuntu.org/ intrepid free non-free<br />clean http://ftp.twaren.net/Linux/Ubuntu/ubuntu/<br /></pre><br /><br />debmirror.list<br /><pre><br />### debmirror.list<br />############# config ##################<br />#<br />set base_path /home/sambit/stjet/mirror/debmirror<br />#<br /># if you change the base path you must create the directories below with write privlages<br />#<br /># set mirror_path $base_path/mirror<br /># set skel_path $base_path/skel<br /># set var_path $base_path/var<br /># set cleanscript $var_path/clean.sh<br /># set defaultarch <running host architecture><br />set nthreads 20<br />set _tilde 0<br />#<br />############# end config ##############<br />deb http://ftp.twaren.net/debian/ lenny main contrib non-free<br />deb http://ftp.twaren.net/debian/ lenny-proposed-updates main contrib non-free<br />clean http://ftp.twaren.net/debian<br /></pre><br /><br />My 60GB SeagateHDD inside Transcend StoreJet USB enclosure was mounted at /home/sambit/stjet , so the base path was /home/sambit/stjet/mirror , which meant all the stuffs would be downloaded to the mirror directory inside the disk.<br />The deb lines tells apt-mirror what to mirror. I had selected main restricted universe multiverse for intrepid, as well all the updates including security, proposed and backports. A few additional repos were also selected. ftp.twaren.net is located in Taiwan, and from my experience I have seen it gives the best download speed in my location. Unfortuntely in India bandwidth is sitll not as easily available as it is in other countries. The official ubuntu mirror in India is at the Indian Institute of Technology, Madras, but the download speed from it is quite slow compared to the Taiwanese mirror.<br />The last line clean http://ftp.twaren.net/Linux/Ubuntu/ubuntu/ and clean http://ftp.twaren.net/debian tells which directory to check for cleaning up disk space if possible.<br />iii) To start mirroring type<br /><pre><br />sudo apt-mirror /etc/apt/ubumirror.list</pre><br />and<br /><pre>sudo apt-mirror /etc/apt/debmirror.list</pre><br />It will show how many GBs have to be downloaded. In my case it was around 25GB for the ubuntu mirror and around 20GB for the Debian mirror. That would have required a couple of days with the 2Mbit/s connection. I used screen for the purpose. The advantage is that the virtual console can be detached after running the command so that the download goes on in the background. I could connect to the detached console any time later using screen -R, to view the progress.<br />iv) The packages are to be served over http. So a webserver is required for this. Use either the mighty Apache2 or the lighty Lighttpd. Apache2 was already installed in one of my old PIV. So I didn't have to do anything extra for this. All I need was to create symlinks in the /var/www/ubuntu and /var/www/debian directory, so that it points to the packages.<br /><pre><br />ln -s /home/sambit/stjet/mirror/mirror/ftp.twaren.net/Linux/Ubuntu/ubuntu /var/www/ubuntu/ubuntu<br />ln -s /home/sambit/stjet/mirror/mirror/packages.medibuntu.org /var/www/ubuntu/medibuntu<br />ln -s /home/sambit/stjet/mirror/mirror/ppa.launchpad.net/openoffice-pkgs/ubuntu /var/www/ubuntu/ubuoofficeppa<br />ln -s /home/sambit/stjet/mirror/mirror/archive.canonical.com/ubuntu /var/www/ubuntu/ubupartner<br />ln -s /home/sambit/stjet/mirror/mirror/security.ubuntu.com/ubuntu/ /var/www/ubuntu/ubusec<br />ln -s /home/sambit/stjet/mirror/debmirror/mirror/ftp.twaren.net/debian/ /var/www/debian<br /></pre><br /> v)The hostname for the machine is mars.iiserk.net (don't try to access it, it is behind a firewall and not accessible from the internet). I now have my own Ubuntu Intrepid mirror at http://mars.iiserk.net/ubuntu<br /> vi) The last step is to modify the /etc/apt/sources.list for the client machines, so that they pull down packages from mars.iiserk.net.<br /> Here is my copy for my laptop running Ubuntu Intrepid:<br /> <pre><br />##Local Mirror##<br />##Stuffs##<br />deb http://mars.iiserk.net/ubuntu/ubuntu/ intrepid main restricted universe multiverse<br />deb http://mars.iiserk.net/ubuntu/ubupartner/ intrepid partner<br />deb http://mars.iiserk.net/ubuntu/ubuoofficeppa intrepid main<br />deb http://mars.iiserk.net/ubuntu/medibuntu intrepid free non-free<br />##Updates##<br />deb http://mars.iiserk.net/ubuntu/ubuntu/ intrepid-updates main restricted universe multiverse<br />deb http://mars.iiserk.net/ubuntu/ubuntu/ intrepid-proposed restricted main multiverse universe<br />deb http://mars.iiserk.net/ubuntu/ubuntu/ intrepid-backports restricted main multiverse universe<br />deb http://mars.iiserk.net/ubuntu/ubusec/ intrepid-security main universe multiverse restricted<br />####################################################<br />##Internet##<br />##Sources##<br />deb-src http://ftp.twaren.net/Linux/Ubuntu/ubuntu/ intrepid main restricted universe multiverse<br />deb-src http://ftp.twaren.net/Linux/Ubuntu/ubuntu/ intrepid-updates main restricted universe multiverse<br />deb-src http://archive.canonical.com/ubuntu intrepid partner<br />deb-src http://ftp.twaren.net/Linux/Ubuntu/ubuntu/ intrepid-security main restricted<br />deb-src http://ftp.twaren.net/Linux/Ubuntu/ubuntu/ intrepid-security universe<br />deb-src http://ftp.twaren.net/Linux/Ubuntu/ubuntu/ intrepid-security multiverse<br />##Others##<br />#deb http://www.remastersys.klikit-linux.com/repository remastersys/<br /></pre><br />I didn't mirror the sources, so they were to be pulled directly from the internet, when required. The other packages would be fetched from the my local mirror.<br />It took me around 5 days to fetch 45GB of data.<br />To keep the mirror updated, I added to to lines to crontab<br /><pre><br />2 2 * * * /usr/bin/apt-mirror /etc/apt/debmirror.list >> /var/spool/apt-mirror/var/cron.log<br />55 2 * * * /usr/bin/apt-mirror /etc/apt/ubumirror.list >> /var/spool/apt-mirror/var/cron.log<br /></pre><br />These will check for updates every night at 0202 hrs for debian mirror and 0255hrs for ubuntu mirror.Sambithttp://www.blogger.com/profile/10315454465933047223noreply@blogger.com0tag:blogger.com,1999:blog-4372471714060702862.post-29484534931308766952008-10-27T23:15:00.017+05:302008-12-02T16:51:16.921+05:30Some more fun with SSH port forwarding and socks proxyFew days ago I made the following post:<br /><quote style="font-style: italic;font-family:lucida grande;"><br /><span style="font-size:105;">Prologue: Our Institute has several nice Dual Core Machines deployed for the students. Unfortunately the machines are behind a NAT with no port forwarded for external SSH access. Student's hostel is a bit far off from the computational centre. As such if someone felt the need of accessing the machines during non-office hours, it was a wee bit difficult. The sysadmin would not have agreed to forward any ports. Something had to be done....<br /><br />SSH has a very useful feature - Remote and Local Port Forwarding. We have an old rickety PIII running Ubuntu 8.04.1 in the Hostel, it is connected to the net and is accessible via SSH from the internet. Using a tiny little shell script running on one of the machines in the Institute, I managed to make the old PIII an intermediate gateway for gaining SSH access to the Institute's machines from anywhere in the internet. The script is of few lines, but nevertheless powerful enough to serve our purpose.<br /><pre><br />#!/bin/bash<br />while [ 1 ]; do<br />ssh -C -o ServerAliveInterval=30 -R 4321:localhost:22 serververhostname<br />echo Retrying<br />done<br /></pre><br />Let us analyse what this code does.<br />First of all <code>serververhostname</code> is the hostname of the PIII server. For example if <code>www.example.com</code> resolves to the public ip of the PIII server, then <code>www.example.com</code> would have been used instead of <code>serververhostname</code>.<br />The <code>-C</code> option requests compression of all data, to improve data transfer speed over slow connections.<br />The <code>-o ServerAliveInterval=30</code> makes the SSH client send a keepalive packet at the application layer every 30s, this is to prevent a timeout, in case the connection is idle.<br /><code>-R 4321:localhost:22</code> is the most important part. There is a SSH server running in the Institute's workstation, listening on port 22. "<code>-R 4321:localhost:22</code>" specifies that port 22 of localhost, i.e. of the institute's workstation is to be forwarded to port 4321 of the PIII, such that whenever a connection is made to the PIII on port 4321, the connection gets forwarded over the secure channel to port 22 of the Institute's Workstation.<br />The while loop ensures that the connection gets re-established if it breaks. You need to use a passphraseless RSA or DSA key for authentication instead of a password, otherwise the ssh client will wait for a password input.<br />Now suppose in the midst of the night I feel an urge to log in to the machine in my college, but I am (say even a few hundred or thousand miles :D) away from the computational centre, all I need to do is log in to the PIII server in the hostel using ssh from anywhere in the internet. Once I am in there, I issue the command: "<code>ssh -l username localhost -p 4321</code>". Though I am ssh-ing into port 4321 of localhost, effectively the connection is made to port 22 of the Institute's workstation, thanks to the previous ssh port forwarding. No need for persuading the sysadmin to make changes to the NAT or Institute's firewal<span style="font-size:70;">l</span></span><span style="font-size:85%;">.</span></quote><br /><br />This time I will talk a bit more on the same stuff.<br />Several websites are hosted in the Institute's network, which are accessible from the Institute's LAN only. Most of these are web pages by the faculty, meant to provide class notes and assignments. As such it gets difficult to access the stuffs from our hostel. One way is to connect to any of the Institute's workstations through ssh using the former tunnel and then fetch the required page or file using wget and scp. But I didn't like the idea of manually logging in every time I needed to access any file. Possessed by an unusual craving for automation, I set out fixing this itchy problem. Initially I used to set up a ssh SOCKS proxy by using <code>ssh -l username -D *:9090 localhost -p 4321</code> . This sets up SOCKS proxy on Oak which listens on port 9090. Firefox can be configured to use SOCKS proxy directly. I could browse websites located in the Instiute's LAN, now using this proxy. Anyway this involved the "trouble" of reconfiguring Firefox's proxy settings every now and then. For sometime I was using the Firefox extension Foxyproxy to manage my proxy settings automatically. It recognizes URLs and can be configured to use different proxy settings for different sites. Still I was not completely happy with this solution. I craved for something more.<br /><br /><br />I had an old PIV named Mars lying around, being used as a torrent downloader. I decided to put it to some good use. My aim was to set up a cgi based proxy server on Mars, so that using a web browser I would get to the cgi proxy and be able to surf any website within the Institute's LAN using the CGI Proxy. For this purpose I set up Privoxy on Mars and made it forward connections to the SOCKS proxy listening on port 9090 on Oak. Apache was already running on Mars. I installed the CGIProxy 2.1beta18 CGI script from <a href="http://www.jmarshall.com/tools/cgiproxy/">James Marshall's Home Page</a>. It gives a nice web interface. Just enter the URL, and it loads the page by relaying the connection through whatever proxy it has been configured to use. In my case it was using Privoxy.<br />So in effect this is what was happening-<br /><br />The CGIProxy 2.1beta18 CGI script was relaying connections through Privoxy, which relayed them through the ssh SOCKS proxy, which in turn was going through the encrypted secure tunnel established right at the beginning by the ssh session initiated by the workstation at the Institute. So far so good.<br /><br />But life is never smooth sailing, there were quite a few more hurdles to overcome. Oak doesn't have 24x7 internet connectivity, it is connected to the net only for 12hours from 1530 UTC to 0330 UTC which corresponds to 2100 IST to 0900 IST. On top of that the connection is an unreliable ADSL connection, which breaks quite often. The script at the Institute's Workstation tries to connect to Oak whenever Oak is online. If unfortunately the ADSL link of Oak, suddenly breaks, the ssh client gets disconnected, but the <i>ghost</i> session persists in Oak. Next when the ADSL link gets re-established, the ssh client in the Institute's Workstation tries to reconnect back to Oak. However due to the previous <i>ghost</i> session, the client is now unable to forward the required port, since the same port is already reserved. So it was necessary to detect and exorcise these <i>ghosts</i>.<br /><br />The following script ensures that all <i>ghosts</i> are killed and a successful connection has been established from the Institute's Workstation. Only then does it creates the ssh SOCKS proxy server.<br /><pre><br />#!/bin/bash<br />while [ 1 ]; do<br />echo talkback started.<br />if [ `/usr/bin/w | /bin/grep -wc IPaddress` == "0" ]<br />then<br />echo talkback: Sleeping...<br />sleep 120<br />elif [ `/usr/bin/w | /bin/grep -wc IPaddress` == "1" ]<br />then<br />if [ `/bin/ps aux | /bin/grep ssh | /bin/grep -wc localhost` == "0" ]<br />then<br />echo "talkback: logging in..."<br />/usr/bin/ssh -N -l students -D *:9878 localhost -p 4321 -i $HOME/id_rsa &<br />else<br /> echo talkback: already logged in.<br /> sleep 60<br />fi<br />else<br />echo talkback: already logged in. shall kill ssh session :D<br />/usr/bin/skill -KILL username<br />fi<br />echo talkback: sleeping...<br />sleep 60<br />done<br />exit 0<br /></pre><br />IPaddress is replaced by the IP address from which the connection is being made. If no connections exists, which is the generally the case during 0900IST to 2100IST, the script sleeps for 2min and checks again. If there is a connection, then the script checks whether Oak has already logged in to the Institute's workstation or not. If not it logs in and creates the ssh SOCKS proxy listening on port 9878. If more than one connection were made from the Institute's workstation to Oak and the previous sessions didn't get timed out, then the script kills all the sessions of "username", reruns and waits for a new connection to be made to Oak from the Institute's workstation.<br /><span style="font-weight: bold;"><span style="font-style: italic;">P.S. This post has slightly technical stuff and my way of explaining things is somewhat ugly. Leave a comment if something is not clear.</span></span>Sambithttp://www.blogger.com/profile/10315454465933047223noreply@blogger.com2tag:blogger.com,1999:blog-4372471714060702862.post-71788509096102691992008-10-27T22:05:00.004+05:302008-10-27T22:47:43.304+05:30XHTML 1.0 Standards - who cares?It has been quite a few days, since I started Blogging. On the source code of my blog, it was proudly proclaimed <span style="font-family:monospace;"><code><!DOCTYPE html PUBLIC "-⁄⁄W3C⁄⁄DTD XHTML 1.0 Strict⁄⁄EN" "http:⁄⁄www.w3.org⁄TR⁄xhtml1⁄DTD⁄xhtml1-strict.dtd"></code></span><br />I rushed off to <a href="http://validator.w3.org/"> W3C Markup Validator </a>. The fist run showed up 437 errors! Quite high a number it was. Most of them were petty errors like unencoded ampersands in URLs, improper comments and the like. It is true, the extremely demanding XHTML 1.0 Strict standards sometimes becomes too much for web designers, but no one forces a designer to declare <span style="font-family:monospace;"><code><!DOCTYPE html PUBLIC "-⁄⁄W3C⁄⁄DTD XHTML 1.0 Strict⁄⁄EN" "http:⁄⁄www.w3.org⁄TR⁄xhtml1⁄DTD⁄xhtml1-strict.dtd"></code></span> either. If Google Blogger is so keen to show off its <code>"XHTML 1.0 Strict"</code> compliance, then it should take up the responsibility that it remains true to its words. Simply asserting some compliance and then relying on the browser to do the rest of the hard work is something that one doesn't expect from Google.Sambithttp://www.blogger.com/profile/10315454465933047223noreply@blogger.com0tag:blogger.com,1999:blog-4372471714060702862.post-60479338601206011552008-10-26T23:48:00.008+05:302008-10-29T13:22:02.560+05:30Snapshots of my room in IISERK Hostel<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEizmRZ1G9Gd8UNQd2bmWbPazyQEQrzO2jCdoR6P4sb2ABJ-uDQ8CnfaiE_JqfapA_kyeDJtLr3Nsqd65IX5FPWyuffnwFiTE9jAmB8lSILug_U2MxNU95ckGyH5QRjCCG-oCVGCEYSMhR-c/s1600-h/DSC00208.JPG" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img style="width: 198px; height: 265px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgaQTZrD5IDPPs_pM6TicXNELDA-HfJrX_fMQSSaREDkfyVbhi2-7TPeCfCaV5G7Wh08Nj-v8HKfFq8_1i2IXjsM7_SJPGIrpu_ZU0ciAFdXv9rcdWiO1gSUfI2RcNB36ufbUtLfrUKoH9f/s400-r/DSC00208.JPG" border="0" /></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhTL5MyPOZ0i816_5lRi5N2OiUWAQ9APzm1xkSdIqYUzmI1_OBNiBKuPTLYTmL8mircTua12G_QfhdH5hdJ1iRCTdmsPyKQoo0aC1pjl-_cWgeoW9YoBXgGES43M4wQmqsDGmrysGMJcYJY/s1600-h/DSC00206.JPG" imageanchor="1" style="margin-bottom: 1em; margin-left: 1em;"><img style="width: 306px; height: 227px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjld3mRi7iR8qsnJXpX3VhpshmLxxhi8Xaiyl5R_ckHOZ0WcdtnmoS_w4_2f_DbBf6VqZqn7kosQzNXUzA_8wOQU7PXW6pihMEYfc5ipcNfdOV_-Mm7i9rTXVwm6p-KHHzR8hGAtLTLadfE/s400-r/DSC00206.JPG" border="0" /></a></div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi11saf-X-4ypz7ZtbVnj3wTOcAt1wM6pqtQh5f5eDMoK_vgyn-j3waQviqMq7o4cdneHdxI89nXR650bl7WuSHf48t7ysyawl5Ru3k03WLxBScjpL7IWwq5ei-BEhww1KYYvkRiJM4Ieiv/s1600-h/DSC00205.JPG" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img style="width: 262px; height: 196px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhcUpC0Q6BITKJESPymgAdjMOIsSdZtiU8I9JH4w4ZfL4ZRYa9Ipn1pqjHamIkCLWCQp1OPexvYfTQV3WYMG5b8x5b8ZbahvGCZjKIvJ06UauHDHPDekC0dp6L_GIDHbpPrxfhn9qzi2Rf1/s400-r/DSC00205.JPG" border="0" /></a></div>... Neat and tidy .. isn't it ?<br />At the bottom of the rack (in the first pic) you can see <b>Oak</b> - our unofficial webserver, fileserver and network router for the hostel. On the table lies <b>Mars</b> - my Torrent Downloader and Music Player. It doubles up as a local mirror for some websites of our Institute's LAN. On the table also lies <b>Pluto</b> my almost always-on Compaq Presario V3018TU. All of them runs some flavor or the other of Ubuntu GNU/Linux. <b>Oak</b> and <b>Mars</b> runs Hardy Heron 8.04.1 LTS while <b>Pluto</b> runs Intrepid Ibex 8.10.Sambithttp://www.blogger.com/profile/10315454465933047223noreply@blogger.com0tag:blogger.com,1999:blog-4372471714060702862.post-38418367566197857482008-10-14T21:38:00.007+05:302008-10-16T17:58:41.695+05:30Fun with SSH Remote Port Forwarding<i>Prologue:</i> Our Institute has several nice Dual Core Machines deployed for the students. Unfortunately the machines are behind a NAT with no port forwarded for external SSH access. Student's hostel is a bit far off from the computational centre. As such if someone felt the need of accessing the machines during non-office hours, it was a wee bit difficult. The sysadmin would not have agreed to forward any ports. Something had to be done....<br /><br />SSH has a very useful feature - Remote and Local Port Forwarding. We have an old rickety PIII running Ubuntu 8.04.1 in the Hostel, it is connected to the net and is accessible via SSH from the internet. Using a tiny little shell script running on one of the machines in the Institute, I managed to make the old PIII an intermediate gateway for gaining SSH access to the Institute's machines from anywhere in the internet. The script is of few lines, but nevertheless powerful enough to serve our purpose.<br /><code><br />#!/bin/bash<br />while [ 1 ]; do<br />ssh -C -o ServerAliveInterval=30 -R 4321:localhost:22 serververhostname<br />echo Retrying<br />done<br /></code><br />Let us analyse what this code does.<br />First of all <code>serververhostname</code> is the hostname of the PIII server. For example if <code>www.example.com</code> resolves to the public ip of the PIII server, then <code>www.example.com</code> would have been used instead of <code>serververhostname</code>.<br />The <code>-C</code> option requests compression of all data, to improve data transfer speed over slow connections.<br />The <code>-o ServerAliveInterval=30</code> makes the SSH client send a keepalive packet at the application layer every 30s, this is to prevent a timeout, in case the connection is idle.<br /><code>-R 4321:localhost:22</code> is the most important part. There is a SSH server running in the Institute's workstation, listening on port 22. "<code>-R 4321:localhost:22</code>" specifies that port 22 of localhost, i.e. of the institute's workstation is to be forwarded to port 4321 of the PIII, such that whenever a connection is made to the PIII on port 4321, the connection gets forwarded over the secure channel to port 22 of the Institute's Workstation.<br />The while loop ensures that the connection gets re-established if it breaks. You need to use a passphraseless RSA or DSA key for authentication instead of a password, otherwise the ssh client will wait for a password input.<br />Now suppose in the midst of the night I feel an urge to log in to the machine in my college, but I am (say even a few hundred or thousand miles :D) away from the computational centre, all I need to do is log in to the PIII server in the hostel using ssh from anywhere in the internet. Once I am in there, I issue the command: "<code>ssh -l username localhost -p 4321</code>". Though I am ssh-ing into port 4321 of localhost, effectively the connection is made to port 22 of the Institute's workstation, thanks to the previous ssh port forwarding. No need for persuading the sysadmin to make changes to the NAT or Institute's firewall.Sambithttp://www.blogger.com/profile/10315454465933047223noreply@blogger.com2tag:blogger.com,1999:blog-4372471714060702862.post-35332847300222842082008-10-13T12:22:00.005+05:302008-10-13T12:51:44.661+05:30Changing the favicon for your blogPeople who are not happy with the Orange and White Blogger favicon, can use their own instead. First create a 48 X 48 px image using Gimp or whatever software you prefer. Save the image as a .ico file, say <i>myicon.ico</i>. Upload the image to some webhost like Google Pages or Geocities (Picasa WebAlbum doesn't accept .ico files).<br />
Next go to your Blogger DashBoard --> Layout --> Edit HTML.<br />
Locate the line <code><head></code><br />
After the line insert the code-<br />
<code><link href="http://imagelocation/myicon.ico" rel="icon"></code>.<br />
Replace http://imagelocation with your webhost's address. Save the template. The job is done. Refresh your Blog page, your own icon will appear instead of Blogger's.Sambithttp://www.blogger.com/profile/10315454465933047223noreply@blogger.com9tag:blogger.com,1999:blog-4372471714060702862.post-19429537568254904292008-10-11T13:57:00.007+05:302008-10-11T17:02:02.337+05:30Adding Social Bookmarking links like Digg, Delicious etc. in BloggerWith a little tinkering of the HTML code of the Blogger template, it is very easy to insert social bookmarking links like <a href="http://digg.com/">Digg</a>, <a href="http://del.icio.us/">Delicious</a>, <a href="http://technorati.com/">Technorati</a> etc. so that readers can directly bookmark the Blog post.<br />To add these links:<br />Go to your Blogger Dashboard, Click Layout --> Edit HTML. Then check - Expand Widget Templates<br />Search for the line: <span style="font-style: italic;">post-footer-line</span><br />Just after the line, add the following code:<br /><code><p/>Add to: <a expr:href='"http://digg.com/submit?phase=2&url=" + data:post.url + "&title=" + data:post.title' target='_blank'><img HEIGHT='20' WIDTH='50' src='http://lh4.ggpht.com/sambitbikaspal/SPAyI0pMJYI/AAAAAAAAAm0/THLvsaJKvJo/s144/digg-logo.gif'/></a> <a expr:href='"http://del.icio.us/post?url=" + data:post.url + "&title=" + data:post.title' target='_blank'><img HEIGHT='20' WIDTH='75' src='http://lh6.ggpht.com/sambitbikaspal/SPAyIYm0_YI/AAAAAAAAAms/WCVRbA5dBto/s144/delicious_logo.jpg'/></a> <a expr:href='"http://technorati.com/faves?add=" + data:post.url + "&title=" + data:post.title' target='_blank'><img HEIGHT='20' WIDTH='75' src='http://lh3.ggpht.com/sambitbikaspal/SPAyI6EDxdI/AAAAAAAAAm8/foKy9hP8qe4/s144/technorati_logo.jpg'/></a><br /><p/></code><br />The links- <code>http://lh6.ggpht.com/sambitbikaspal/SPAyIYm0_YI/AAAAAAAAAms/WCVRbA5dBto/s144/delicious_logo.jpg</code> and the likes correspond to the logos for the respective sites, stored in my Picasa WebAlbum. Alternatively if you want you can upload the logos to some other free image host and change the links accordingly.The net effect of this will be, the social bookmarking links will get added below each of your posts.<br />Kindly Digg the story if you liked it!Sambithttp://www.blogger.com/profile/10315454465933047223noreply@blogger.com0