Blog xaie

Entries tagged as ‘computer’

The Joy Of New Toy

23 Agustus 2009 · Tinggalkan sebuah Komentar

I think I just found out how to download a file from an online file storage for free without that silly ‘waiting time’ thing. It doesn’t require anything else than a not-your-everyday web-browser, a decent web proxy which I have to say not so difficult to find, and a bit of brain cells.

No, this is not using proxy to skip IP-based detection from the server’s part. I use proxy because as I also found out, in the past, that they put downloads limit for my country. This might sound unfair, but I know that I can think one reason why they put a downloads limit; anyway that’s not the point.

If I did’t know better I might post it on the internet, but I know (and I think anybody else who smart enough) once it made into public knowledge then bye bye to no ‘waiting time’.

Hmm… now let me see, is there anything else I would like to download from this file storage website?

Kategori: Orang bego punya kegiatan
Ditandai: , ,

Stupid Debian Kernel

5 Juli 2009 · Tinggalkan sebuah Komentar

I freaked out when my server computer didn’t boot to my new Debian install. I guess something about this generic kernel just ain’t right; I mean at least on this computer, because somehow it ran just fine on VirtualBox.

For a quick hack I tried booting from some live cd (I think it was a Slax) so at least I can mount it and get an older kernel from my other computer, extract the old 2.6.22-generic kernel from backup archive (that was coming from an Ubuntu 7.04 partition, because that’s my only kernel backup) and get that damned grub to play nicely by setting it to default. Why? Because I’m using an old CRT monitor, so old that I can’t see anything before 3 to 5 minutes after the first time i press power-on button or reset; I know.. I know it’s time to get a new one;).

Now at least I can get online from LAN-sharing because I can’t get Huawei E220 to work yet. Something that was as trivial as ‘wvdial MyNetProfile &’ have to wait because I know that I have to get/compile a better kernel. So, yeah busy. But the bright side of this whole situation is nothing of value deleted from this install …….. yet (O’ UNIX gods, please guide my fingers).

Aaaarrrggghhh!!!!

Kategori: Orang bego punya kegiatan
Ditandai: , ,

updateln.py

18 Juni 2009 · Tinggalkan sebuah Komentar

A Python script to update links under a path to use new prefix.


#!/usr/bin/env python
# -*- coding: utf-8 -*-

import os, sys, getopt;
options = {'start': None, 'oprefix': None, 'nprefix': None, 'simulate': True};

class PathError (Exception):
  pass;

def ShowUsage():
  progname = os.path.split(sys.argv[0])[1];
  print progname;
  print '-'*len(progname)
  print " Usage: %s [-w] [-s startpath] -o oldprefix -n newprefix\n" % progname;
  print " Parameters: "
  print " -w, --write       Dont run the program run in simulation mode.\n";
  print " -s, --start-path  Use custom starting directory.\n";
  print " -o, --old-prefix  Find link(s) with prefix as specified by this parameter.\n";
  print " -n, --new-prefix  New prefix for the offending link(s) to use.\n";
####  

def GetOptions():
  global options;
  ret = 0;

  arguments = sys.argv[1:];

  try:
    wnt, dummy = getopt.getopt(arguments, "o:n:s:w", ["old-prefix=",
                    "new-prefix=", "start-path=", "write"]);
    for name, val in wnt:
      if name in ('-o', '--old-prefix'):
        options['oprefix'] = val;
      elif name in ('-n', '--new-prefix'):
        options['nprefix'] = val;
      elif name in ('-s', '--start-path'):
        options['start'] = val;
      elif name in ('-w', '--write'):
        options['simulate'] = False;
    ##

    if options['start'] == None:
      options['start'] = os.getcwd();
  except getopt.GetoptError:
    ret = -1;
  ##

  if (options['oprefix'] == None) or (options['nprefix'] == None): ret = -1;
  if ret != -1:
    print "Start      : %s" % options['start'];
    print "Old prefix : %s" % options['oprefix'];
    print "New prefix : %s" % options['nprefix'];
    if options['simulate'] == False:  print "WARNING    : This program may change links.";
    print;
  ##

  return ret;
