Latest Entries »

This section explains how to retrieve a feed listing a specific user’s playlists. Note that some users may not have created any playlists.

To request a feed of the currently logged-in user’s playlists, send a GET request to the following URL. Note: For this request, you must provide an authentication token, which enables YouTube to identify the user.
To request a feed of another user’s playlists, send a GET request to the following URL. This request does not require authentication.
In the URL above, you should replace the text userId with the user’s YouTube user ID. For backward compatibility purposes, the API also supports having the user’s YouTube username specified instead.

Youtube to MP3 Script

It’s a script-based alternative to online youtube-to-mp3 converters, but it’s much more faster, much more reliable and easy to customize. You don’t have to visit those spammy online converters anymore, and what’s more, you can run multiple instances of the same script so that you’ll be able to convert several youtube videos simultaneously.

I use this on my Ubuntu (Linux), but Windows and Mac users should be able to do the same by writing the equivalent shell script for their own command lines. Before you can use the script make sure you have “youtube-dl” and “ffmpeg” installed. We will use youtube-dl to download youtube videos, and ffmpeg to convert them into the mp3 format. Create a new file…

gedit youtube2mp3 

…and paste the following script:

x=~/.youtube-dl-$RANDOM-$RANDOM.flv youtube-dl --output=$x --format=18 "$1" ffmpeg -i $x -acodec libmp3lame -ac 2 -ab 128k -vn -y "$2" rm $x 

Save and close gedit. Now install the script somewhere easily accessible.

sudo install youtube2mp3 /usr/local/bin 

Now you can convert youtube videos into mp3 files by using the following command (including the double quotes):

youtube2mp3 "youtube-link" "mp3-file.mp3"


For this script to work, ffmpeg must be able to use the libmp3lame codec. As far as I know this is not provided with the ffmpeg on Ubuntu, but there are many tutorials on the internet that could help you do this. Also, the script is very verbose. Use the following command if you don’t want to see all the messages on your screen:

youtube2mp3 "youtube-link" "mp3-file.mp3" > /dev/null

You can also use the following command to make the script run in the background. This way you will be able to run multiple instances of the script at the same time.

youtube2mp3 "youtube-link" "mp3-file.mp3" > /dev/null & 


How it works

The way this script works is really simple. First it downloads the youtube video into a temporary file, converts the video to mp3 and then deletes the temporary file. Let’s go through this script step-by-step.

1. The first line of the script assigns a random .flv filename to the variable $x.

2. The second line downloads the youtube video into the temporary file named $x. It automatically downloads the HQ version of the video if it’s available.

3. The third line extracts the audio from the video and converts it into an mp3 file with the filename you specified.

4. The last line removes the temporary file created in step 2.


Resetting the Password

You’ll want to boot from your Ubuntu Live CD, choosing “Try Ubuntu without any change to your computer” from the boot menu.

Once the system boots, open up a new Terminal window from Applications \ Accessories and then type in the following command:

sudo fdisk -l

This command is used to tell what device name the hard drive is using, which in most cases should be /dev/sda1, but could be different on your system.

Now you’ll need to create a directory to mount the hard drive on. Since we’re actually booting off the live cd, the directory doesn’t really get created anywhere.

sudo mkdir /media/sda1

The next command will mount the hard drive in the /media/sda1 folder.

sudo mount /dev/sda1 /media/sda1

Now it’s time for the command that actually does the magic: chroot. This command is used to open up a shell with a different root directory than the current shell is using, and we’ll pass in the folder where we mounted the hard drive.

sudo chroot /media/sda1

Now you should be able to use the passwd command to change your user account’s password, and it will be applied to the hard drive since we are using chroot.

passwd geek

Note that you’ll have to type your username after the passwd command in order to change the right password.

Now you should be able to reboot your system and log yourself in with your new password.

Whether you’re setting up multiple computers or doing a full backup, cloning hard drives is a common maintenance task. Don’t bother burning a new boot CD or paying for new software – you can do it easily with your Ubuntu Live CD.

Not only can you do this with your Ubuntu Live CD, you can do it right out of the box – no additional software needed! The program we’ll use is called dd, and it’s included with pretty much all Linux distributions. dd is a utility used to do low-level copying – rather than working with files, it works directly on the raw data on a storage device.


Note: dd gets a bad rap, because like many other Linux utilities, if misused it can be very destructive. If you’re not sure what you’re doing, you can easily wipe out an entire hard drive, in an unrecoverable way.

