Thursday, September 23, 2010

how to swapping ctrl key and capslock key in console



% loadkeys /usr/share/keymaps/i386/qwerty/emacs2.kmap.gz

Tuesday, September 21, 2010

how to disable automatic captializing the first letter of sentences in OpenOffice.org

The automatic captilizing the first letter of every sentences is very annoying [for me][I believe many people still have good reasons to use it][but this is just for me].

You can disable it by going to Tools => AutoCorrect Options

Please see the screenshot:

Thursday, September 16, 2010

how to update facebook status via command line

Recently, I found a text-based twitter client named "twidge".  It allows me to tweet right from command line.  For example, if you want to do a hello world tweet, you run this:

% twidge update "hello world"

I then think it would be a good idea if I can do the same thing with facebook i.e. to update facebook status right from command line.  However, when I did search on google, I found nothing.

Well, actually, there is an indirect way by:
  1. Adding facebook application "Selective Tweet".
  2. With the same twitter account you use to add "Selective Tweet", whenever you append "#fb" to your tweet, that tweet will also appear on facebook status.
But for many personal reasons, I just dislike this method as the same thing will be put onto both twitter and facebook which is not always what I want.

So what if I want to do it directly...

Recently, I had a chance to try out the Perl module "WWW::Mechanize" - Handy web browsing in a Perl object.  It is a subclass of the well-known LWP::UserAgent module which is a User Agent module for Perl which we use to write robot, spider and such.

Here is the Perl script I use to update facebook status:

#!/usr/bin/perl

use WWW::Mechanize;

$mech = WWW::Mechanize->new;
$mech->agent_alias('Windows Mozilla');

$base_url = 'http://m.facebook.com';

# {{{ login
$mech->get($base_url);
$response = $mech->submit_form(
  fields => {
    email => 'your_email_address',
    pass => 'facebook_password'
  }
);
die $response->status_line unless $response->status_line;
# }}}
 
while (1) {
  print "What's on your mind? : ";
  $status = <STDIN>;
  $response = $mech->submit_form(
    fields => {
      status => $status
    }
  );
  die $response->status_line unless $response->status_line;
}

Here is what you will see when you run it:

unsigned_nerd@linuxsucks ~ % fbset
What's on your mind? : it's easier to update facebook status from command line

By the way, isn't it better if I use some Facebook API instead...?  Umm... maybe later.

Friday, September 10, 2010

how to set up crypted partition under Ubuntu 8.04 or Debian stable (5.0)

Install cryptsetup:

# apt-get install cryptsetup

Load 2 modules:

# modprobe dm-crypt 
# modprobe dm-mod

Use luks to format partition and map it to a device:

# luksformat -t ext3 /dev/sdb1
# cryptsetup luksOpen /dev/sdb1 crypteddisk


crypteddisk is a user defined name.  You can name it whatever you want.  It will be found under /dev/mapper.

I put this line in /etc/crypttab:

crypteddisk /dev/md0 none luks,noauto

I also put this line in /etc/fstab:

/dev/mapper/crypteddisk /data ext3 defaults,noauto 0 0 

Make sure you have /data/ directory and maybe prevent it to be used before being mounted by chattr +i /data.

Now you can mount your new encrypted partition by:

cryptdisk_start crypteddisk
mount /data


Note that I config fstab and crypttab in such a way that it won't automatically mount the encrypted partition at boot time.  You know why?  Thinking about when the machine you are working on is a server located in some data centre (no need to be so far away from your house).  If you set it to be auto mount, it will ask you to enter the LUKS passphrase at boot time which means you won't be able to ssh to the machine as it will just wait there forever until you enter the password lol

vimdiff - useful configuration

Say you want vimdiff to open in horizontal mode and also wrap long lines, you just put the below code into your .vimrc:

" for vimdiff
set diffopt+=horizontal
au FilterWritePre * if &diff | exe 'windo set wrap' | endif
" [end] for vimdiff

Wednesday, August 25, 2010

how to disable sshd authentication log

Platform:
  • grml 2010.04 Release Codename Grmlmonster [2010.04.29] (debian based)
I don't want the system to log when I ssh to it.  Normally, when I ssh to the server, there will be authentication logs get logged to:

/var/log/auth.log

Below is the sample logs when I logged on via ssh:

Aug 23 11:21:01 grmllinuxrocks sshd[18155]: pam_sm_authenticate: Called
Aug 23 11:21:01 grmllinuxrocks sshd[18155]: pam_sm_authenticate: username = [grml]
Aug 23 11:21:01 grmllinuxrocks sshd[18155]: Accepted password for grml from 192.168.1.139 port 1074 ssh2

which I want to get rid of.

In order to get rid of this authentication log, you have to edit this file:

/etc/rsyslog.conf

Open it and look for the lines:

auth,authpriv.*          /var/log/auth.log
*.*;auth,authpriv.none   -/var/log/syslog

And change them to:

auth,authpriv.*          /dev/null
*.*;auth,authpriv.none   -/dev/null

And that's it.  Enjoy your anonymity.

how to disable caching of squid

You can disable caching by adding these 2 lines below in your squid's configuration (/etc/squid/squid.conf):

cache deny all
cache_dir null /tmp

how to disable squid's logs

For the extreme anonymity, ones might also want to disable all the logs generated by squid.  Here is the easiest way I found to disable the logs.  In squid's configuration file which is, for my case:

/etc/squid/squid.conf

Replace
access_log /var/log/squid/access.log squid
with
access_log /dev/null squid

