Saturday, September 12, 2009

UTC time in Ubuntu and Windows

Ok, so you accidentally selected that the time in Ubuntu is UTC and now whenever you log in to Windows, that stupid (stupid for not having an option to select from) assumes that the clock from BIOS is @ localtime. Anyway, just
sudo gedit /etc/default/rcS


And edit UTC=yes to UTC=no. Simple as that. Next time you log in to Ubuntu it will show for a while (presumably it will get the right time in a few minutes while checking for the the right one in ntp.ubuntu.com) the old one. If you want to force it to show the right one right away then you should just
ntpdate ntp.ubuntu.com

Sunday, August 23, 2009

Reset a forgotten root password with a live CD

Info from here
If you have forgotten the root password of a system, you can very easily reset it with a live CD. Any live Linux cd from standard Linux distros such a ubuntu , knoppix etc can be used.

Boot the system with the live CD. Open a terminal and use dmesg command to find out the hard disk. The ide hard disk are generally named as hda, hdb etc. SATA and SCSI disks are named sda sdb etc.
You have to find out where your root partitions is mounted. You can use cfdisk to find out the partitions.
$sudo cfdisk /dev/sda

You can examine the screen and find out the Linux partitions . If you have multiple installations , this can be tricky. You can quit from cfdisk and return to terminal. Now, try to mount the desired partition into some directory. ( Assuming that you Linux partition is /dev/sda2 , the following commands are described.)
Acquire root powers on the terminal with ( in the case of ubuntu live cd which I use)
$sudo su
# mount /dev/sda2 /mnt/

Now, chroot to /mnt
# chroot /mnt

Change the password
# passwd

Next unmount the partition and enjoy .

# umount /mnt

Thursday, August 13, 2009

TV or video recording in ubuntu

Today my father persuaded me to start transcoding all his VHS collection to DVDs.

I thought to use his computer and his KWorld DVD Maker 2 Usb in Windows XP...in vain. KWorld does not complete the installation and I was stuck trying to figure out what was going wrong. So I decided to take it to my precious Ubuntu. Never having done an DVD2Xvid encoding, I was kinda curious what the results would be.

First of all, I
$ [sudo] apt-get install mercurial linux-headers-$(uname -r) build-essential udev

which would install mercurial and udev.
Then
$ hg clone http://linuxtv.org/hg/v4l-dvb
$ hg clone http://linuxtv.org/hg/dvb-apps
$ cd v4l-dvb
$ make
$ sudo make install


Everything went great so I continued with this command (I'm not sure if it's necessary):
sudo gedit /etc/modules

and added to the end of the file the following two lines:
#to record with kworld usb, I don;t need to say which one by saying >sudo em28xx card=12 or 10 etc.
em28xx


Reboot and then you will be able to check the video with this command:
mplayer -vf pp=lb -tv driver=v4l2:input=1:width=640:height=480:normid=5 tv://

If not, change input parameter to 0 or normid to whatever applies to your case(you will be able to check the available normids while mplayer is starting to play the stream).

Indeed by executing the
mencoder -tv driver=v4l2:width=576:height=480:device=/dev/video0:input=1:normid=5:forceaudio:immediatemode=0:adevice=/dev/dsp1 \-oac mp3lame -lameopts cbr:br=160 \-ovc xvid -xvidencopts fixed_quant=4:autoaspect=1 \-vf pp=lb -o input.avi tv://

I was able to start 1pass encoding (real time as the video was playing back) with the options mentioned before. In case you don;t have xvid
mencoder -tv driver=v4l2:width=720:height=576:device=/dev/video0:input=1:normid=5:forceaudio:immediatemode=0:adevice=/dev/dsp1 \-oac mp3lame -lameopts cbr:br=128 \-ovc lavc -lavcopts vcodec=mpeg4:vbitrate=2300:autoaspect=1 \-vf pp=lb -o input.avi tv://

seems to work as well and has similar results. Of course you can tweak as much as you want, if you know enough, the options in encoding.

The hard part is to find which is the video device and which the audio device. I didn't need to try a lot as there were not many video* in my /dev. Same goes for the microphone jack(/dev/dsp1).