Of course, the flip side of that is that dd is extremely powerful, and can do very complex tasks with little user effort. If you’re careful, and follow these instructions closely, you can clone your hard drive with one command.

We’re going to take a small hard drive that we’ve been using and copy it to a new hard drive, which hasn’t been formatted yet.

To make sure that we’re working with the right drives, we’ll open up a terminal (Applications > Accessories > Terminal) and enter in the following command

sudo fdisk –l

We have two small drives, /dev/sda, which has two partitions, and /dev/sdc, which is completely unformatted. We want to copy the data from /dev/sda to /dev/sdc.

Note: while you can copy a smaller drive to a larger one, you can’t copy a larger drive to a smaller one with the method described below.

Now the fun part: using dd. The invocation we’ll use is:

sudo dd if=/dev/sda of=/dev/sdc

In this case, we’re telling dd that the input file (“if”) is /dev/sda, and the output file (“of”) is /dev/sdc. If your drives are quite large, this can take some time, but in our case it took just less than a minute.

If we do sudo fdisk –l again, we can see that, despite not formatting /dev/sdc at all, it now has the same partitions as /dev/sda.

Additionally, if we mount all of the partitions, we can see that all of the data on /dev/sdc is now the same as on /dev/sda.

Note: you may have to restart your computer to be able to mount the newly cloned drive.

And that’s it…If you exercise caution and make sure that you’re using the right drives as the input file and output file, dd isn’t anything to be scared of. Unlike other utilities, dd copies absolutely everything from one drive to another – that means that you can even recover filesdeleted from the original drive in the clone!


One of the great things about Linux is that you can do the same thing hundreds of different ways—even something as simple as generating a random password can be accomplished with dozens of different commands. Here’s 10 ways you can do it.

We gathered all of these commands from Command-Line Fu and tested them out on our own Linux PC to make sure they work. You should be able to use at least some of these on Windows with Cygwin installed, though we didn’t test all of them—the last one definitely works though.

Generate a Random Password

For any of these random password commands, you can either modify them to output a different password length, or you can just use the first x characters of the generated password if you don’t want such a long password. Hopefully you’re using a password manager like LastPass anyway so you don’t need to memorize them.

This method uses SHA to hash the date, runs through base64, and then outputs the top 32 characters.

date +%s | sha256sum | base64 | head -c 32 ; echo

This method used the built-in /dev/urandom feature, and filters out only characters that you would normally use in a password. Then it outputs the top 32.

< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c${1:-32};echo;

This one uses openssl’s rand function, which may not be installed on your system. Good thing there’s lots of other examples, right?

openssl rand -base64 32

This one works a lot like the other urandom one, but just does the work in reverse. Bash is very powerful!

tr -cd '[:alnum:]' < /dev/urandom | fold -w30 | head -n1

Here’s another example that filters using the strings command, which outputs printable strings from a file, which in this case is the urandom feature.

strings /dev/urandom | grep -o ':alnum:' | head -n 30 | tr -d '\n'; echo

Here’s an even simpler version of the urandom one.

< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c6

This one manages to use the very useful dd command.

dd if=/dev/urandom bs=1 count=32 2>/dev/null | base64 -w 0 | rev | cut -b 2- | rev

You can even create a random left-hand password, which would let you type your password with one hand.

</dev/urandom tr -dc '12345!@#$%qwertQWERTasdfgASDFGzxcvbZXCVB' | head -c8; echo ""

If you’re going to be using this all the time, it’s probably a better idea to put it into a function. In this case, once you run the command once, you’ll be able to use randpw anytime you want to generate a random password. You’d probably want to put this into your ~/.bashrc file.

randpw(){ < /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c${1:-16};echo;}

You can use this same syntax to make any of these into a function—just replace everything inside the { }

And here’s the easiest way to make a password from the command line, which works in Linux, Windows with Cygwin, and probably Mac OS X. I’m sure that some people will complain that it’s not as random as some of the other options, but honestly, it’s random enough if you’re going to be using the whole thing.

date | md5sum

Yeah, that’s even easy enough to remember.

There’s loads of other ways that you can create a random password from the command line in Linux—for instance, the mkpasswd command, which can actually assign the password to a Linux user account. So what’s your favorite way?

When organizing files and folders i made script to create all folders in one command

All you have to do is create text file with names of each folder you want to create name file folder_list.txt

Create script below with your favorite editor and make sure to make it executable when ready all you have to do is put the script in same path as your text file and you are done this is very handy if you use many folders or have to reinstall system


for _dir in $(cat “$1”); do
mkdir “$_dir”