Replace
cache_log /var/log/squid/cache.log
with
cache_log /dev/null

Replace
cache_store_log /var/log/squid/store.log
with
cache_store_log /dev/null

"/dev/null" is a magic device file in unix.

Tuesday, August 24, 2010

dyndns and ddclient configuration under grml linux (or, probably, other debian based distros)

Dynamic DNS allows you to have domain name with your dynamic ip address assigned by your local ADSL Internet.  One thing you need to do is to set up a dynamic dns client in a machine inside your local network where it uses your local ADSL Internet.   Nowaday, many ADSL routers support dyndns.  However, I'd prefer setting it up on a linux machine instead as I will surely have full control over the system.  By default, the configuration (/etc/ddclient.conf) in grml 2010.04 looks like this:

# Configuration file for ddclient generated by debconf
#
# /etc/ddclient.conf

protocol=dyndns2
use=web, web=checkip.dyndns.com, web-skip='IP Address'
server=members.dyndns.org
login=
password=''

This is not enough for my case.

After I spent time through trail and error I found I have to edit file /etc/default/ddclient:


set daemon_interval="60"

And in file /etc/ddclient.conf

# Configuration file for ddclient generated by debconf
#
# /etc/ddclient.conf

protocol=dyndns2
use=web, web=checkip.dyndns.com, web-skip='IP Address',
server=members.dyndns.org
login=your_username,
password='your_password',

yourpreferreddomainname.dyndns.org

The most important thing is that you have to provide your domain names on the last line which will get updated.  Note that I tried setting daemon_interval in /etc/ddclient.conf but it didn't work so I instead set it in /etc/default/ddclient.

I am sure there must be other settings that work too.  But I will just stick with this approach.

Saturday, August 14, 2010

programmers' tools for files and directories comparison

In Linux, I use dirdiff to compare directories and I use vimdiff to compare files.

How To Resize ext3 Partitions Without Losing Data in Linux

I had a single unencrypted partition.  I wanted to have an encrypted partition so I had to shrink my existing partition first.  Then, created a new partition and encrypt it using cryptdisk.  Thanks to HOWTOFOURGE.  Please check it out.  The author does his best job writing such a good HOWTO:

http://www.howtoforge.com/linux_resizing_ext3_partitions

Friday, August 13, 2010

how to sync ftp directory with a local directory in linux [part 2]

I did some more research and found out that lftp can accomplish my requirement!

All you have to do is to pass the following options to lftp : "-c -e"

Here is an example.  I have a file ~/main.conf:

open ftp.somehost.com
user someuser@somehost.com somepassword
set ftp:ssl-allow no
mirror -c -e
exit

I also have another shell script to call lftp with proper configuration, lftp-mirror.sh:

#!/bin/zsh

cd ~/projects/somehost-ftpdir
lftp -f ~/main.conf

I then call lftp-mirror.sh everytime I want to sync my local directory with the ftp server.

Please see previous blog post:

how to sync ftp directory with a local directory in linux [part 1]


monitor brightness adjustment in linux

Platform which I tested on:
  • grml 2009.10 Release Codename Hello-Wien [2009-10-31]
  • Debian GNU/Linux squeeze/sid
  • Lenovo laptop G460
There is a file:

/proc/acpi/video/VGA/LCD/brightness

If you cat it, you will see something like:

levels:  0 10 20 30 40 50 60 70 80 90 100
current: 70

Assuming you want to change your monitor brightness to 60, you can do this (as root) by:

# echo "60" > /proc/acpi/video/VGA/LCD/brightness

And today is Friday the 13th, make sure you brighten your monitor!

Thursday, August 5, 2010

recording any audio from your macosx

Ladies and gentlemen, I give you WIRETAP !!!

I bold it.  I italicise it.  And I even underline it.

The best tool ever to record any audio that can play on your MacOSX machine.  What I feel is that it just records directly from some  very low-level device or device driver I have no idea.  It's just amazing.  Go Get It Now!!!  And start recording everything!!!

Wednesday, August 4, 2010

screen title and vim (a.k.a. vi)

I use "screen" everyday whether I am on Grml Linux or MacOSX.  And also every time I log on to any unix servers, I have to run screen too as it is the best way to keep my sessions safely whenever there is Internet connection disruption.

Normally, when I do coding, I run multiple vim s under screen like this:



The blue status line comes from a setting in my .screenrc :

hardstatus on
hardstatus alwayslastline
hardstatus string "%{.bW}%-w%{.rW}%n %t%{-}%+w %=%{..G} %H %{..Y} %m/%d %C%a "

As you may notice, all the title of each screen are just the same "vi" even though I ran:
  • [screen 0] vi a
  • [screen 1] vi b
  • [screen 2] vi c
Therefore, I have no idea which file it is unless I switch to that screen which can be cumbersome most of the time.

Luckily, vi can send some special status to shell and screen to display a customized title.  All you need to do is to add these lines in your .vimrc file:

