The world is my backyard.
Random header image... Refresh for more!

Category — Hacks

One command to rule…. alright, just return an IP

One of my friends who is into networks always joke, as why there is no single Unix command to return only the IP address and nothing else. Here is a script that just does that one thing and nothing else.

#!/usr/bin/env bash # Arvinder Singh Kang # askang@olemiss.edu # Version 0.1 - 2009-06-02 # ipaddress: This snippet returns the ipaddress of the current computer. Store in a directory which is in the PATH, and make it executable by running "chmod +x ipaddress". # Running command ipaddress should return ipaddresses of this machine.

ifconfig  | grep -E 'inet.[0-9]' | grep -v '127.0.0.1' | awk '{ print $2}'

December 8, 2009   2 Comments

Imaging ppc iMacs using Deploy Studio

For imaging(reinstalling/updating/blah blah!) more than fifty ppc iMacs and G5 Mac Towers in less than a day, I started using Deploy Studio instead of NetRestore.

However on booting a client from the NetBoot server, i got the following sign on ppc client machine

netboot


After reading some notes on NetBoot here, I found this reason:

The mach.macos.mkext file is a kernel extensions cache — a file containing all the important kernel extensions for basic network booting. Its fairly uncommon to run into problems in this stage of the Netboot process, however, there are a couple specific issues that can cause kernel panics at this point. Possible problems would be:

Not having a mach.macosx and mach.macosx.mkext file in your Netboot set

And when checked mach.macosx.mkext was actually missing from the nbi’s dmg file. So I generated one using following code

kextcache -a ppc -m /Library/NetBoot/NetBootSP0/DeployStudioRuntime-091207-145110.nbi/ppc/mach.macosx.mkext -N -L /Volumes/DeployStudioRuntime/System/Library/Extensions/

And my netboot imaging operation was back in business. Ahhh…. Freshly minted macs by the time I walk in tomorrow morning.

December 7, 2009   No Comments

Gurmukhi on Android G1 mobile

I Singh

Update March 6, 2010 : As the unrooted phone does not allow change in the phone ROM, this would only run on rooted phone. Here are five reasons why you should root your phone. One way to do it, is listed on CyanogenMod wiki.

I use Google G1 running Android OS for my email. To enable Punjabi on android I used the following steps

  1. Download a Unicode Punjabi font.
  2. Copy this font to your sdcard and rename it exactly DroidSansFallback.ttf.

Now start Terminal Emulator and type exactly (watch the Case) the following commands, followed by enter.

su (then wait for the superuser screen and press yes)
mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system
chmod 4755 /system/fonts/DroidSansFallback.ttf
dd if=/sdcard/DroidSansFallback.ttf of=/system/fonts/DroidSansFallback.ttf
reboot

Android Punjabi

Voila you should be able to read Hukamnama and emails written in Punjabi.

Thanks to Droidbot for the idea

December 3, 2009   3 Comments

Leopard firewall revisited

Orion Aveugle Cherchant le Soleil

While bringing up firewalls for my test server, I thought of doing a little check on my machine. The logs raised both my eyebrows. Dear Google told me, I was not the only one.

Leopard introduced application based firewall, while the old ipfw still exists with just one default rule (Accept everything from everything!)

65535 allow ip from any to any

[Read more →]

March 7, 2009   No Comments

Postfix install and Security talk

Father son

Once your OS is grown enough to play (I mean installed), you have to sit down with it and do the SECURITY TALK.

A little on the philosophical side of it, I think sense of security is just a fad and a perception. You are secure when you start feeling it, or we can keep on going paranoid tweaking it deeper and deeper, there will always exploits to to be known, more tools to be learnt, more WMDs to be discovered!

Always have a second plan- backup your data.

Lets get back to our Linux Box.

[Read more →]

March 7, 2009   No Comments

In the town called Workflow, lived three friends – Git, CVS and Drupal….

Moving ahead on the new project, I decided to install a versioning system. I kinda have a crush on Git, however have not been using it regularly. So what better time to rekindle the old fire?

I have used SVN in the past, however CVS is still the old faithful dog hosting Drupal repositories. I wanted to concentrate on using Git, while wanted easy way to update drupal installations.

After a number of blog reads, here is my workflow (atleast planned one…)

Git Drupal Workflow.png

[Read more →]

March 2, 2009   2 Comments

Installing command line MP3 player

Mpg 123 Player

mpg123 is a real time MPEG 1.0/2.0/2.5 audio player for layers 1,2 and 3.

I was playing with Ruby scripts and needed a command line mp3 player which was not a resource hog.

Steps I took for my OS X (Should work on Linux/Unix box):

Download the latest version from the website.

Untar the archive

tar -xvf mpg123-1.4.3.tar

Compile and install the player

./configure --prefix=/usr/local/mpg123
make
make install

Add the path to .bash_profile

echo 'export PATH=/usr/local/mpg123/bin:$PATH' >> ~/.bash_profile

Load the new path

source ~/.bash_profile

Enjoy playing music from command-line!

 mpg123 ~/Music/Bagho_Bagh_Gippy_Grewal.mp3

June 28, 2008   2 Comments

Synchronizing Nokia 6086

I have a cranky old Nokia 6086. And I’m waiting for Android, just because of its open source license.

Love this phone(or more appropriately “used to love”), because it used to do task “rarest in its times”.

I could use any public WiFi hotspots (My Office and my home included) and route my calls through the internet, and costing me guess what – $0 (To be precise I paid $10 for TMobile@Home service.) So I could talk non-stop to all the hot chicks!! Lol!

However since yesterday it started to show signs of aging.

Long story short, I was searching for a synchronizer using bluetooth. Nokia only makes PC Suite. I have a Mac. And Mac has iSync which is not compatible with Nokia 6086.

6086-not-compatible

[Read more →]

June 15, 2008   No Comments