Archive for howto

Are you addicted yet?

// May 4th, 2009 // 4 Comments » // howto, open source

If you’ve been facebooking long enough you’ll probably are addicted to it by now. Be it updating your status oh so frequently, or playing games, or keep on refreshing your home page, or refreshing your own profile page (freak!), or simply stalking other people’s profiles, or if you’re new you’ll probably be crazy adding new friends now.

I’m one of those who likes the games there. I’m quite a powerful vampire there, among my friends that is. And ever since I found out they have Bejeweled on Facebook, I’ve been playing like crazy. Recently, quizzes have become quite a thing in there. I don’t really bother, coz some of them are just bogus or plain stupid. One example, there was a quiz testing on your arabic language. The questions were sooo easy kindergarten level like and of course I got all right (only 5 of them) and the result came out that I can speak and understand the language very well…. Excuse me?? Did NOT worth my time at all. From then on I only picked the ones I deem worthy of my brain power…. scam jek.

I think I update my status quite often, not that I’m so rajin to update it there myself. It’s because I use identi.ca – more preferred way of keeping up to date among my friends/colleagues. I get the updates in my Pidgin which is far more convenient than browsing my Facebook home page, although I sometimes check to read/reply comments. I’ve blogged before about posting to multiple sites using Pidgin – read it here. Using Pidgin also I can receive Facebook chats using some plugin, thanks to Indhran for his post here. This solves my problem on not noticing the message people send to me in there. I don’t even have to open the site and login. Coolness.

p/s: I miss my camera.

Quick tips on saving contacts on your mobile phone

// April 27th, 2009 // 2 Comments » // howto

This one only applies if you have ordinary phones, you know the ones that don’t have those advanced contacts feature. I’ve been doing it for a while now and I kinda like I can get the number to call pretty fast. It’s fairly easy.

Ok normally what you do when saving a contact, you’ll want to save the name and most of the time the reference point to differentiate some contacts who accidentally have the same name. People usually will save it in this format: eg. Siti Skali or Siti Putrajaya or Siti OSCC(these are different person, one working for Skali, one is my current housemate, one is working for OSCC).

Instead of that format, I use this:

Think about it. It’s ok if I remember the name so I can just scroll to S right? What happens if I can’t recall at all, the only thing I remember is the place where I met her? What’s the name of the one I met briefly at that so and so meeting?? Now I can just scroll to O and I can see all my OSCC contacts in a row.

I’ve found that using this format has a few benefits. Say your phone dies on you and all you have left is an old 5 years ago phone that’s still amazingly working. All contacts on your SIM card now such a pain to search without that advance search you’re quite used to now, doesn’t it. Also, using this way you reduce the headache of memorizing contact names. If you’re like me with some memory problem, I can’t be bothered to memorize everyone’s name lah (of people I only met briefly but felt I should have their numbers). My brain has so much other things to do than what my phone can do for me. And you get to see your contacts grouped (in a way) so oh it’s so easy to select multiple recipients. I get to know faster too if I haven’t had someone’s number yet from my workplace (for example).

See this method has been giving my brain a break for quite a number of times already. I’m spreading the goodness to you people! All I ask in return is free food and free petrol :P

Bash.org IRC quotes in terminal

// February 3rd, 2009 // No Comments » // howto, open source, programming

You know Bash.org right? The place where you can find funniest IRC quotes said by real people all over the world. So I just want to read a random quote everytime I fire up my terminal, to start my day, sort off. But yea if I’m so inclined, I can get it by ./getquote anytime too.

Some screenshots follows:

You get the idea right. Just that if I want to read another quote in terminal, I have to cd ~/<script folder> and ./getquote from there (I keep my scripts organized). I’m kinda lazy so I just Ctrl-Shift-T, Ctrl-Shift-W all the time. :p Works for me.

This is what I did. I have 2 main files:

  • ./import – this one is for importing the quotes all at once from any of their RSS feed provider. Then I use xmlstarlet to extract information I need and format it the way I want (so painlessly, I might add). and then save it as plain text file.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# retrieve quotes from bash.org and save it to bashquotes.xml
