Parking Page on Cloud Storage

Now that I’m using Google Domains, I thought that it only appropriate to have my parking page on Google Cloud Storage. It turned out to be pretty easy.

  1. Create a Google Cloud Storage bucket with your desired website name. You may need to prove that you control the domain before creating the bucket. In my case, Google knew that because they were the registrar.
  2. Build your static parking page. I started with the Grayscale template from Start Bootstrap and made my changes.
  3. Copy the static content up to Google Cloud Storage.
    1
    2
    3
    4
    
    gsutil cp -a public-read -R * gs://www.dwightshih.com
    # -a public-read gives the requester OWNER permission
    #    and all other users READ permission
    # -R for recursive copy
    
  4. Update the bucket configuration to serve index.html when a bucket listing is requested via the CNAME alias.
    1
    2
    
    gsutil web set -m index.html gs://www.dwightshih.com
    # use -e <404.html> to specify an error page
    
  5. Update your DNS CNAME alias to c.storage.googleapis.com:
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    
    $ dig www.dwightshih.com
    
    ; <<>> DiG 9.8.3-P1 <<>> www.dwightshih.com
    ;; global options: +cmd
    ;; Got answer:
    ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 28866
    ;; flags: qr rd ra; QUERY: 1, ANSWER: 3, AUTHORITY: 0, ADDITIONAL: 0
    
    ;; QUESTION SECTION:
    ;www.dwightshih.com.		IN	A
    
    ;; ANSWER SECTION:
    www.dwightshih.com.	3600	IN	CNAME	c.storage.googleapis.com.
    c.storage.googleapis.com. 1055	IN	CNAME	storage.l.googleusercontent.com.
    storage.l.googleusercontent.com. 229 IN	A	64.233.171.128
    
    ;; Query time: 58 msec
    ;; SERVER: 10.0.1.1#53(10.0.1.1)
    ;; WHEN: Mon Sep  1 16:48:08 2014
    ;; MSG SIZE  rcvd: 129
    

And voilà, your static page should be up.

Smalltalk and Me

I never had the opportunity to write an application in Smalltalk.

I was a fortran programmer back in the late 80’s. Exposure to Unix had opened my eyes to a whole new world of possibilities in software. And I was a regular at the Sunnyvale Computer Literacy, trying to learn more about those possibilities. One of those possibilities was Smalltalk, or more precisely Little Smalltalk. I read the book. I obtained the source on 9 track tape. And I surreptitiously installed it on the superminicomputer at work.

And that was my introduction to the wonderful world of objects. They say that “You can write a Fortran program in any language” And I’ve certainly seen my share of Java code that is best described as C with garbage collection. In Smalltalk, everything is an object. And with its devotion to that mantra, Smalltalk was perhaps the best language to start object oriented programming.

The Platform Wins

Hmmm. You would think that I would have learned my lesson when I picked TextPattern over WordPress.

The Platform Wins

I was idlely searching for GitHub on the IOS App Store and I found OctoPage, an app for jekyll on github pages. And I couldn’t resist. So I spent $0.99 plus tax and took it for a spin.

The verdict? Not quite ready for prime time. OctoPage needs some more polish when authoring posts. And it would be really nice if it were a universal app rather than iPhone only.

But the fact that it exists, along with Jekyll on GitHub pages and Jekyll Themes and Octopress, is a strong statement that Jekyll really is the static weblog platform. And that I need to re-think my move to Hexo.

Jekyll on the Go

The more I play with jekyll on GitHub pages, the more I like it.

The big downside to a static weblog is how to post on the go. In my case, this means posting from an iPad. The nice thing about GitHub is that you can update your repository from a browser. If you know the jekyll file naming syntax, then blogging from the browser is pretty straight-forward. Here’s my workflow:

  1. Author the post in Editorial
    • Copy the front matter from an existing post as a starting point
  2. Use the GitHub web interface to create a new file:
    • Name the file ccyy-mm-dd-post-link.md
    • Paste the content in from Editorial
  3. Commit the new file

Bingo. You have a new post. I’m not leaving hexo, but jekyll might be my top recommendation for a new technically proficient blogger.

emacs, windows, and ack

