Blog 1

Random Talk on Random Thoughts

One Use of Google Cache

| Comments |

Problem

This Thursday, I wanted to browse Evsseny’s article about setting up a Jekyll site using Jekyll-Bootstrap on a GitHub project page.1 Unluckily, this site had been blocked for the administrator.

</source> web site blocked

How can I view the contents of the page?

Solution

Use Google’s web cache.

  1. Search “http://www.your-blocked-site.com/path/to/your/page” on Google.

    </source> google the blocked URL
  2. Click the down arrow next to the URL.

    </source> click the down arrow and "cached"
  3. Click the first item in the pop-up menu.

Finally, I could read the contents of the post.

</source> google the blocked URL

Lessons learnt

  1. Define new variables in shell scripts.
  2. Use s/foo/bar/ in sed for manipulating the name of the output files.

The screenshots were intially under the home folder ~ and their names were like temp_foo.png or temp_bar.png so that they would stay close to each other in Nautilus. However, when I included these PNG files under the directory ~/octopress/source/images/flalign_spacing for uploading them to this blog, I wouldn’t like to keep temp_ because they’re already in a separate folder. Therefore, I wrote a script to do this.

Since mv can overwrite files and commands can be wrongly typed, I used cp instead of mv so that the original files wouldn’t disappear even though something went wrong. If everything proceeds smoothly, then the old files in the home folder can then be safely deleted.

A little script for moving the files (custom-move.sh) download
1
2
3
4
5
6
#!/bin/bash
for f in $(ls *.png) ; do
    newf=`echo $f | sed 's/temp_//'`
    echo $f $newf
    cp -v $f ~/octopress/source/images/posts/UseGooCache/$newf
done

If I use single quotes to surround the destination (e.g. '~/.../$newf'), the syntax highlighting for $newf will be gone in Vim. Therefore, I used double quotes "" instead, but I then received errors similar to the one below from cp.

cp: cannot create regular file `/home/octopress/source/images/posts/UseGooCache/
blocked300.png': No such file or directory

  1. 在github的Project Pages上部署jekyll
    The original link http://evsseny.appspot.com/?p=63001 is dead now. 

Comments