####

def ProcessPath(curPath, recursive):
  proccount = 0;
  files = os.listdir(curPath);

  if len(files) > 0:
    print "Examining %s" % curPath;

  for entry in files:
    curFile = os.path.join(curPath, entry);

    if os.path.islink(curFile):
      linkPath = os.readlink(curFile);
      if linkPath.find(options['oprefix']) == 0:
        # we need to update this one
        newLinkPath = linkPath.replace(options['oprefix'], options['nprefix'],
                                      1);
        print "Fixing %s\n   Old path: %s\n   New path: %s" % (curFile,
          linkPath, newLinkPath);

        if options['simulate'] == False:
          # these two lines will modify/regenerate the symbolic link
          os.unlink(curFile);
          os.symlink(newLinkPath, curFile);
          proccount += 1;
        ##
      else:
        # good link, skip it
        pass;
    elif os.path.isdir( curFile ) and recursive:
      proccount += ProcessPath(curFile, recursive);
  ##    

  return proccount;
####

def main():
    if GetOptions() == 0:
      i = ProcessPath(options['start'], True);
      print;
      print ["Nothing processed by this program", \
             "There are %s link(s) processed" % i][i > 0] + '.';
    else:
      ShowUsage();
####

if __name__ == '__main__':
    main();
##

Kategori: Ilmu
Ditandai: , , ,

ssh_mp32ogg.sh

17 Juni 2009 · Tinggalkan sebuah Komentar

‘cos those MP3 wont convert by themselves.


#!/bin/sh

# -----------------------------------------------------------------------------
# It is a simple script to convert mp3 files (one at a time) to ogg on my
# other computer, because that's where the LAME codec is installed.
# Last edit: 5 June 2009
#
# It requires sox (with LAME installed) on the other computer.
#
# Usage: ssh_mp32ogg.sh [-s SERVER] [-u USERNAME] [-r BITRATE] infile outfile
# -----------------------------------------------------------------------------

mp3_fn=;
out_fn=;
server="CHIKUZA.KRYIE";	# default server
server_usr="ariel"	# default user @ server, must be exists
out_rate=4	# output bitrate to ~ 128

for cur_arg in "$@" ; do
  if [ -z "$mp3_fn" ] && [ -f "$cur_arg" ] ; then
    mp3_fn="$cur_arg";
    echo "Input file is $mp3_fn";
  elif [ -z "$out_fn" ] && [ ! -z "$mp3_fn" ] ; then
    out_fn="$cur_arg";
    echo "Output file is $out_fn";
  fi
done

while getopts s:u:r: OPTION; do
  case "$OPTION" in
	s)	shift `echo "$OPTIND -1" | bc`;
		server="$OPTARG";
		;;
	u)	shift `echo "$OPTIND -1" | bc`;
		server_usr="$OPTARG";
		;;
	r)	shift `echo "$OPTIND -1" | bc`;
		out_rate=`echo "$OPTARG / 32" | bc`;
		;;
  esac
done

# do the format conversion
cat "$1" | ssh $server_usr@$server "sox -S -t mp3 - -C $out_rate -t ogg -" > "$2"

Kategori: Ilmu · Orang bego punya kegiatan
Ditandai: , , ,

Holy crackamoley Batman! I just know how to use escape keys in OpenSSH!

22 Mei 2009 · Tinggalkan sebuah Komentar

Few minutes ago I just found out that I can actually send SSH session into background by suspending it. From now on I can use one terminal for everything I need.

How is it done? That sneaky escape_char is the key. A quick glance at the ssh manual should explain you all about it, but I found it hard to practice; I just can’t understand what “The escape character is only recognized at the beginning of a line” is supposed to mean.