I just had to migrate to a new work computer and it took a bit of remembering to get ack working from emacs. For next time, here are the instructions for getting it to work.

  1. Install Perl
  2. Add the perl bin and site bin to the Windows Path
  3. Download the single file version of ack to the site bin (note the .pl extension):
    1
    
    curl http://beyondgrep.com/ack-2.12-single-file > c:\Strawberry\perl\site\bin\ack.pl
    
  4. Associate the .pl Extension with perl by running the following lines as an administrator:
    1
    2
    
    assoc .pl=PerlScript
    ftype PerlScript=C:\Strawberry\bin\perl.exe "%1" %*
    
    This assumes that you’ve installed Strawberry Perl to the default installation directory.
  5. Define an ack function for use in emacs (see Stack Overflow on ack in Emacs on Windows):
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    
    (defvar ack-command "ack --nogroup --nocolor ")
    (defvar ack-history nil)
    (defvar ack-host-defaults-alist nil)
    (defun ack ()
      "Like grep, but using ack-command as the default"
      (interactive)
      ; Make sure grep has been initialized
      (if (>= emacs-major-version 22)
          (require 'grep)
        (require 'compile))
      ; Close STDIN to keep ack from going into filter mode
      (let ((null-device (format "< %s" null-device))
            (grep-command ack-command)
            (grep-history ack-history)
            (grep-host-defaults-alist ack-host-defaults-alist))
        (call-interactively 'grep)
        (setq ack-history             grep-history
              ack-host-defaults-alist grep-host-defaults-alist)))
    

Custom Domain with GitHub Pages

It’s pretty simple to use a custom domain for your GitHub Page. Start by reading GitHub Pages Basics and then follow the directions.

Here’s what I did:

Update DNS in Route53

  1. Login to your Amazon Web Services Console
  2. Go to Route53
  3. Go to Hosted Zones
  4. Select the Domain Name and Go to Record Sets
  5. Select “Create Record Set”
  6. Add a CNAME Record from your desired custom name to your github page. In my case, I created a CNAME record named “github.ideoplex.com” and directed it to “ideoplex.github.io”.

Verify your DNS setting from the command line with dig:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
~ 17 $ dig github.ideoplex.com

; <<>> DiG 9.8.3-P1 <<>> github.ideoplex.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 38421
;; flags: qr rd ra; QUERY: 1, ANSWER: 3, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;github.ideoplex.com.		IN	A

;; ANSWER SECTION:
github.ideoplex.com.	2558	IN	CNAME	ideoplex.github.io.
ideoplex.github.io.	2558	IN	CNAME	github.map.fastly.net.
github.map.fastly.net.	23	IN	A	23.235.46.133

;; Query time: 43 msec
;; SERVER: 10.0.1.1#53(10.0.1.1)
;; WHEN: Sat Aug  2 17:53:29 2014
;; MSG SIZE  rcvd: 120

You want to see your custom domain name (github.ideoplex.com) aliased to your github user page (ideoplex.github.io) aliased to something (github.map.fastly.net) that references an ip address (23.235.46.133).

Add a CNAME record to your repository

The GitHub instructions to add a CNAME record are straight forward.

  1. Identify the correct branch.
    • Use master for user and organization pages
    • Use gh-pages for project pages
  2. Add a new file named CNAME (all caps) to the branch root directory
  3. Add a single line to the CNAME file that specifies the bare subdomain for your page (in my case, github.ideoplex.com)

Verify the CNAME behavior with curl:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
~ 18 $ curl -I http://ideoplex.github.io/
HTTP/1.1 301 Moved Permanently
Server: GitHub.com
Content-Type: text/html
Location: http://github.ideoplex.com/
Expires: Sat, 02 Aug 2014 22:20:01 GMT
Cache-Control: max-age=600
Content-Length: 178
Accept-Ranges: bytes
Date: Sat, 02 Aug 2014 22:10:01 GMT
Via: 1.1 varnish
Age: 0
Connection: keep-alive
X-Served-By: cache-iad2120-IAD
X-Cache: MISS
X-Cache-Hits: 0
X-Timer: S1407017401.351397276,VS0,VE1
Vary: Accept-Encoding

Here you want to see that your old github page url (http://ideoplex.github.io/) is redirected to your custom domain name (http://github.ideoplex.com).

Wait

This was the hardest part. The first two steps took a couple of minutes, but it can take ten minutes for the changes to take effect at GitHub.

Infrastructure Updates

New Theme

I’ve switched from the default landscape theme to the biture theme. I’ll miss landscape, but regenerating the site in landscape took about 27 minutes vs about 8 seconds for biture. I think I’ll keep those 27 minutes per post.

S3 Update

My S3 hosting bill continues to run just over $0.60/month. I like those numbers.

The Long Game

Skate to where the puck’s going, not where it’s been.

If anything, this quote understates the difficulty of what Apple has done. Apple started work on the new Swift Language four years ago. That is like a football team putting in an offense for a defensive scheme that no one is playing yet.

I suspect that not all Apple’s long bets pay off. But I don’t see anyone else even making a long bet.

Wall Wart Woes

The EU has already standardized cellphone chargers. I wish they would hurry up and standardize external DC power supplies as well.

A four legged member of my family chewed up the wall wart powering our cordless phone. The OEM power adapter isn’t readily available and I wasn’t going to buy an aftermarket replacement without knowing it would work. I ended up buying a new phone. The new phone’s adapters have split loom tubing to protect them from the same fate.

Now I have a cordless phone in good condition that is destined for recycling. I’m trying to find a replacement OEM adapter via eBay so that I can give it to Goodwill. It would have been so much easier if someone forced the consumer electronics companies to use standard wall warts.

Jekyll on GitHub Pages Part 2

In the process of writing Jekyll on Github Pages, I became quite proficient in deploying a Jekyll blog to GitHub pages. Here is how I did it:

  1. Create a github repository names username.github.io, where username is your GitHub username as described in the Github Pages documentation.

  2. Create a new jekyll blog on your local machine

    1
    2
    
    sites/jekyll 1 $ jekyll new github.pages
    New jekyll site installed in /Projects/sites/jekyll/github.pages.
    
  3. Initialize your jekyll configuration. Note that I’ve added support for Git Flavored Markdown in the kramdown configuration.

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    
    sites/jekyll 2 $ cd github.pages
    jekyll/github.pages 3 $ vi _config.yml
    jekyll/github.pages 4 $ cat _config.yml
    # Site settings
    title: Getting Started with Jekyll
    email: 
    description: "Sample Jekyll blog hosted on GitHub pages"
    baseurl: ""
    url: http://ideoplex.github.io
    
    # Build settings
    markdown:
     kramdown
    kramdown:
     input: GFM
    permalink: pretty
    
  4. Delete the default first post created by jekyll

    1
    
    jekyll/github.pages 5 $ rm _posts/201?-??-??-welcome-to-jekyll.markdown
    
  5. Create your own first post. My first post contains these instructions.

    1
    
    jekyll/github.pages 6 $ vi _posts/2014-05-14-upload-to-github-pages.md
    
  6. Add a README.me

    1
    2
    3
    
    jekyll/github.pages 7 $ echo '#Deploy a Jekyll blog to GitHub pages
    
    Example of a Jekyll blog deployed on GitHub pages' > README.md
    
  7. Initialize your local git repository:

    1
    2
    
    jekyll/github.pages 8 $ git init
    Initialized empty Git repository in /Projects/sites/jekyll/github.pages/.git/
    
  8. Add everything and make your first commit

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    
    jekyll/github.pages 9 $ git add --all
    jekyll/github.pages 10 $ git commit -m "first commit"
    [master (root-commit) 223ac2c] first commit
     14 files changed, 710 insertions(+)
     create mode 100644 .gitignore
     create mode 100644 README.md
     create mode 100644 _config.yml
     create mode 100644 _includes/footer.html
     create mode 100644 _includes/head.html
     create mode 100644 _includes/header.html
     create mode 100644 _layouts/default.html
     create mode 100644 _layouts/page.html
     create mode 100644 _layouts/post.html
     create mode 100644 _posts/2014-05-14-upload-to-github-pages.md
     create mode 100644 about.md
     create mode 100644 css/main.css
     create mode 100644 feed.xml
     create mode 100644 index.html
    
  9. Set your github pages repository as the remote, and push

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    
    jekyll/github.pages 11 $ git remote add origin https://github.com/ideoplex/ideoplex.github.io.git
    jekyll/github.pages 12 $ git push -u origin master
    Counting objects: 20, done.
    Delta compression using up to 8 threads.
    Compressing objects: 100% (18/18), done.
    Writing objects: 100% (20/20), 7.82 KiB | 0 bytes/s, done.
    Total 20 (delta 1), reused 0 (delta 0)
    To https://github.com/ideoplex/ideoplex.github.io.git
     * [new branch]      master -> master
    Branch master set up to track remote branch master from origin.
    
  10. Congratulations, your blog will shortly be available on GitHub pages.