# -one of the RSS provider http://quotes.sydv.net/
echo "Retrieving from bash.org..."
wget -O bashquotes.xml http://feeds2.feedburner.com/top100-bash-quotes
 
# extract the feed to file bashquotes
echo "Extracting RSS feed..."
xmlstarlet sel -t -m '//item' -o '==%%==' -v 'description' -n  bashquotes.xml &gt; bashquotes
echo "RSS feed saved in bashquotes"
 
# replacing html entities to proper character for viewing
sed 's/\&amp;lt;/</g' bashquotes > bashquotes2
sed 's/\&amp;gt;/>/g' bashquotes2 > bashquotes
sed 's/\&lt;br \/\&gt;/\n/g' bashquotes > bashquotes2
sed 's/\&amp;quot;/"/g' bashquotes2 > bashquotes
sed 's/\&amp;nbsp;/ /g' bashquotes > bashquotes2
sed 's/\&lt;img.*\&gt;//g' bashquotes2 > bashquotes.txt
echo "bashquotes.txt ready"
  • ./getquote – this one is for reading off that text file and get any one from the quote.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
    # reading from bashquotes.txt
    old_IFS=$IFS
    IFS=$'==%%=='
    quotes=($(cat bashquotes.txt)) # array
    IFS=$old_IFS
 
    # form an array
    j=0
    for ((i=0; i < "${#quotes[@]}"; i++)); do 
       len=${#quotes[${i}]}
       if [ $len -ne 0 ]; then
          let j++
          newquotes[$j]=${quotes[${i}]}
       fi
    done
 
    # get a random quote
    RANGE=${#newquotes[@]}
    let RANGE++
    FLOOR=1
 
    number=0   #initialize
    while [ "$number" -lt $FLOOR ]
    do
      number=$RANDOM
      let "number %= $RANGE"  # Scales $number down within $RANGE.
    done
    echo "${newquotes[${number}]}"
  • To get it displayed in the terminal, I appended this in my ~/.bashrc
echo "";
echo "--irc quotes--"
cd /home/cawanpink/bash/quotes/
./getquote
echo -e "================================"
home

Simple right. This is the result of me  being blocked by an SVN server earlier on, that in a way has cut me off from doing any real work. Heh.

Now I know the code is not the most elegant, most of them are copy and paste and modified but all in all it’s worth my time coz the quotes are just freakin hilarious!

Note: my terminal is a modified version of this – I had wanted to post about it when I did it but too lazy now.

IM => Identi.ca + Twitter + Facebook

// November 12th, 2008 // 7 Comments » // howto

Like everyone else, I have so many places to update my so called status/what am I doing at the moment/my rants and raves. In my case, I have Identi.ca (open source version of Twitter) + Twitter (so many following me here) + Facebook (I have 100+ friends there) status to update. You have to admit, it’s hard to keep up these days.

I’ve found a way to update all 3 using any IM (I use Pidgin). The idea is you send your status via IM to update your Identi.ca, in turn this will update your Twitter and Facebook account. Obviously you need to have accounts on all of them. After all is done, follow these steps:

On Identi.ca

  • Go to Settings page -> IM tab. Enter your Jabber/Gtalk email address
  • Go to your preferred IM. Add update@identi.ca in your buddies list
  • You’ll receive a message to validate the email address you just entered belongs to you.
  • Click on the link provided to confirm it
  • Go to Settings page -> Twitter tab. Enter your Twitter username and password
  • Check the box ‘Automatically send my notices to Twitter’. Click ‘Add’.

On Facebook

  • Login and add Twitter application. Click on ‘Allow’.
  • Enter your Twitter username and password
  • It will bring you the app page. Click on ‘+ Allow Twitter to Update Your Facebook Status’
  • ‘Allow Status Updates from Twitter?’ -> click on ‘Allow Status Updates’

Now you’re all set. Whenever you want to update your status, send the message to update@identi.ca like you would to anyone in your buddies list.Technology rocks!