Edit: I decided that the best way to convert the sound from VHS is to plug the in cable to the linein of my soundcard. Little did I know that it was a hassle of 6 hours... Anyway, I figured out that my soundcard was number 1 (number 0 is ATI's HDMI) so I ran this command

alsamixer -c 1

I then pressed to go to the capture view, pressed right to highlight LINE and then pressed space! See that's what's it's needed to tell alsa to CAPTUR from this input. If you want you can cancel (by presing space under the mic) microphone from capturing. Having done that, press escape and start your encoding.

By using linein, you can encode in stereo mode (whereas in mic you can't), or by using VHS sometimes there is a channel only at the right and only at the left. So by using -lameopts mode=3 we can tell mencoder to encode the audio stream in mono, while taking it as stereo! That way, it takes both channels and you don't have to care whether it is on the left or on the right.

mencoder -tv driver=v4l2:width=576:height=480:device=/dev/video0:input=1:normid=5:forceaudio:immediatemode=0:amode=1:adevice=/dev/dsp1 \-oac mp3lame -lameopts cbr:mode=3:br=80 \-ovc xvid -xvidencopts fixed_quant=4:autoaspect=1:threads=2 \-vf pp=lb -o input.avi tv://




Source:
  • http://linuxtv.org/wiki/index.php/How_to_Obtain,_Build_and_Install_V4L-DVB_Device_Drivers
  • Linux troubleshooting

    I really like this guy's article. Let me add to this that Linux is not prone to viruses, thus safer, faster and generally better...

    Monday, July 27, 2009

    Wind Plus Non Stop & iPhone 3.0

    Καλησπέρα σε όλους τους ελληνόφωνους.

    Εδώ και καιρό έψαχνα τρόπο προκειμένου να μπορέσω να χρησιμοποιήσω στο καρτοκινητό μου το wind plus non stop, για να μπορώ να βλέπω τα emails μου, και γενικά να χρησιμοποιώ τα 40Mb της υπηρεσίας δίχως να πληρώνω τα μαλλιά της κεφαλής μου. Από την άλλη δεν ήθελα ή δεν πείραζα αρκετά τα αρχεία του συστήματος του τηλεφώνου, προκειμένου να βάλω proxy server που ζητάει ναι μεν η wind, δεν παρέχει το iPhone από το ίδιο το σύστημά του. Η λύση δεν έρχεται πλέον με το βρωμο swirlymms(²) που θα δείτε αλλού, αλλά είναι υπογεγραμμένο από την ίδια την apple.

    Υποθέτω ότι για να χρησιμοποιείτε το iPhone, θα έχετε καβάτζα και ένα windows Xp/Vista. Σε όσους παρακολουθούν το blog μου, that's a first. Δε φημίζομαι να προτείνω εφαρμογές για windows, αλλά αφού η η *$#@^£ Apple δεν έχει βγάλει τίποτα για το linux, τί να κάνουμε; Πίσω στο θέμα μας. Κατεβάζετε από εδώ το iPhone Configuration Utility.

    Καταρχάς στείλετε μήνυμα στο 19349 την λέξη PLUS για να ενεργοποιήσετε την υπηρεσία και να μην χρεωθείτε κανένα 50€ από εκεί που δεν το περιμένετε. Η υπηρεσία στοιχίζει 4€ και έχει ισχύ για ένα μήνα καθώς και 40Mb για όλον τον μήνα σε sites πλην του wind Plus(εκεί είναι δωρεάν και απεριόριστο...φαγούρα μας). Τα 40Mb είναι ικανοποιητικά για μια μέση χρήση, trust me.

    Ανοίγετε την εφαρμογή, πηγαίνετε αριστερά στο configuration profiles, φτιάξτε ένα νέο (δώσε του ένα name και έναν identifier) και μην πειράξετε τίποτα άλλο. Τώρα πηγαίντε στο τέλος στο advanced (payload detail) και βάλτε
    apn: gwap.b-online.gr
    username: wap
    password: wap
    και τέλος το ποθητό
    proxy server and port: 192.168.200.10:9401


    Ανεβάστε (κάντε δηλαδή install) στο iPhone σας et voilà! Τώρα θα μπορείτε να τρέξετε τον safari, να μπείτε στο gmail σας (πράγμα που παλιά με το swirlymms δε γινόταν από την αρχή, αλλά έπρεπε να το έχετε στην cache και να πατάτε refresh), να στείλετε από τις εφαρμογές διάφορα δεδομένα (βλέπε shazam και αναγνώριση τραγουδιών) κ.ά.

    Βέβαια, να προσθέσω ότι έτσι χάνονται οι βρωμορυθμίσεις των mms(βλ. activatemms2g), αλλά κάπου θα την βρω την άκρη. Στο κάτω κάτω της γραφής, τί να το κάνετε το mms όταν έχετε ολόκληρο email που μπορείτε να στείλετε... Περιμένω σχόλια...

    Sunday, March 29, 2009

    Bulk rename

    Yesterday I wanted to rename a lot of files with the same extension (jpg actually). Knowing that linux is case-sensitive, I wanted to rename every JPG to jpg.

    So the trick was to simply write
    $rename -v 's/JPG/jpg/g' *.JPG

    Inside quotes lies the expression that you want to replace (JPG->jpg, 2nd and 3rd argument). Outside the quotes you must give the files that this expression will work on.

    Edit:
    $rename -n 's/JPG/jpg/g' *.JPG
    will get you to see what exactly is going to change. See here for more perl handling, or here for a more understanding way to rename stuff from terminal.

    Thursday, March 12, 2009

    Change frequency of filesystem check at boot

    Sometimes, even though Ubuntu has the option to press cancel, you think that boot fsck happens way too often. I think that every 50 boots it would be great rather than every 20... So I ran df, just to remember the names of the partitions and
    sudo tune2fs -c 50 /dev/sdb1

    (where sdb1 was my primary partition). In case you want to check every x days,months or weeks there is this neefty parameter
    -i interval-between-checks[d|m|w]

    . So the command would be something like this(if you want boh the 50 times interval and 1 month),
    sudo tune2fs -c 50 -i 1m /dev/sdb1

    With this you can see how much time you've got left
    sudo dumpe2fs -h /dev/sdb1 | grep -i 'mount count'

    and by editing the sixth(last) column in ftsab
    sudo gedit /etc/fstab

    The 6th column (in bold) is a fsck options.

    • 0 = Do not check.

    • 1 = First file system (partition) to check;  // (root partition) should be set to 1.

    • 2 = ALL OTHER file systems to be checked.

    Wednesday, March 11, 2009

    Moving Ubuntu to another partition

    So, I bought a new hard disc drive and I just wanted to split my windows installation to that of ubuntu. But I didn't want anything to change. I wanted my ubuntu installation to be exactly as it is. No reinstalling, no tweaking from the start. While moving Windows was a pain, ubuntu was very easy to move.

    First of all I used this command line
    sudo lshw -businfo -C disk

    just to see how linux names my partitions. Using also the "df" command I double-checked that my linux partition was indeed located at sda1 and that I wanted to move it to sdb1. After that, I decided to move my partition with this line
    dd if=/dev/sda1 of=/dev/sdb1

    Watch that I wanted to move my partition from sda1 (the if parameter) to sdb1 (the of parameter). I must say the partitions were not identical, but we'll get to that in a while. Once finished I shut down the PC. Then I disconnected the sda hard disc drive. Here comes the tricky part. Now I don't recall whether or not I used my live cd... But once I got to the terminal (see ubuntu can't find grub), I typed these lines:
    sudo grub
    >find /boot/grub/stage1

    That will answer a thing something like hd(z,0). Note the z number, you will need it. Then type (and replace the z number to that of your own),
    >root hd(z,0)
    >setup (hdz)
    >quit

    And that's it. Linux should now load.

    In case that the two partitions were not identical, download and burn to rewritable CD the gparted program, then boot from it. Then just resize the linux partition to whatever size you want, and the sizes will fix.

    Saturday, March 7, 2009

    Rar crack, pdf crack in linux

    And off for a good start.

    Ever had your rar/7z/zip files' password forgotten? I sure have. There is an open source program that can handle these files quite well. It is called rarcrack. It is hosted on sourceforge. And in case that you want to crack pdfs, there is the pdfcrack.

    What it would be greater though, would be for these two to be written in the new OpenCL... That way, it would be faster. What? You thought that only Elcomsoft had the idea to take advantage of CUDA? Well, it sure wasn't...

    --edit
    Well, well, well! The day is finally here. cRARk is using Opencl to crack passwords! 

    And on this fine day...

    This blog starts!

    Yeah, I finally succumbed to the idea. My goal is to share stuff, news that are bizarre, videos or photos that are funny, and last but never least, linux & OSX stuff...

    Ever frustrated in the *nix world? I am, at least sometimes, so I am sharing all that might help you as well to overcome these obstacles. Sometimes, it is no hurdles, but it can really make a guy (or a girl) angry. And there are times that you need your nix world to be more responsive, do many and more things. Been there, tried to do stuff.

    Specifically I'll post stuff regarding one of the most pop distros out there, Ubuntu.

    Hope you'll enjoy my blog.