Freelancer's Playground! New knowledges every now and then

14Oct/0810

Copy 3MU Playlist to Directory

One day, I want to copy music from my amarok playlist's to my cellphone. This playlist has so many files that spread across directories. As a php ninja, I create a php script to do the hard work>:).

Here's the script if you want to try:

<?php
$playlist_file = $argv[1];
$output_dir = $argv[2];
$lines = array_map("trim", file($playlist_file));

if(!is_dir($output_dir)) mkdir($output_dir);

foreach($lines as $line)
{
	if(substr($line, 0, 1) == "#") continue;
	if(file_exists($line))
	{
		$filename = basename($line);
		echo "$filename\r\n";
		copy($line, $output_dir."/".$filename);
	}
}
?>

Use it this way php 3mu_copier.php /path/to/3mu/files/playlist.3mu /path/as/target/copy/.


Tagged as: , 10 Comments
10Oct/085

Auto Mount Iso Image Via /etc/fstab

So, you have a cd image and want to mount automatically every time you start your linux? Here, I'll show you how to do it.

  1. First step is, put your file at some place where you will not move it again. Why? Because you'll have to adjust your /etc/fstab entry if you move the file. For this tutorial, we will call it /home/cd_images/some_cd.iso
  2. Then, create a folder where you want it mounted. Let's call it /home/m_images/mounted.
  3. Next step, open up /etc/fstab. Issue this command on terminal: sudo gedit /etc/fstab.
  4. Add this line to /etc/fstab:
    /home/cd_images/some_cd.iso  /home/m_images/mounted  udf,iso9660  user,loop  0  0
    
  5. Save your file and restart your PC to see it in action.


Now, you have your cd image automatically mounted when your PC is started.

7Oct/080

Using SVN to Easily Update Online Project(s)

I guess all of you are already know that Version Control System is a good tools to manage your project files. Be it a collaboration project or your own single man project. I have several online projects, some are my own projects, some are paid projects. Some I'm the only developer while some others are collaboration with friends or my employer's staff. I manage my project's script using SVN. I also set up sub-domain for testing purpose.

3Oct/0810

silent [say] Happy Birthday To Me!

Tagged as: 10 Comments