I mean I know that sentence in English, duh, but what the heck is this “at the beginning of a line” is all about? Are we talking about the shell prompt here or what, Vim? I recall that every time I send a command it occupy its own line, is this a trick to confuse newbie? Even though I know that you CAN type multiple-line commands, but that is not what I’m concerned about.

I tried to type ‘~?’ literally, but that didn’t work. As I just found out (by bashing my keyboard like a space chimps) “the beginning of a line” mentioned here is to put empty command before entering ~. So all I have to do in my terminal is this:

$ < press Return / Enter >
$ < just press key combination to '~', which in my case Shift + ` >

It will be easier that way especially because I’m accustomed to reuse commands from history, walking through the command each character/word at a time, or plain-ol’ Ctrl + C.

For practice purpose I recommend you to try the ~? command. It will print the other available commands, lookup the manual to find out more.

All this time… can you imagine that??

Kategori: Ilmu · Orang bego punya kegiatan
Ditandai: , ,

kidsxp_ico2png.py

21 Mei 2009 · Tinggalkan sebuah Komentar

Because I got ICO files and I want them in PNG.


#!/usr/bin/env python
# -*- coding: utf-8 -*-

import os, glob

# location of the files
sourceDir = "/media/yamazaki/Work/Pictures/Icons/KidsXP/"
# output directory
targetDir = "/tmp/kidsxp_png/"
# the real processor of this script: imagemagick
convertCmd = "convert %s[9] -resize %s %s"
# which categories to process? all of 'em?
processDirs = ("actions", "apps", "devices", "filesystems", "mimetypes")
# extract it and move into known usable sizes
knownSizes = ('16x16', '22x22', '32x32', '48x48', '64x64', '96x96', '128x128')

def processDir(path, thissize):
  print "Processing source path : %s" % path
  dummy, category = os.path.split(path)

  for item in glob.glob(path + '/*.ico'):
    dummy, itemName = os.path.split(item)
    tgtDir = os.path.join(targetDir, thissize, category, '')
    tgtName = itemName[:-3] + 'png' # "xyz.ico" filename to "xyz.png"

    print "Writing %20s -> %s" % (itemName, tgtDir + tgtName)
    if not os.path.exists(tgtDir):
      os.makedirs(tgtDir)

    cmd = convertCmd % (item, thissize, tgtDir + tgtName)

    # execute
    os.system(cmd)  # ooh! the horror!!
  ##
  print
##

for item in processDirs:
  s = sourceDir + item
  if os.path.isdir(s):
    for size in knownSizes:
      processDir(s, size)
  else:
    print "Skipping %s" % (s)
##

Kategori: Ilmu
Ditandai: , , , ,

PulseAudio on Kubuntu 8.10

24 Maret 2009 · Tinggalkan sebuah Komentar

This part was supposed to be a part of A Few Days In KDE 4 post, but I think it deserves its own post.

First of all, when I played with my new Kubuntu I realized that I forgot to backup PulseAudio settings. Damn. Anyway, this might be a good read for everybody else trying to get PulseAudio working, which I did in 20 minutes or so (most of the times spent downloading PulseAudio and everything else needed to make it work) to get my previous setup.

For a starter, I have to enable ALSA to use PulseAudio output, so I typed this into ~/.asoundrc:


pcm.pulse {
  type  pulse
}

ctl.pulse {
  type  pulse
}

This should enable PulseAudio audio playback on ALSA (the one I’m using right now and in the past).

Next I have to (re)configure PulseAudio server in this computer, just create another file at ~/.pulse/default.pa and put this in it:


load-module module-alsa-sink
load-module module-native-protocol-tcp auth-ip-acl=127.0.0.1;192.168.0.0/24

The first line should load the ALSA module to make PulseAudio use ALSA. The next one is to use native TCP protocol nothing fancy really, with a restriction on clients able to ’send’ their sound to this computer. In this case I’m accepting sound from my local LAN (machines starting with “192.168″ on their IP) and localhost (127.0.0.1); of course with extra precaution put on my firewall to block all entrance using PulseAudio port through unwanted network interfaces.

I tried to start PulseAudio for the first time by typing pulseaudio on the console. Right now not only that I know my settings working but I also got ~/.pulse-cookie created by PulseAudio. This is important because this is the cookie that allow the client computer, the one that provides playback, the one with MPD playing my songs, to connect to this computer. This is like public key in SSH, if you know what I’m talking about. Anyway what I have to do is to copy it to the remote machine to make PulseAudio authentication work; scp to the rescue!

At this stage PulseAudio should run as your everyday program, while what I want is to start as a daemon. So to make PulseAudio start as a background program, I created another file called ~/.pulse/daemon.conf and put this in it, a self-explanatory line:


daemonize=yes

After that when I started pulseaudio it works in the background, perfect. Now I can listen to music like I did before :D .

Kategori: Ilmu
Ditandai: , ,

A Few Days In KDE 4

18 Maret 2009 · Tinggalkan sebuah Komentar

I managed to install KDE 4 since the last post, it was not so hard but of course not without quirks. As I managed to post this thing on my new install of 8.10, been trying it for a few days, adjusting to new concepts and UI, etc. I can say that I’m disappointed with the new KDE, I prefer KDE 3.5 but I’ll survive this one; no.. and I still like this one over Gnome.

Getting Ready

First of all the installation process itself was not right after the ISO download. Before logging off I created a backup of my home directory, a simple tar command followed by scp took 4 ~ 5 minutes to backup everything to a safe place before restarting the box.

As a personal custom before installing new OS, I usually start the whole thing with diagnostic process, starting with defragging my XP installations (both of them), with mandatory scandisk on each system just to be safe, all took me 2 ~ 3 hours (slow, I know.. :) ). After I’m satisfied with my hard disk condition I rebooted to Kubuntu to copy the ISO file to my server box, which in turn will host my HTTP-based installation but a quick glance at my CDs pile found me a nice yet unused CD-RW, so I scratch that idea away. I thought a CD installation is better anyway because I might want to install this one on another machine. Burning the ISO image took 20 ~ 30 minutes including verification, of course I test the CD by mounting and browsing it for a while before logging off, yet again.

I restarted the box, alter the BIOS boot sequence and after a few seconds presented with the language selection menu only to be followed by the Live-CD boot menu. I added nofstab to the end of Live-CD boot parameters because I don’t want it to mount my filesystems because I want to resize my previous Linux installation to a comfortable 5 GB (from 3 GB :D ).

My First KDE 4 Experience

The new interface looked great, I enjoyed it for 5 minutes or so before I experienced my first KDE 4 crash notification; not good. The screen flickers, oh God, what can I say.. almost drive me nuts. I noticed my network already up (God bless the dude who invented DHCP), I login to my server box, get myself online and search the Google how to kill fix this. Either my Google-fu was strong that day or it was a common problem I don’t know, I found a solution to kill the ‘Detecting RANDR changes’ service in a minute (which is a good thing because the next minute I might gone postal).

Making Rooms

I started the install process, a nice one I might add. It detected my hard disk layout right away, and of course I chose manual partitioning. The interface reminds me to Partition Magic, somehow for a few seconds I hesitated to delete my Linux install although I know I did backup everything: documents, logs, home directory, including deb packages.

Anyway after a few seconds of self-cursing I deleted my old Linux partition, and resize the previous partition to make room for a larger ‘unallocated’ partition. I reformat the new and larger partition as ext3, and set its mount point to ‘/’ before moving forward. After a few minutes, formatting file system was a success and I have to accept that my old Linux partition is gone, with everything that I forgot to backup; if any.

Post Installation

The installation took, roughly, 30 minutes for me without any problem along the process. Nice. After a disturbing startup sound getting cut-off after a few seconds (I know this is not supposed to be like this, not that I’ve installed it on my harddisk) I played around with KDE 4. Nice interface and all, but I do miss things from KDE 3.5 though.

After get bored with playing around on the interface (all those shininess only lasts for a few hours) I have to restore any important settings from my previous setup, things such as SSH known hosts, a few tiny python scripts to get things going, and a plethora of articles, books, and saved pages to finish since I don’t have the time to read them all, yet.

Kategori: Orang bego punya kegiatan
Ditandai: ,

1,5 Jam Jadi Orang Bego

27 September 2008 · Tinggalkan sebuah Komentar

Oke jadi ceritanya gini, gw punya `task` (bisa dibilang gitu) untuk ngedit kode C. Kodenya sih gak panjang amat, tapi ya terdiri dari banyak file –normal lah.

Waktu pertama kali check-out, coba compile trus semuanya jalan. Edit-edit sebentar, buka sana-sini, ganti, copy – paste, dsb. kira-kira 15 menit lalu coba compile lagi. Semuanya kelihatan udah selesai, berjalan sesuai yang gw mau. Tapi anehnya ini program nge-hang mulu gitu di bagian tertentu, bagian yang gak terlalu sering dipake tapi ya emang harus ada.

Karena gw orang yang termasuk males bikin test units ya maka gw gak bikin –lagian yang punya kode juga gak bikin (some encouragement huh?). Jadi akhirnya semuanya selesai 15 menit ajah, itung-itung cuma buka, scan sebentar, modifikasi, test abal-abal seadanya.

Bagian program ini nge-hang 100% pada tiap kali percobaan, jadi dari 9 percobaan, 9 kali nge-hang disitu-situ juga. Mana gw gak punya objects buat debug lagi, soalnya ini pake library yang gw download pake adept-installer –males online dan ukuran filenya gede bwanget. Gw pikir ini mah mana mungkin kode gw, wong yang bikin gw gitu (kekekeke), pasti yang salah orang laen.

Gw coba cek, buka semua file, liat source sampe jungkir balik, taro printf disana-sini. Perasaan yang gw tambahin gak rumit-rumit ama deh, tapi kok gak ada hasil ye?

Coba pikir, yang kaya ginian sampe 1,5 jam (90 menit gitu) mumet, gw justru keluyuran baca lebih banyak kode dari yang seharusnya. Mo tau errornya dimana? Nih:


  while (cEst[i] != &p)
     iDelgt++;

** gubrak **

Ternyata gak ada increment buat variable i, dan ini gw sendiri yang masukin. Healah…. healah… emang orang bego.

Kategori: Orang bego punya kegiatan
Ditandai:

Komputer lama jadi server

21 Desember 2007 · & Komentar

WinXP Pro SP2 server desktop from VNCOke jadi gw punya komputer tua dengan spesifikasi: Pentium 4 1,7GHz, 256 SDRAM, NVidia GForce4MX, 80 GB HDD, 1 CD-RW, on-board soundcard, dan 4 port USB v1.0. Komputer ini gw setup sebagai komputer server pribadi, untuk melayani beberapa komputer dan sebuah notebook yang sama-sama lebih baru daripada komputer ini.

Di komputer lama ini gw install dua OS (system), yaitu Mandriva Linux 2006 Free Edition (Mandriva) dan Microsoft Windows XP Pro SP2 (WinXP Pro SP2). Sebenarnya pada awalnya hanya ada WinXP Pro SP2, karena gw pernah bekerja menggunakan komputer ini dan pekerjaan gw semua serba Windows. Mandriva baru di-install kira-kira satu tahun sebelum gw memutuskan untuk membeli komputer baru.

Sekedar informasi, sebenarnya WinXP Pro SP2 agak jarang dijalankan karena hampir semuanya sudah bisa dilakukan di Mandriva. WinXP Pro SP2 (masih) ada karena ada beberapa program yang hanya jalan di system Windows (oke, sebenarnya karena gw malas coba-coba dengan Wine :D ), seperti FMA untuk ponsel, untuk membaca kamera digital, dsb.
(lagi…)

Kategori: Orang bego punya kegiatan · Pendapat gak penting
Ditandai: , , , , , ,