YATB (Yet Another Tech Blog)

I wanted to change my machine’s Grub default boot partition and didn’t know how. After googling, I learned that the default boot partition is controlled by the file:
/boot/grub/grub.conf
Just change the default setting inside and reboot.

Read more...

§245 · January 10, 2010 · Ubuntu · Comments Off ·


sudo umount /media/doit
sudo mkdir /media/doit2
sudo mount -t vfat -w /dev/sdb1 /media/doit2

Read more...

§240 · December 6, 2009 · Linux, Ubuntu · Comments Off ·


Hacked up a quick perl script to batch resize and rename photos. You know how those photo files from the 8 and 9 Meg pixel cameras? They’re huge. And they’re absolutely useless except for clogging up my disk space. So here’s a script to chop them down to size- with the help of imagemagick.
First install imagemagick with apt-get like so:
sudo apt-get install imagemagick
Here’s the script for mscale.pl in perl.

#!/usr/bin/perl
#
# mscale [path] [scale]
#
# mscale – multi-scale, resizes multiple jpg/gif files to <scale> percent
#
#
use strict;

# if no 2 args, use defaults
my $dir = ".";
my $scale = 50.0;

# read in path from command line
$dir = $ARGV[0] if ( defined( $ARGV[0] ) && $ARGV[0] ne "" );
$scale = $ARGV[1] if ( defined( $ARGV[1] ) && $ARGV[1] ne "" );

# read in directory contents
opendir( DIR, $dir );
my @files = readdir( DIR );
closedir( DIR );

# rename and scale each file in directory
my $numfiles = scalar( @files );
my $curfile = 0;

foreach my $file( @files ) {
# only rename and scale jpg/gif files
if ( $file =~ /\w+\.(jpg|gif)$/i ) {
my $extension = $1;
$extension =~ tr/A-Z/a-z/;
[...]

Read more...

§204 · December 30, 2008 · Tech, Ubuntu, perl · (No comments) ·


sudo apt-get install htop nautilus-open-terminal ubuntu-restricted-extras vim-full gnome-do gnome-do-plugins openssh-server meld subversion

Read more...

§203 · December 18, 2008 · Ubuntu · (No comments) ·


Overwriting Ubuntu’s default /etc/network/interfaces files works with a static IP configuration file like this:
auto ath0
iface ath0 inet static
address 192.168.2.108
netmask 255.255.255.0
network 192.168.2.0
broadcast 192.168.2.255
gateway 192.168.2.1
wireless-key xxxxxxxxxxxx
wireless-essid xxxxxx

Read more...

§202 · December 18, 2008 · Ubuntu · (No comments) ·


That was odd.  Immediately after installing Ubuntu 8.10, my laptop failed to ping www.google.com, even though I could definitely ping google’s IP address: ping 64.233.169.103.
Doing a little reading, I found that translating external addresses requires domain name server addresses in the file: /etc/resolve.conf.
Just sudo vi /etc/resolve.conf
nameserver 208.67.222.222
nameserver 208.67.220.220

Read more...

§201 · December 18, 2008 · Ubuntu · (No comments) ·


Curious, just came across the following open source libraries:
gperf- perfect hash function generator
m4- macro generator
gsql- sql front end
GtkSourceView- gtk framework library for multi-line text editors.

Read more...

§199 · December 3, 2008 · Ubuntu · (No comments) ·


I’ve always had this problem.  Up until now, I’ve been copying mostly files between a Windows machine and a Ubuntu machine.  Samba has made that part a breeze.
But now I’ve two Ubuntu systems- and somehow the Samba share on one Ubuntu machine cannot be seen by the other.  Then how can I copy files across the two Ubuntu machines?
It turns out- to be painless.  The key is sftp.  It’s similar to ftp- but more secure.
There’s two ways to use sftp.  One is via the command line.  First get the name or IP address of the remote machine.  Use ipconfig on the remote machine to get the IP address.  From the local machine, type sftp [ip address].

quantboy@linuxlaptop:~/downloads$ sftp 192.168.2.2
Connecting to 192.168.2.2…
The authenticity of host '192.168.2.2 (192.168.2.2)' can't be established.
RSA key fingerprint is 6e:ac:cf:e1:02:75:a4:50:b7:ce:5c:9e:a1:ea:72:39.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.2.2' (RSA) to the list of known hosts.
quantboy@192.168.2.2's password:
sftp> ls
Data DVD.gbp                   bin                            books
chinese_study                  desktop                        dev

It’s used just like ftp.  Type help to get usage help.
The other way to use sftp is via Nautilus. In Nautilus, select from the menu, File -> Connect to Server.  Select Service Type SSH.  Enter the Server address, then Connect.
Once connected, one can [...]

Read more...

§198 · November 21, 2008 · Linux, Ubuntu · Comments Off ·


I ran into a curious problem on my newly installed Ubuntu workstation.  When playing avi files in Totem, the video image inevitably comes out in black and white.  I’ve never had this problem before on my other Ubuntu workstations- although their video chips I’m sure are different.
Googling the problem, I found a solution here.
Just run on the command line:
gstreamer-properties
Select Video>Output> X Window System (No Xv)
And it worked!

Read more...

§196 · November 15, 2008 · Linux, Ubuntu · Comments Off ·


Ever since installing Gutsy, I’ve noticed the Chinese fonts in FireFox look exceptionally ugly- like this:

Using Google, I found the solution posted here. Essentially, it’s a four-step solution:

fontconfig-voodoo -f -s zh_CN
sudo vi /usr/share/language-selector/fontconfig/zh_CN

move the western font above the Chinese fonts
move the “AR PL ZenKai Uni” font above the other Chinese fonts
lower the use of ugly aliased fonts below a certain pixel size- look for the keyword “pixelsize“ in the file

Update. I just ran into this problem again- on Xubuntu version 9.10.  To fix, update the file:
/etc/fonts/conf.d/69-language-selector-zh-cn.conf

Read more...

§98 · December 31, 2007 · Ubuntu · Comments Off ·