Finding all .mp3 files and move to new directory from shell prompt


I have mp3 music file all over my file system. I’d like to move them onto specific directory called /mnt/mp3. So how do you find and move all mp3 files to /mnt/mp3 directory?

Simply use find command. It locates all files and then executes a command to move them to /mnt/mp3 (any other directory).

Step # 1: Finding all your .mp3 files

Following will just find all your .mp3 files using find command:

# find / -iname “*.mp3” -print

=> / – Search / root directory
=> -iname – File name search pattern (case insensitive)
=> -print – Display name of files

Step # 2: Finding and moving all your .mp3 files in one pass

Type the following command to find and move all files to /mnt/mp3 directory:
# find / -iname "*.mp3" -exec mv {} /mnt/mp3 \;

  • -exec mv {} /mnt/mp3 \;: Execute mv command. The string ‘{}’ is replaced by the file name. \; ends /bin/mv command.

Tip: You just need to move .mp3 files and not directory, use:
# find / -iname "*.mp3" -type f -exec /bin/mv {} /mnt/mp3 \;

Find all directories having name mp3 and move:
# find / -iname "*.mp3" -type d -exec /bin/mv {} /mnt/mp3 \;

For performance you may need to consider using xargs command:
find / -iname "*.mp3" -type f | xargs -I '{}' mv {} /mnt/mp3

You can also write a script that moves files along with directories. This is also useful to move all files to mp3 player that has been mounted on /mnt/mp3 directory.

  1. #——————————————////
  2. #       Color Commands
  3. #——————————————////
  4. if [ -x /usr/bin/dircolors ]; then
  5.     eval “`dircolors -b`”
  6.     alias ls=’ls –color=auto’
  7.     alias dir=’dir –color=auto’
  8.     alias vdir=’vdir –color=auto’
  9.     alias grep=’grep –color=auto’
  10.     alias fgrep=’fgrep –color=auto’
  11.     alias egrep=’egrep –color=auto’
  12. fi



Ad above code to your bashrc file

Mint Fixer



# Test for UID=0
if [ “$(echo $UID)” != “0” ]
echo “You must be superuser to run this program. Try ‘sudo ./’”

# Add packages you need
echo “install some good packages to have handy.”
apt-get -y install sshfs smbfs irssi vpnc screen vlc mencoder vim moc openssh-server subversion git twinkle curl php5-cli mutt clusterssh html2text autofs vncviewer &> /dev/null

# Turn off guest login
echo “Turning off guest login.”
grep -q “allow-guest=false” /etc/lightdm/lightdm.conf || echo “allow-guest=false” >> /etc/lightdm/lightdm.conf

# Fix dual monitors
echo “Fixing dual monitor mode so that both monitors reflect changing virtual desktops.”
gconftool-2 –set /desktop/gnome/shell/windows/workspaces_only_on_primary –type bool false

# Fix broken login chime
echo “Fixing broken login chime.”
for user in $(ls /home)
mv /home/$user/.config/autostart/libcanberra-login-sound.desktop /home/$user/.config/autostart/libcanberra-login-sound.desktop.orig
echo -e “[Desktop Entry]\nType=Application\nName=GNOME Login Sound\nComment=Plays a sound whenever you log in\nExec=/usr/bin/canberra-gtk-play -f /usr/share/sounds/linuxmint-login.wav\nOnlyShowIn=GNOME;Unity;\nAutostartCondition=GSettings org.gnome.desktop.sound event-sounds\nX-GNOME-Autostart-Phase=Application\nX-GNOME-Provides=login-sound” >> /home/$user/.config/autostart/libcanberra-login-sound.desktop

# Set the login page wallpaper
echo “Setting the login background to /usr/share/backgrounds/mint.jpg. Copy any background you wish to be the login wallpaper to that file.”
sed -i -e ‘s/^background.*/background=\/usr\/share\/backgrounds\/mint.jpg/g’ /etc/lightdm/unity-greeter.conf

echo “All done. Enjoy!”

First time this happened! A coworker asked me today how to get into his Linux Mint box after he forgot his password. Of course I rattled off the old GRUB way to get things done, but, what?? This is GRUB 2! No so fast there! Turns out it’s quite different.

You hold down the shift key while booting to get to the grub menu.
You hit ‘e’ to edit your boot options.
You change the kernel line options on the very end of the kernel line to read “rw init=/bin/bash”.
You press F10 to boot.

Once booted you are dropped immediately into a shell prompt where you can change your password with the “passwd username” command. Reboot and you’re home free!