Tag Archives: Linux

Trick: Bulk Download 100+ Wallpapers from Microsoft Website

Microsoft Website has a good selection of HD Wallpapers. However, it’s hard to click on each image and download individually. There are some ways to bulk download images using some software tools or browser extensions but either those tools are confusing to me or require purchase to download files without any limitations. So, I was determined to find a better way.

You’ll need Linux. In my case I used my Ubuntu Server.

The page where all the wallpapers are is this.

First we need to get all anchors in that page. There are several methods. You can download the webpage in an HTML file and use a tool to extract links. Here, I’m going to use a neat trick using Lynx. I’ll use Lynx to dump all the links found on the page, and then use standard Linux tools (grep and cut) to get the links we really want.

Speaking of relevant links, the general pattern I found on MS website for image links is:


I found that all the links contain word “main”. That’s what I’m going to use as the keyword to extract only the relevant links. Of course, you can be a bit more precise, and use a pattern like “resX.windows.microsoft.com” or whatever you feel like.

So here’s my command to get all the image links

lynx -dump -listonly http://windows.microsoft.com/en-us/windows/wallpaper?T1=all | cut -d ‘ ‘ -f 2 | grep main > wallpapers.txt

A quick check for wallpapers.txt reveals that we have 248 images

cat wallpapers.txt | wc -l

However, we have duplicates! So we need to remove the duplicates

sort wallpapers.txt | uniq > wallpapers_nodups.txt

Now we’ll have about 124 wallpapers ready to download.

Next, I simply use wget to download all images in the file

wget -i wallpapers_nodups.txt

This will take a few minutes depending upon your internet speed but you will get all the wallpapers! In my case it took under 3 mins to download 124 wallpapers.

Finally, I will move these wallpapers to a shared location that’s accessible from my Windows machine.

NOTE: this trick was used to bulk download wallpapers from Microsoft’s website. With a little bit of modification you bulk download any file from any website.

UPDATE: Trick 2 to download 4K wallpapers. Read here

Adding a user to the sudo file

Configuring SUDO
1. Open a terminal.
2. In the terminal enter the following:

su –login -c ‘visudo’

3. Press enter, at the password prompt enter the password for root, then press enter.
4. A display similar to the following will be displayed:

# sudoers file.
## This file MUST be edited with the ‘visudo’ command as root.
## See the sudoers man page for the details on how to write a sudoers file.## Host alias specification# User alias specification
# Cmnd alias specification# Defaults specification# Runas alias specification# User privilege specification
root ALL=(ALL) ALL
# Uncomment to allow people in group wheel to run all commands
# %wheel ALL=(ALL) ALL
# Same thing without a password
# Samples
# %users ALL=/sbin/mount /cdrom,/sbin/umount /cdrom
# %users localhost=/sbin/shutdown -h now

5. Below the line root ALL=(ALL) ALL add the user that you want to have root access as shown below:

sglaser ALL=(ALL) ALL

6. If you *want* sudo to prompt for a password, use the arrow keys to go down to the line that reads “# %wheel ALL=(ALL) ALL” and delete the # at the beginning of the line using the ‘x’ key (NOTE: it’s your own password, not roots).
7. If you do *NOT* want sudo to prompt for a password, use the arrow keys to go down to the line that reads “# %wheel ALL=(ALL) NOPASSWD: ALL” and delete the # at the beginning of the line using the ‘x’ key.
Once you have uncommented one of the lines, press “ESC” then enter the following to save the changes :
8. OPTIONAL: If you want to be able to use sudo without having to type the full root path every time (e.g.: /sbin/fdisk), on a per-user instead of system-wide default, then you should prefix root’s command path to your user’s PATH variable in ~/.bash_profile. Change it to:

9. To add users to the Wheel Group from the command line perform the following:

su -c ‘gpasswd -a username wheel’

At the password prompt enter the password for the root user, then press enter.

Reference: http://fedorasolved.org/post-install-solutions/sudo

Installing Ruby on Rails on Fedora 16

I had somewhat of a hard time setting up a machine for my Ruby on Rails experiments but fortunately I was able to set up one after banging my head on the wall several times and with the help of several internet articles. So, here’s what I did:

1. First make sure you have apache, curl, git, mysql, sqlite and node.js installed (You might not need all of them). For this simply run the following command:

sudo yum install -y httpd, curl, git, mysql, mysql-server, sqlite, sqlite-devel, nodejs

If you can’t get nodejs installed, try the following command:

sudo yum install –nogpgcheck http://nodejs.tchol.org/repocfg/fedora/nodejs-stable-release.noarch.rpm

2. Next, install RVM (Ruby Version Manager)

curl -L get.rvm.io | bash -s stable
source ~/.rvm/scripts/rvm

Find other requirements for RVM, and install those too

rvm requirements

3. Install Ruby

rvm install 1.9.3

This will install both Ruby and Rubygems. If you get an error while installing rubygems, such as the following:
The requested url does not exist: ‘http://production.cf.rubygems.org/rubygems/rubygems-1.8.24.tgz’
Trying ftp:// URL instead.
curl: (6) Could not resolve host: production.cf.rubygems.org; Name or service not known
There was an error, please check /home/vikram/.rvm/log/ruby-1.9.2-p320/*.log
There has been an error while trying to fetch the source.
Halting the installation

You will have to install Rubygems separately. Otherwise skip to Step 5

Check Ruby version

ruby -v

4. Install Rubygems
Download http://production.cf.rubygems.org/rubygems/rubygems-1.8.24.tgz

wget http://production.cf.rubygems.org/rubygems/rubygems-1.8.24.tgz

Extract the file

tar -zxvf rubygems-1.8.24.tgz


cd rubygems-1.8.24
ruby setup.rb

5. Set default Ruby version

rvm use 1.9.3 –default

6. Install Rails

gem install rails

This will take a moment

7. Check Rails version

rails -v

Fortunately, it worked for me! If you run into additional problems check the following websites:
RVM: https://rvm.io/
Node.js: http://nodejs.tchol.org/
Rails: http://rubyonrails.org/download
Gems: http://rubygems.org/pages/download

UPDATE: Fedora 17 has a Ruby 1.9.3 yum package. After you install that, install rails (Step 6)