let &titlestring = "vi(" . expand("%:t") . ")"
if &term == "screen"
  set t_ts=^[k
  set t_fs=^[\
endif
if &term == "screen" || &term == "xterm"
  set title
endif

Note that the "^[k]" and "^[\" are control characters which you have to enter them by (in vim):
  • [in edit mode] ctrl+v => esc => k
  • [in edit mode] ctrl+v => esc => \
After that you re-run screen and use vi to open files and it should look like this:



Notice the vi(a), vi(b) and vi(c) - Now they display which file names they are opening!

references:

Sunday, August 1, 2010

using bridge mode networking for guest operating system with VirtualBox

environments
I installed virtualbox by adding this line to apt's source.list file in grml:

deb http://download.virtualbox.org/virtualbox/debian lenny non-free

Then I executed "au" (au is an alias for apt-get update in grml), followed by "agi virtualbox-3.2" (agi is an alias for apt-get install in grml).  Then I could run virtualbox for the first time by calling "VirtualBox" from shell.  I then installed Windows XP and everything went smoothly.  The default of guest os's networking type is NAT mode.  However, I wanted to use bridged mode as I think it will be fair for my guest os to co-exist in the same  LAN as other computers.  I then told VirtualBox I wanted to use bridge mode networking which was when it printed out some error message which I couldn't remember.

Anyway, after some researching I found out that after a fresh installation of everything, I also needed to install "dkms" package by:

# agi dkms

Then I restarted VirtualBox and I now can use bridge mode networking with the Guest OS under VirtualBox.

captcha killer

Even though captcha was originally designed to serve purpose of preventing malicious users or robots to submit html form,  there are (and always are) still people who need to kill it.  There are many different algorithms to read captcha and returns them as text.  Either direct purpose captcha killer or ocr (such as gocr under GNU/Linux) can be used to solve the same problem which depends on kinds of captcha we are dealing with at hand.  Each algorithm will have different limitations.

However, while I was searching on google about this topic, I found an interesting service by a Chinese-based company:

http://imagetotext.com/

I like their idea.  I guess they set up a call centre-like office where their staffs sit in front of computers and type whatever they see on the screens.  They should develop some kind of libraries which will send all captcha to their office which are when they are being translated by HUMAN and returned back to the caller function.  This way, I believe there is no captcha on earth that they can't solve!

It is a paid service of course.  Consult them when you really need to kill severely difficult captcha such as hotmail's.

Saturday, July 31, 2010

https certificate expired and chrome does not like it (by default)

Don't get me wrong.  I don't like Google Chrome personally even though I use it.  See? Hating does not mean you cannot live with it.  Right now, I have to run both Firefox and Google Chrome on the same machine as I don't know yet other way around to separate sessions / cookies of the same website on different tabs.  One thing I need, for example, is to access 2 gmail accounts at the same time (and I just want to do it through web-based only but not pop3/imap).

Today I wanted to sign up for a hotmail email as I needed a dummy email for testing purpose (I won't use hotmail for my personal emails anyway).  I used Google Chrome, went to www.hotmail.com, clicked "sign-up", and then I got this red alert page:




live.com's SSL has expired!? ... I wouldn't expect such a big company like Microsoft to make this kind of mistake unless it was by intention.

By default, Google Chrome does not allow us to access website under https with an expired certificate.  Unlike Firefox where on the same alert page, it gives us a confirm button to click which will allow us to access that suspicious web page.

Anyway, it is not difficult at all to change the default behavior just by going to this dialogue of Chrome:




And make sure you uncheck the "Check for server certificate revocation":




After that, you have to refresh that https web page and Google Chrome will allow you to access the web page under https with expired ssl certificate.

Friday, July 30, 2010

lftp error "Delaying before reconnect"

lftp is a well-known ftp client.  I use it with both MacOSX and Grml Linux.

Few days ago I had to download all files from a virtual host directory which resides in a shared hosting environment.  A bad thing about using these cheap shared hostings is that it provides us ftp to be the only mean of file transferring which sucks.  (When possible, I would rather go with sftp, rsync or fully shell access where there are a whole bunch of other fancy ways to choose from.)

I searched on Google to find any alternative ways (other than lftp) to sync files from ftp site to my local directory instead of having to download the whole files again and again which is too expensive.  (By synchronizing I mean to fetch only newer or modified files on the next synchronizations.) (which lftp's man page does not state precisely whether it can do it or not so I assume it can't.) Unfortunately, I couldn't find an OpenSource one for Linux.  I could see only proprietary softwares for both Windows and Linux.  If anyone can suggest me for Linux, please do.  I know WinSCP for Windows is free-to-use and supports synchronization but I need one for Linux.

OK.  So it seemed I had no other choices.  I had to go with lftp to download the whole files to my local disk then.

As usual, I logged on to the ftp server with lftp, switched to the directory I wanted (in my case it was public_html/), then issued "mirror" command.  Unfortunately, I got this error:

[Delaying before reconnect: 57]  

I then pressed ctrl+c and tried "ls" and this is what I got: 

[lftp 4.0.2] someuser@somehost ~ % ls
`ls' at 0 [Delaying before reconnect: 57]  

I was like #wtf (oops!).  I then turned debugging mode of lftp on.  With the error message I got from running lftp in debugging mode, I then found out (from Google) that if I ran into that mysterious problem, I should try:

set ftp:ssl-allow no

And it just worked....!  Now I can use both mirror and ls and assumably everything... ha ha

Note that as I am just a lazy nerd so I didn't go further to find out why we need to unset that ssl-allow property : P  I would greatly appreciate if anyone can tell me why : )

Recommended Softwares

Tuesday, July 27, 2010

how to modify svn log

It is universally a best practice for everyone who uses Subversion (svn) (or any other source version control system) to enter very detailed log for each svn commit.  If for any reasons you disagree with what I just said, please think about situations when you work on a project with 5 or 6 people (or more) and you encounter some mysterious bugs.  What will happen, for a worst case scenario, is when you ask everyone around who has worked on these files.  (It is so easy to get a name list from svn log.)  Alas, no one can remember what he/she has done.  They all know their names are there however they just really forget about it... and this just sucks (given that it really happens too often).  Idealistically, I would say a good enough log has to be able to help a single person to see just the logs and result from "svn diff" and then they can understand what happened, why it happened and how it happened without consulting other people.  Anyway... let's get back to the topic...

Some times we forget to put some useful info into the log for some svn commits.  Or maybe we find additional info that we think it will be worth adding them into the logs of some older revisions.  Good news, we can accomplish that with not much effort.  Though, It is not enabled by default, we only have to enable it.

Assuming your svn repository is in:

/svnrepo/

You should see a file there:

/svnrepo/hooks/pre-revprop-change.tmpl

All you have to do is to rename it like this (remove the .tmpl):

$ mv pre-revprop-change.tmpl pre-revprop-change

Then, you have to grant execute permission to it like this:

$ chmod +x pre-revprop-change

After that you can modify already committed svn log by, for example:

$ svn propedit --revprop -r 11 svn:log file:///svnrepo/

Assuming you want to edit svn log at revision 11.

references

how to adjust font in an existing pdf file to fit my sony prs-505 digital reader (a.k.a. e-book reader)

I own a digital reader sony prs-505 (red colour model) bought around 2 years ago from sonystyle.ca.  It is so cruel that even now they still don't sell it in Thailand (or even with Thai ip address).

As with any other digital readers, its screen resolution and size are different and much smaller than ordinary monitors (for computer desktop or laptop).  For my prs-505, it is 175x122x8 mm (6.9" x 4.8" x 0.3") with 600x800 pixels. (source : wikipedia.org)

With these differences, any pdf files that are not generated specifically for prs-505 contain risk of being blurred and consequently impractical for reading.  However, not only the screen size and resolution that matter but also the font being used in pdf file.  One might argue that pdf is a vector format where we can zoom in and out without losing its sharpness.  I completely agree and understand that but, however, prs-505 comes with only 3 levels of zooming which are small, medium and large.  With just these 3 levels, we can't expect prs-505 to be able read all pdf files properly without extra works.

Usually, I use Calibre to collect rss feeds and convert them into epub format which is a format that works on prs-505.  There are lots of predefined news feeds come with Calibre such as bbc, cnn, telegraphs, reader digest, etc.  A good thing about choosing news from the predefined list is that Calibre knows it well so it fetches the data and formats them very properly for prs-505 which is a known target device to Calibre.  As such, I have nothing to concern about reading news with my digital reader.

However, just recently, I ran into a problem when I tried to read a technical textbook downloaded from some website.  It was in pdf format.  Unfortunately, its font and sizes didn't fit prs-505 as you can see from the picture below (notice that the font colour is too light which causes problem to my eyes):



The page layout / size looked perfect while the font didn't.  All texts were blurred.  They become clearer when I zoomed in it but the large zoom level was too big which just broke the page layout and everything.

I decided I had to make some changes to this pdf file.  There were several approaches I tried:
  1. Using Calibre's GUI to convert the imported pdf file into epub by telling it to change font size to be 12pt, 14pt and 16pt.  In the output, the text's font size was really increased which was good.  But, a bigger problem arose.  For some unknown reason, whenever I changed the base font size via Calibre's GUI, each sentence was divided into separate line which made the entire page looked truly ugly.  This method does not work.
  2. Using Adobe Acrobat Professional to change font of existing pdf.  With Touch Up Text Tool, I was able to change font of the pdf to be Tahoma, for example.  I tried it with a paragraph and it just worked.  It looked great on prs-505.  But, alas, there was no way I could change the font of the entire pdf document.  This is just ludicrous.  It is impossible for me to go through page by page to do that.  Failed again.
  3. Using tools to convert pdf into various formats such as plain text, html, png, rtf, ps (postscript), odt, doc, etc... None of them worked.  Each of them yielded different slight problems when it was used with my prs-505.  Some examples are too big of size file, images distorted, wrong font, wrong paragraphs layout, etc.  It just does not work.
  4. Surprisingly, I decided to get back to Calibre.   For some unknown reason, I tried command-line version of Calibre instead of the GUI using the almost exact same option I chose when I used GUI version:

    $ ebook-convert some_file.pdf some_file.epub --base-font-size 14

    Then I transfered this epub file to my prs-505 and the output looked a lot better as you may notice:




    You will also notice some slight bug such as the second paragraph that is combined into the first paragraph.  Hence, it is not a perfect method yet.  I will just have to live with it meanwhile.

     More details of how to use Calibre's command-line tool to convert books can be found here:

    http://calibre-ebook.com/user_manual/cli/ebook-convert.html#ebook-convert

    Isn't it funny that GUI version and command-line version of Calibre yield different result?  I can only guess that it maybe because the GUI somehow has more options than just "--base-font-size" that I am unaware of!

    Monday, July 26, 2010

    external harddisk access error in macosx

    I have a 1TB external harddisk connected to my MacMini via USB port.  I used it for:
    • Back up with Apple's TimeMachine
    • Back up other data
    • Store movies and softwares
    Just today when I turned my machine on there was no disk icon shown in either Finder or Desktop.  I went to Disk Utility (a gui disk management for MacOSX) where I could still see my external harddisk listed.  I was so sure something really went wrong.

    In Disk Utility, I tried clicking both Verify Disk button and Repair Disk button.  None of them worked as you can see from the screenshot:


    This is frightening.  I then went to shell in Terminal and tried fsck like this:

    $ fsck_hfs  /dev/disk1s2

    And here is what I got:

    ** /dev/rdisk1s2 
    ** Checking Journaled HFS Plus volume.
    ** Detected a case-sensitive catalog.
       Invalid node structure
    (4, 0)
       Invalid B-tree node size
    (4, 0)
       Invalid node structure
    (4, 0)
       Invalid B-tree node size
    (4, 0)
    ** Volume check failed.

    (Note that I knew it was /dev/disk1s2 from the command "diskutil list".)

    The error message looks the same as what I got from Disk Utility.  I found later that Disk Utility's Repair Disk button made use of fsck which is why it yielded the same result.

    I also tried attaching the harddisk with my Grml Linux laptop and mounted it as hfsplus.  I could see all the files there (and of course, I can access all files and even copy them to anywhere else so my ass is still safe).  Though, fsck.hfsplus in Linux did not work either.

    After spending time researching about this issue, I can conclude that:
    • This is a rare case (assuming my harddisk is still in a good condition as I just recently bought it).
    • fsck is not the right tool to fix this special case.
    • All lead me to use Disk Warrior to fix the problem in my harddisk.  People claim it knows hfsplus file system more than fsck_hfs.
    And it just worked!  Here are the steps it took:
    1. Open Disk Warrior
    2. Under Directory tab, choose your external harddisk device in a drop down list
    3. Click Rebuild and wait for a long while depends on how much damage and how large your harddisk is
    4. Once it's done, it will popup a report telling us what kinds of damages it detects and etc.  All we have to do is to click Replace button and wait for another while
    5. And that's it!
    Good luck, everyone : )

    Sunday, July 25, 2010

    how to sync ftp directory with a local directory in linux [part 1]

    Surprisingly, I could not find a (free and opensource) tool in Linux that states precisely in their manuals that they support syncing directory in ftp with a local directory in my computer.

    That I said "syncing" I mean it will only fetch the changes from the last sync into my local directory only instead of re-downloading the whole thing again which can be cumbersome.

    That I said "ftp", yes, I really mean the retarded ftp which I am always against it.  If I could, I would never use ftp.  As you may already guess, I have to use it as I have no choice.  The company I work with subscribe to several shared web hostings which usually come with retarded ftp server as the only mean to transfer files between our local computer and the servers which just totally SUCKS.

    The first thing came up to my mind was,  of course, rsync - but the problem is that it does not support ftp.

    The second thought was to use "mirror" command of lftp.  However, the manual page does not say exactly whether or not it does "sync".  I have a hunch that it can only downloads new files but can't keep the local directory in sync with what are on the ftp server.  So this does not work either.

    The third idea is what I chose.  Though, later I found that there were problems due to low quality of local ADSL Internet connection and etc which made it difficult to download directory that had many subdirectories and lots of small files.  Anyway, I suppose if your Internet quality is not bad, this can be a good try.

    The idea is to use curlftpfs to mount a directory in an ftp server to a local directory in your harddisk.  Now that you can access files (in ftp) as if they were your local files, you can choose any of your favourite backup tools to sync files in ftp and your local directory.  I use rdiff-backup to create versions of files in ftp in my local harddisk.

    See part 2 where I figured out how to sync ftp directory via lftp:

    how to sync ftp directory with a local directory in linux [part 2]

      

    Original Nokia N97 Wall Charger is on sale in eBay



    view it in eBay!


    Some history


    I bought Nokia N97 last year.  All the accessories are with my friend abroad for some reason except this wall charger (and a stylus which I will sell it too later) .  I just don't know what to do with it so I decide to sell it on eBay.

    Other details

    It was rarely used as I had a situation where I forgot to bring the charger and I decided to buy a new charger being an impatient person.  Therefore, it is in a perfect condition.


    Specifications

    NOKIA AC-10U
    INPUT: 100-240V~/50-60Hz/160mA/16VA
    OUTPUT: 5.0V/1200mA
    MADE IN CHINA B

    Thursday, July 22, 2010

    Surfing websites anonymously with Tor

    I completely don't understand why my government (in Thailand) has to invest a considerable amount of money on blocking undesirable websites.  As per my clear technical knowledge, it is impossible to do such thing.  Even within The Great Firewall of China, anyone who want to enjoy their activities on the Internet freely can, at least, subscribe to a pretty cheap and affordable VPN service from any providers outside China and then route their traffics through the VPN gateway instead and live a happier life since.

    I'd like to introduce you of how to browse websites anonymously (which also bypasses the Internet Censorship somehow) through a well-known proxy system, Tor.

    Regardless of how complexity Tor is which you will never really have to concern and if you run Grml Linux, you are coming to a right way.  The set up is very easy as follow:
    • grml_2009.10 (Hello-Wien) - I'd assume for any newer versions of grml, it should be relatively easy still
    • # agi tor
    • # /etc/init.d/privoxy start
    • # /etc/init.d/tor start
    • Install Torbutton for Firefox
    Now when you want to browse website anonymously via Tor, you can just click at the Torbutton on the bottom-right corner of Firefox (just make sure privoxy daemon and tor daemon are up and  running).

    Thursday, July 15, 2010

    fring complained about skype



    QUOTE

    Needless to say, we are very disappointed that Skype is now trying to muzzle competition, even at the expense of its own users.

    apple bluetooth keyboard model no: a1255

    I got this second hand keyboard from a good friend at very cheap price.  It requires 3 AA-size battery.  On the first week. I was really shocked to see that its battery level went down so fast like around 5% to 10% everyday.  I thought this keyboard might be damaged or something.  However, after the battery level reached like 60%, it then started dropping very slow.  I think after 2 months, it is now still left 36% which is amazing!

    Tuesday, July 13, 2010

    how to use unicode font with palringo for linux (wine)

    Palringo is a chat application that is famous for its mobile phone support.  I have heard it is an application that somehow tries to help non-BB users to fulfil the need for BBM-like application which is only for BlackBerry users.  To name a few of such prominent features:
    • ability to send voice clips
    • ability to do group chats (via chat rooms)
    It also supports other basic functionalities such as:
    • text chatting
    • sharing photos
    • supporting of various chat protocols e.g. palringo (default), msn, google talk, icq, facebook (jabber), and etc
    Desktop platforms that it supports are WIndows, MacOSX and Linux (wine).  Mobile platforms that it supports are Android, BlackBerry, iPhone, Symbian and WIndows Mobile.

    For Windows version and MacOSX version, they run natively on the operation systems.  But for Linux, which has a third-class support from Palringo, we have to run it on wine.  wine is a cool application / platform that lets us run a number of Windows-based applications on Linux.  I don't have enough experience with wine to tell you pros and cons about it.  However, I can notice that some times it can be sluggish.

    Now, let's come back to the topic of this post.  I have no idea which fonts are pre-installed with wine and Palringo (wine version).  But it does not support, at least, Thai characters by default.  All Thai characters I typed or received were displayed as squares.  I did some research on Google and found that Palringo (wine version) uses Tahoma font by default.  However, the Tahoma font come with Palringo installation does not support unicode character.  (Again, I don't have knowledge about fonts so I can't actually confirm this.)  In order to make it works, basically, I needed to copy Tahoma fonts from Windows which are:
    • tahomabd.TTF
    • TAHOMA.TTF
    which can be found in (WIndows) c:\windows\fonts\ directory, and paste them in (Linux):

    /home/unsigned_nerd/.wine/drive_c/windows/Fonts/

    After that I restarted Palringo and it just works.

    Sunday, July 4, 2010

    web based chart builder

    There were times when I needed to write flow charts or (computer) network diagrams.  Usually, people would just expect me to use Microsoft Visio and I just wouldn't disagree with that expectation.  In fact, even though I prefer Linux and I am fed up with anything Microsoft already, I still  like Microsoft Office per se.

    There was a day when I had to create a (computer) network diagram of my office.  Normally, I had Windows operating system installed on a virtualization but unfortunately it was already gone due to a harddisk failure which I hadn't been able to install it again due to my problematic old machine which for some reason would crash if I tried to read/write harddisk too  much which was the case when I wanted to install Windows on a virtualization so .... I didn't have Windows at the time.

    Luckily, I found a good web application (a Flash application):

    My Lovely Charts
    my.lovelycharts.com

    It's free as in beer.  It's easy to use.  I could export it into either png format or jpg format.  I could do everything with the free version.  The only features with the paid version that concerns me are:
    You may find more ... but as I said the free version is good enough (at least for me).

    Tuesday, June 29, 2010

    how to get perl module version

    An easy way to do it is to use cpan:

    $ cpan -D module_name

    For example:

    $ cpan -D HTML::Template::Extension

    Sunday, June 27, 2010

    debian repository

    I can't remember since when that default debian repository became:

    http://cdn.debian.net/debian/

    For example (from grml_2009.10):

    /etc/apt/sources.list.d/debian.list

    deb     http://cdn.debian.net/debian/ sid main contrib non-free
    deb-src http://cdn.debian.net/debian/ sid main contrib non-free

    This "cdn.debian.net" seems to be a kind of load balanced servers.  Theoretically, it should be good.  But, not for me.  I don't really know why I always have problem with "cdn.debian.net".  Maybe, my dns servers are not good?  I tried with my local ISP's dns servers, Google Public DNS servers and OpenDNS.  All of them have the same "not found" problem.

    Anyway, I just always change it to:

    ftp://ftp.debian.org/debian/

    instead so my debian.list becomes:

    deb     ftp://ftp.debian.org/debian unstable main contrib non-free
    deb-src ftp://ftp.debian.org/debian unstable main contrib non-free

    and all the "not found" problems are gone!

    checking information on battery status

    On your notebook computer, you can use:

    acpitool

    to check the status of the battery.  And here is a sample result:

    unsigned_nerd@vaiosucks ~ % acpitool
    Battery #1     : discharging, 99.82%, 03:20:37
    AC adapter     : off-line
    Thermal zone 1 : ok, 51 C

    It seems there are many other useful functionalities which I will consult its manpage for more options to play with my vaio.

    how to use our custom dns servers with dhcp

    You know when you use dhcp and some times by default it receives dns servers from dhcp server which override what you want.  An easy way to overcome this is to add the line below into /etc/dhcp3/dhclient.conf:

    prepend domain-name-servers 8.8.8.8, 8.8.4.4;

    This will prepend your favourite domain nameservers first before the ones from dhcp server.  (8.8.8.8 and 8.8.4.4 are Google's public dnd servers which I use as an example.)

    Tested on Grml 2009.10 (Debian based).

    Saturday, June 26, 2010

    search for music using your voice by singing or humming

    http://www.midomi.com/

    I successfully searched for "how do i live" with my voice but it was like 3rd attempt as my English speaking skill is below average.

    My purpose was actually to search for "Guantanamera".  I couldn't find it from googling as I thought it was "guan-ga-ta-me-ra".  I tried midomi with my voice and failed all the time too.

    Finally, I found a trick by opening the music with speaker and I pointed the microphone to it.  Yes, it worked!

    Friday, June 25, 2010

    grayscale monitor in macosx

    I had been looking for a way to have an e-ink-like monitor that I can use with my computer.  The closest technology I had found was iLiad, an e-book reader which is well-known for its openness for hacking.  Of course, it is a linux-based. People have been able to run x window, xclock and etc on it together with using keyboard remotely.  Yes, it looked promising.

    However, just today, I happened to find out Pixel Qi's hybrid monitor!  You can search it from Google.  There are many stories about it.  Rumour has it that this special monitor will be shipped around September to December this year (2010).  What is cool about its monitor?  It is the same quality as e-ink!  Its refresh rate is a lot higher than those e-ink out there like Amazon kindle or Sony Digital Reader that I am using.  It even supports colour (still e-ink!).

    I will buy it for sure.  But, meanwhile, I have also found a way to turn everything on my screen to be grayscale by going to:
    • System Preferences
    • Universal Access
    • Display
    references

    Tuesday, June 22, 2010

    how to eject an iPod under Linux

    Just say it in short:

    You need to send an ALLOW_MEDIUM_REMOVAL to the usb device.
    The easiest way is with eject.
    references:

    % ps auxww

    "% ps auxww" is what we should use to list all processes (for unlimited width)

    Notice we specify "w" twice.

    Sunday, June 20, 2010

    firefox custom search

    Today I wanted to add a custom search to my Firefox.  It is the search box on the top right corner of Firefox.  By default, I saw:
    • Google
    • Yahoo
    • Amazon
    • ...
    But what I wanted is urbandictionary.com.  It's so easy to add a custom search in Firefox.  I opened Terminal, login as root, then:

    vi /Applications/Firefox.app/Contents/MacOS/searchplugins/urbandictionary.src

    I then entered xml code below:

    <search
      name="urbandictionary"
      method="GET"
      action="http://www.urbandictionary.com/define.php"
      queryCharset="utf-8">

      <input name="term" user />
    </search>

    I tested it with MacOSX.  An example here is urbandictionary.com.

    Thursday, June 10, 2010

    How to hibernate a mac

    With new mac (current year is 2010), we can hibernate our macintosh computers by manipulating power management settings via this command:


    $ sudo pmset hibernatemode 1

    Then, the next time you "sleep" your mac, it will hibernate instead.  Make sure you wait until the white LED turns off which is when you can unplug the power cord.

    I can confirm that this method works with MacBook Pro and MacMini (current year is 2010).

    Note that this is not a hack as "pmset" is an official tool which you can read its manpage on your system via:

    $ man pmset

    You only need to set this property just one time and it will be set forever until you set it to something else later.

    For those who hates UNIX's way of doing things for some reason (even though you are running MacOSX which is a UNIX system), you can try this:


    And get a D from me.

    Thursday, June 3, 2010

    tircd - url shortening

    In tricd, a cool twitter client, if you want to use the url shortening feature, you need to make sure you have Perl module:

      URI::Find

    One possible way to install this Perl module is by:

      perl -MCPAN -e 'install URI::Find'

    This module is used by tircd to parse URLs from our tweets.

    Monday, May 24, 2010

    how to get table create script in oracle

    SQL> SET LONG 9999999
    SQL> SELECT DBMS_METADATA.GET_DDL('TABLE','TEST') FROM DUAL;

    Monday, May 3, 2010

    chat command with skype

    On a conversation window, you should try:

    /help

    And you will see a help like this:

    [11:49:39 PM] System: Available commands:
     /me [text]
     /topic [text]
     /add [skypename]
     /history
     /find [text]
     /fa or /
     /alertson [text]
     /alertsoff
     /call [skypename] ..
     /leave
     /goadmin
     /get creator
     /get role
     /whois [skypename]
     /setrole [skypename] MASTER|HELPER|USER|LISTENER
     /kick [skypename]
     /kickban [skypename]
     /get uri
     /get guidelines
     /get xguidelines
     /set guidelines [text]
     /get options
     /set options [[+|-]flag] ..
     /setpassword [password] [password hint]
     /clearpassword
     /get password_hint
     /get banlist
     /get allowlist
     /set banlist [[+|-]mask] ..
     /set allowlist [[+|-]mask] ..
     /help

    Fun?  Hehehhe.  Many commands just like IRC

    cannot install audacity with error about pdns (powerdns)

    For some reason, the script to install audacity in debian has to be able to stop pdns successfully... (I know this is weird).  So, what you need to do is to start it first by:

    # /etc/init.d/pdns_recursor start
    # apt-get install audacity

    converting .mp4 to mp3

    $ mplayer -ao pcm in.mp4 -ao pcm:file="out.wav"
    $ lame out.wav

    Sunday, April 11, 2010

    factory reset nokia e72

    *#7370#

    default password: 1234 

    e72, Mail for Exchange with no ssl

    In Nokia E72, if you want to use Mail for Exchange without ssl, you also have to change port number from port 443 to 80, manually.

    Saturday, March 13, 2010

    How To Sync Your Contacts with Google Contacts via SyncML

    Sync profile name: Google Sync
    Server version: 1.2
    Server ID: Google
    Host address: https://m.google.com/syncml
    Port: 443
    User name: _@gmail.com

    Contacts database: contacts

    Thursday, March 4, 2010

    Monday, March 1, 2010

    Today, AIS EDGE has problem with Nokia Messaging Email

    Since last night, Nokia Messaging running on an N97 has got connection problem to the email server. The problem still exists until now at 0626PM EST.

    Sunday, February 28, 2010

    Saturday, February 27, 2010

    Bomb at Silom Road

    Bangkok Bank, main office, Silom road, Bangkok, Thailand 1000pm
    Retarded red shirt people is using bombs to destroy a bank to show their illegal power.

    Yeah, they are so powerful.

    Never Sign Up For My Nokia - Free News via SMS. It will just charge you at least 3 Baht per month for some stupid news.

    i have nothing to comment further about this

    Sunday, January 31, 2010

    How to back up sms in Nokia phone on MacOSX

    It's BluePhoneElite 2. You can search for it on google.
    It comes with other useful functionalities too. Check it out!

    Sunday, January 24, 2010

    sony digital reader and macosx

    In September 2008, I bought a Sony Digital Reader PRS-505, the latest version of Digital Reader from Sony at the time. It cost me around CAD$ 299 + (expensive canadian's) tax + shipping fee. I used it for a few weeks and then I stop. Yeah, I was just a lazy guy.

    Regardless of my laziness, anyway, now I am getting back to it again. A bad thing about Sony is that they don't support any operating systems other than Windows. I am talking about software to manage my sony digital reader. But at least, there are some people working on this and give it away for free (to use? or free as in freedom? dunno...). There are 2 most interesting ones I have found:
    1. docudesk
    2. calibre
    I read the review of the first one which is docudesk and think that it will not work for me. And, more importantly, it crashed when I invoked it all the time...???. So I choose calibre with the main reason, it supports RSS feeds. This means I can download articles from RSS feeds and read it from my digital reader. YAY!

    Wednesday, January 20, 2010

    How to install flash plugin in linux

    Manually install it for your own account. Go to adobe.com to download the tar ball version of flash plugin. Unpack it and you will get libflashplayer.so file. Now create "plugins" directory inside "~/.mozilla". Then, copy that .so file to plugins/ and restart firefox!

    Sunday, January 17, 2010

    2 separated email accounts

    Now I have 2 email accounts. One is gmail.com and another one is ovi.vom.
    The gmail one is for everything which consists of:

    • notification emails from any website I subscribe to such as facebook, google calendar, forum post
    • newsletter
    • password recovery
    • non human sent emails
    • mailing list
    • some human sent emails which I don't tell them yet about my ovi mail

    The ovi one is just for emails that I use to talk with friends in such a way that when I look at my INBOX, I will feel like it is like SMS or a chat log. Simply said ovi is for emails from human who intends to talk with me.

    What do you think about this approach?

    Saturday, January 16, 2010

    grml 2009.10 - hello-wien has been installed on my work machine

    Yay... Finally, the new version has been installed. Now, I can install Google Chrome at ease, Firefox runs even faster and etc. No more libgif / libungif conflict.

    However, VirtualBox OSE still does not work. After the fresh installation of hello-wien, I then used apt-get to install virtualbox-ose from the default repository... but it didn't work. Problem is still about vboxdrv, kernel module.

    I then uninstalled it and went to www.virtualbox.org to get the software from its debian repository. And it works!

    Thursday, January 14, 2010

    Wednesday, January 13, 2010

    Thailand EDGE Issue - AIS vs TrueMove - Nokia Messaging

    Jan 13, 2010
    If you use EDGE from AIS, you can't use Nokia Messaging for Email (email.nokia.com). You won't see a problem if you use EDGE from TrueMove. However, EDGE from TrueMove is very slow compare to the same service from other companies.

    Sunday, January 10, 2010

    how to check your symbian version

    Symbian Series 60 3.0
    Symbian Series 60 3.0. Examples: Nokia E61, N73, N80.
    Symbian Series 60 3.1
    Symbian Series 60 3.1. Examples: Nokia E71, E75, E90, N95.
    Symbian Series 60 3.2
    Symbian Series 60 3.2. Examples: Nokia N78, N96.
    Symbian Series 60 5.0
    Symbian Series 60 5.0. Examples: Nokia 5800, N97.

    windows 7 remote desktop server does not work

    A week ago, my Windows XP running under VirtualBox crashed. I decided to install Windows 7 due to some office purchased licenses that I can't use Windows XP anymore for the new installation. Windows 7 is so slow... just like Windows Vista. But more importantly, when I am over VPN connection to the office and I connect with Remote Desktop from my linux to this Windows 7, it is fucking slow. Slow like a
    turtle. It does not work. When I used this rdp with Windows XP, it was working fine. NOT this slow. Fuck off... oIIo

    Saturday, January 2, 2010

    grml 2009.10

    Few days ago I did a fresh installation of grml 2009.10 (hello-wien)
    on my 8GB usb drive. I could notice significant amount of speed
    faster than grml 2008.11 on the same usb drive running on the
    same lenovo desktop with a specific specification.
    Moreover, firefox comes by default with 2009.10 is awesome.
    It works faster than ever though I believe it still eats lots of my
    RAM. At least, it's faster. Plus the existence of vimperator, I can't
    switch to google chrome yet. Using firefox without mouse... that's
    the perfect thing I had been longing for.

    offlineimap and curses

    oops... offlineimap dies whenever the terminal emulator's width is lower than some specific value with an error thrown from Curses.py...!!! wtf with a text based program that gets affected from the terminal width... grr