$ sudo FIXIT!!
We've moved! Find our new home at https://yingtongli.me/blog/
Saturday, July 20, 2013
Wednesday, July 17, 2013
GUIDE: Restoring Windows Vista/7 backup files under Linux
If you've recently upgraded from Windows to Linux but now need to restore the backup files you made with Windows Backup (or need to restore someone else's), you've come to the right place!
The Windows Backup Format
Unlike the Windows NT BKF backup format, the Windows Vista/7 Backup utility uses regular ol' zip files to store data. Well, almost. Windows Backup (for some reason) splits the backups it makes into many parts, making restoring the files a pain. On my system, I got over 1000 zip files.
Microsoft's webpage suggests opening these (over 1000) zip files one by one to try and find my file. Yeah, right.
Luckily for us, the awesome power of BASH automation makes the job surprisingly simple.
Microsoft's webpage suggests opening these (over 1000) zip files one by one to try and find my file. Yeah, right.
Luckily for us, the awesome power of BASH automation makes the job surprisingly simple.
What to do
Let's say that I want to recover the file Mr Bean at the Olympics.mp4 from my backups (true story!).
- Open up a terminal window.
- cd to the directory where the many, many zip files are stored.
cd "/media/Seagate Expansion Drive/MY-LAPTOP/Backup Set 2013-06-10 103426" - Run the following command, replacing the file name with the one you are looking for:
for f in *.zip; do echo $f; unzip -l "$f" | grep 'Mr Bean at the Olympics.mp4'; done; - A whole bunch of zip file names will flash by. Look for the line(s) that look something like
Backup files 647.zip
19129617 2013-06-10 15:48 C\Users\User\Desktop\Mr Bean at the Olympics.mp4 - This tells us that the file is located inside Backup files 647.zip.
- If you have too many zip files, you can use the alternative command:
for f in *.zip; do echo $f>>/tmp/a.txt; unzip -l "$f" | grep 'Mr Bean at the Olympics.mp4'>>/tmp/a.txt; done;
This will save the results of the search in /tmp/a.txt. Open this file up and use the search feature to find the relevant lines.
File listed in one zip file
If the output you got from the above command looks something like
Backup files 647.zip
19129617 2013-06-10 15:48 C\Users\User\Desktop\Mr Bean at the Olympics.mp4
19129617 2013-06-10 15:48 C\Users\User\Desktop\Mr Bean at the Olympics.mp4
then congratulations! You get the easy way out. All you need to do is open up the relevant zip file and extract your file.
File listed in more than one zip file
If the output you got from the above command looks something like
Backup files 647.zip
19129617 2013-06-10 15:48 C\Users\User\Desktop\Mr Bean at the Olympics.mp4
19129617 2013-06-10 15:48 C\Users\User\Desktop\Mr Bean at the Olympics.mp4
Backup files 648.zip
19129617 2013-06-10 15:48 C\Users\User\Desktop\Mr Bean at the Olympics.mp4
19129617 2013-06-10 15:48 C\Users\User\Desktop\Mr Bean at the Olympics.mp4
Backup files 649.zip
19129617 2013-06-10 15:48 C\Users\User\Desktop\Mr Bean at the Olympics.mp4
19129617 2013-06-10 15:48 C\Users\User\Desktop\Mr Bean at the Olympics.mp4
then unfortunately, there's a bit more work involved.
- Open up the first zip file (in this case, Backup files 647.zip).
- Extract the file.
- Rename the file, giving it a sensible name, putting -1 at the end (in this case, it would be Mr Bean at the Olympics.mp4-1).
- Go through the rest of the zip files, repeating steps 1 to 3, but using -2 and -3 and so on.
- You should now have several files:
Mr Bean at the Olympics.mp4-1
Mr Bean at the Olympics.mp4-2
Mr Bean at the Olympics.mp4-3
... - Go to the terminal and type:
cat "Mr Bean at the Olympics.mp4-1">>"Mr Bean at the Olympics.mp4"
cat "Mr Bean at the Olympics.mp4-2">>"Mr Bean at the Olympics.mp4"
and so on. - Finished! You can now delete all the -1 and -2... files.
Sunday, July 14, 2013
GUIDE: Downloading MMS/RTSP/HTTP/etc streams with VLC
We all know that if you use YouTube, you can download the video from Keepvid or something. But what if your content provider uses some crazy streaming system? For example, one website (which shall remain nameless) that I use uses MMS to serve videos.
Disclaimer
Doing this may be a violation of the Terms of Service of your content provider. Check first, or risk the consequences!The Steps
- Download and install VLC media player from the VideoLAN webpage, or through your distribution's software channels.
- Open VLC media player.
- From the Media menu, select Open Network Stream.
- Enter the URL of the stream you want to download and click the arrow next to the Play button. From the menu that appears, select Convert.
- Press the Browse button.
- Choose where you want to save the video and click Save.
- Unless you have a good reason not to, click the Dump raw input button.
- Click Start.
That's it! Hopefully, VLC will return you to the player window and the play button should turn into a pause button. This means that VLC has started saving the stream. When the pause button turns back into a play button, that means that VLC has finished.
Note: The player window will remain black while VLC is downloading the video. Don't panic! So long as the play button has turned into a pause button, the video is downloading.
If you want to watch the video while it downloads, open the video file in a separate window of VLC.
Thursday, July 11, 2013
Uplink Linux: libjpeg.so.62
If, after updating Uplink, you get the following error message:
error while loading shared libraries: libjpeg.so.62: cannot open shared object file: No such file or directory
The solution is to install the package libjpeg62. If you are on a 64-bit system, make sure to install the 32-bit version!
On a 32-bit Ubuntu system:
sudo apt-get install libjpeg62
On a 64-bit Ubuntu system:
sudo apt-get install libjpeg62:i386