aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZhiming Wang <zmwangx@gmail.com>2015-05-04 18:45:17 -0700
committerZhiming Wang <zmwangx@gmail.com>2015-05-04 18:45:17 -0700
commit07bf43a314fe65ccd9c7cb663c3c6134a47cc269 (patch)
tree93104d3f07143b1e62d773d95dd973888cdd7f27
parentee374553f2ba385157eec9a816cf9b023fbfb18a (diff)
downloadmy_new_personal_website-07bf43a314fe65ccd9c7cb663c3c6134a47cc269.tar.xz
my_new_personal_website-07bf43a314fe65ccd9c7cb663c3c6134a47cc269.zip
edit posts and (mostly) figured out the theme
Also wrote pyblog that currently can generate parts most of the blog.
-rwxr-xr-xpyblog145
-rw-r--r--source/blog/2014-10-23-ripping-copy-protected-dvd-with-mpv.md2
-rw-r--r--source/blog/2014-10-26-audio-cd-slash-dvd-to-iso-image-on-os-x.md2
-rw-r--r--source/blog/2014-11-02-vobcopy-dvdbackup-etc.md2
-rw-r--r--source/blog/2014-11-19-convolution-of-irreducible-characters.md2
-rw-r--r--source/blog/2014-11-20-dropbot-for-geeks(r).md5
-rw-r--r--source/blog/2014-11-24-why-i-abandoned-mathjax-and-fell-back-to-pdf.md2
-rw-r--r--source/blog/2014-12-05-python-3-and-unicode.md6
-rw-r--r--source/blog/2015-01-10-fonts-why-chinese-web-design-is-hard.md4
-rw-r--r--source/blog/2015-01-21-web-design-microsoft-vs-apple.md7
-rw-r--r--source/blog/2015-02-17-microsoft-is-getting-cool-but-not-its-website.md2
-rw-r--r--source/blog/2015-02-24-the-new-onedrive-api.md2
-rw-r--r--source/blog/2015-05-03-why-oh-my-zsh-is-completely-broken.md19
-rw-r--r--source/css/normalize.css427
-rw-r--r--source/css/theme.css90
-rw-r--r--source/index.md10
-rw-r--r--templates/template.html63
-rwxr-xr-xtools/convert-from-octopress.awk36
18 files changed, 796 insertions, 30 deletions
diff --git a/pyblog b/pyblog
new file mode 100755
index 00000000..df701ba1
--- /dev/null
+++ b/pyblog
@@ -0,0 +1,145 @@
+#!/usr/bin/env python3
+
+"""A simple blog generator with Pandoc as backend."""
+
+import argparse
+import os
+import re
+import shutil
+import subprocess
+import sys
+
+
+ROOTDIR = os.path.dirname(os.path.realpath(__file__))
+SOURCEDIR = os.path.join(ROOTDIR, "source")
+INDEX = os.path.join(SOURCEDIR, "index.md")
+TEMPLATEDIR = os.path.join(ROOTDIR, "templates")
+HTMLTEMPLATE = os.path.join(TEMPLATEDIR, "template.html")
+BUILDDIR = os.path.join(ROOTDIR, "build")
+
+
+# TODO:
+def new_post():
+ pass
+
+
+# TODO:
+def generate_index():
+ pass
+
+
+def generate(fresh=False):
+ """Generate the blog in BUILDDIR.
+
+ Parameters
+ ----------
+ fresh : bool
+ If True, remove all existing build artifects and start afresh;
+ otherwise, only copy or build new or modified files. Default is
+ False.
+
+ Returns
+ -------
+ failed_builds : int
+ Number of build failures.
+
+ """
+
+ # pylint: disable=too-many-branches
+
+ if not os.path.isdir(SOURCEDIR):
+ raise OSError("source directory %s does not exist" % SOURCEDIR)
+ if not os.path.exists(HTMLTEMPLATE):
+ raise OSError("HTML template %s not found" % HTMLTEMPLATE)
+
+ if not os.path.isdir(BUILDDIR):
+ if os.path.exists(BUILDDIR):
+ os.remove(BUILDDIR)
+ os.mkdir(BUILDDIR, mode=0o755)
+ if fresh:
+ for name in os.listdir(BUILDDIR):
+ if name == ".git":
+ continue
+ obj = os.path.join(BUILDDIR, name)
+ if os.path.isdir(obj):
+ shutil.rmtree(obj)
+ else:
+ os.remove(obj)
+
+ failed_builds = 0
+
+ for root, _, files in os.walk(SOURCEDIR):
+ relroot = os.path.relpath(root, start=SOURCEDIR)
+ dstroot = os.path.join(BUILDDIR, relroot)
+ if not os.path.isdir(dstroot):
+ if os.path.exists(dstroot):
+ os.remove(dstroot)
+ os.mkdir(dstroot, mode=0o755)
+
+ for name in files:
+ extension = name.split(".")[-1]
+ if extension not in ["css", "md"]:
+ continue
+
+ relpath = os.path.join(relroot, name)
+ srcpath = os.path.join(root, name)
+ if extension == "md":
+ dstpath = os.path.join(dstroot, re.sub(r'\.md$', '.html', name))
+ else:
+ dstpath = os.path.join(dstroot, name)
+ if ((not os.path.exists(dstpath) or
+ os.path.getmtime(dstpath) <= os.path.getmtime(srcpath))):
+ if extension == "css":
+ sys.stderr.write("copying %s\n" % relpath)
+ shutil.copy(srcpath, dstpath)
+ elif extension == "md":
+ sys.stderr.write("generating %s\n" % relpath)
+ pandoc_args = [
+ "pandoc", srcpath,
+ "--template", HTMLTEMPLATE,
+ "--highlight-style=pygments",
+ "-o", dstpath,
+ ]
+ try:
+ subprocess.check_call(pandoc_args)
+ except subprocess.CalledProcessError:
+ failed_builds += 1
+ sys.stderr.write("error: failed to generate %s" %
+ relpath)
+
+ sys.stderr.write("build finished with %d errors\n" % failed_builds)
+ return failed_builds
+
+
+# TODO:
+def deploy():
+ pass
+
+
+# TODO: regenerate and deploy
+def gen_deploy():
+ pass
+
+
+# TODO: start HTTP server in another process and watch for changes
+def preview():
+ pass
+
+
+def main():
+ """CLI interface."""
+ description = "Simple blog generator in Python with Pandoc as backend."
+ parser = argparse.ArgumentParser(description=description)
+ parser.add_argument('action', choices=[
+ 'generate', 'regenerate',
+ ])
+ args = parser.parse_args()
+
+ if args.action == 'generate':
+ exit(generate(fresh=False))
+ elif args.action == 'regenerate':
+ exit(generate(fresh=True))
+
+
+if __name__ == '__main__':
+ main()
diff --git a/source/blog/2014-10-23-ripping-copy-protected-dvd-with-mpv.md b/source/blog/2014-10-23-ripping-copy-protected-dvd-with-mpv.md
index 6d1f983b..f017ca7e 100644
--- a/source/blog/2014-10-23-ripping-copy-protected-dvd-with-mpv.md
+++ b/source/blog/2014-10-23-ripping-copy-protected-dvd-with-mpv.md
@@ -5,7 +5,7 @@ date-display: October 23, 2014
---
**_11/02/2014 update:_**
-See [this post](/blog/2014/11/02/vobcopy-dvdbackup-etc/) for issues, explanations, and more.
+See [this post](/blog/2014-11-02-vobcopy-dvdbackup-etc.html) for issues, explanations, and more.
---
diff --git a/source/blog/2014-10-26-audio-cd-slash-dvd-to-iso-image-on-os-x.md b/source/blog/2014-10-26-audio-cd-slash-dvd-to-iso-image-on-os-x.md
index 61504a15..600a890d 100644
--- a/source/blog/2014-10-26-audio-cd-slash-dvd-to-iso-image-on-os-x.md
+++ b/source/blog/2014-10-26-audio-cd-slash-dvd-to-iso-image-on-os-x.md
@@ -5,7 +5,7 @@ date-display: October 26, 2014
---
**_11/02/2014 update:_**
-See [this post](/blog/2014/11/02/vobcopy-dvdbackup-etc/) for issues, explanations, and more.
+See [this post](/blog/2014-11-02-vobcopy-dvdbackup-etc.html) for issues, explanations, and more.
---
diff --git a/source/blog/2014-11-02-vobcopy-dvdbackup-etc.md b/source/blog/2014-11-02-vobcopy-dvdbackup-etc.md
index 0bb4b94f..a6caf233 100644
--- a/source/blog/2014-11-02-vobcopy-dvdbackup-etc.md
+++ b/source/blog/2014-11-02-vobcopy-dvdbackup-etc.md
@@ -3,7 +3,7 @@ title: "vobcopy, dvdbackup, etc."
date: 2014-11-02 15:06:07 -0800
date-display: November 2, 2014
---
-A few days ago, I was cloning my entire Audio CD and DVD collection, and reported some of the findings in [this post](/blog/2014/10/26/audio-cd-slash-dvd-to-iso-image-on-os-x/). As said, the most important commands are
+A few days ago, I was cloning my entire Audio CD and DVD collection, and reported some of the findings in [this post](/blog/2014-10-26-audio-cd-slash-dvd-to-iso-image-on-os-x.html). As said, the most important commands are
hdiutil makehybrid -iso -joliet -o AUDIO_CD_NAME.iso SOURCE
diff --git a/source/blog/2014-11-19-convolution-of-irreducible-characters.md b/source/blog/2014-11-19-convolution-of-irreducible-characters.md
index 58a58925..9b95ca94 100644
--- a/source/blog/2014-11-19-convolution-of-irreducible-characters.md
+++ b/source/blog/2014-11-19-convolution-of-irreducible-characters.md
@@ -9,6 +9,6 @@ __*TL; DR:* The actual PDF write-up is [here](https://dl.bintray.com/zmwangx/gen
Yesterday I was trying to establish the formula for orthogonal primitive central idempotents of a group ring. It is possible to establish the result through the convolution of irreducible characters. However, I stuck quite a while on trying to work out the convolutions themselves. For a formidable and unenlightening proof using "matrix entry functions" (i.e., fix a basis, induce a matrix representation, and explicitly expand everything in matrix elements), see [this post](http://drexel28.wordpress.com/2011/03/02/representation-theory-using-orthogonality-relations-to-compute-convolutions-of-characters-and-matrix-entry-functions/) (in fact, this is just one in a series of posts that lead up to the result). That's a really sad proof.
-It turns out that I really should have been working the other way round --- first establish the orthogonal idempotents (the proof of which is really simple and elegant, I was just trapped in a single thread of thought), then use that to compute the convolution of irreducible characters.
+It turns out that I really should have been working the other way round — first establish the orthogonal idempotents (the proof of which is really simple and elegant, I was just trapped in a single thread of thought), then use that to compute the convolution of irreducible characters.
I feel like this is worth presenting (as the only proof I saw online is the really sad one above), so I TeX'ed it up. I tried to convert to MathJax HTML but eventually gave up (that's the story for another post). So, the write-up is in good ol' PDF, available [here](https://dl.bintray.com/zmwangx/generic/20141119-convolution-of-irreducible-characters.pdf).
diff --git a/source/blog/2014-11-20-dropbot-for-geeks(r).md b/source/blog/2014-11-20-dropbot-for-geeks(r).md
index e46ec401..74faf730 100644
--- a/source/blog/2014-11-20-dropbot-for-geeks(r).md
+++ b/source/blog/2014-11-20-dropbot-for-geeks(r).md
@@ -6,15 +6,10 @@ date-display: November 20, 2014
I propose the following cloud storage and syncing service model of the future. I call it **Dropbot for Geeks®**, and it totally rules. It's designed for geeks who are tired of the highly limited, miserably unproductive traditional services (based on clicking around). It has the following features:
* Standard Unix file system commands exposed as an API, e.g., `cat`, `cd`, `cp`, `du`, `df`, `file`, `find`, `head`, `ln`, `ls`, `mkdir`, `mv`, `pwd`, `rm`, `rmdir`, `tail`, `touch`, etc.
-
* A rudimentary shell emulator through the web interface exposing the commands above.
-
* Secure shell access to the file system, also exposing the commands above. Provide two-factor auth for SSH. Clearly, `scp` should also be supported.
-
* Checksums. Expose, for instance, `md5sum` or `sha1sum`, in the API. Provide checksums on download pages, probably on demand.
-
* Programmable selective syncing, down to per file level.
-
* Scriptability. Allow clients to run custom scheduled jobs or daemons with the API above. To prevent the service from becoming full-featured IaaS, though, clients might be limited in CPU time, memory, or command selection. This bullet point is arguable.
---
diff --git a/source/blog/2014-11-24-why-i-abandoned-mathjax-and-fell-back-to-pdf.md b/source/blog/2014-11-24-why-i-abandoned-mathjax-and-fell-back-to-pdf.md
index 2d2781e6..be8185fc 100644
--- a/source/blog/2014-11-24-why-i-abandoned-mathjax-and-fell-back-to-pdf.md
+++ b/source/blog/2014-11-24-why-i-abandoned-mathjax-and-fell-back-to-pdf.md
@@ -3,7 +3,7 @@ title: "Why I abandoned MathJax and fell back to PDF"
date: 2014-11-24 20:54:36 -0800
date-display: November 24, 2014
---
-Recently I wrote an expository article, [*Convolution of irreducible characters*](/pdf/20141119-convolution-of-irreducible-characters.pdf), and posted it [here](/blog/2014/11/19/convolution-of-irreducible-characters/). At first I intended to use MathJax, but in the end I fell back to good ol' PDF. Here's why.
+Recently I wrote an expository article, [*Convolution of irreducible characters*](/pdf/20141119-convolution-of-irreducible-characters.pdf), and posted it [here](/blog/2014-11-19-convolution-of-irreducible-characters.html). At first I intended to use MathJax, but in the end I fell back to good ol' PDF. Here's why.
In short, I'm a mathematician. I write math *articles*, not just standalone expressions or formulas. I use AMSLaTeX to its fullest (not really, but at least I use numbering and the `amsthm` package to its fullest). HTML simply wasn't designed for this. Here are two influential markup languages designed for totally different use cases, and bridging them is painful. I tried to use `pandoc`, but it doesn't support `\input`, doesn't support `\def`, and swallows `\begin{theorem} \end{theorem}`, among other things. I tried to use `htlatex`; even the MathML output is suboptimal, with many math symbols translated to non-math (apart from totally human-unreadable), and it uses its custom CSS files that don't play well with everything else. I tried other things. In the end I gave up. Maybe I don't know enough about MathJax, but I certainly don't want to write a translator myself. Leave LaTeX alone. Distribute as PDF. MathJax may be great for Wikis (like Wikipedia) and for math lite blogs, but it's no replacement for real, beefy LaTeX. It's not for mathematicians who want to distribute real articles.
diff --git a/source/blog/2014-12-05-python-3-and-unicode.md b/source/blog/2014-12-05-python-3-and-unicode.md
deleted file mode 100644
index eb596956..00000000
--- a/source/blog/2014-12-05-python-3-and-unicode.md
+++ /dev/null
@@ -1,6 +0,0 @@
----
-title: "Python 3 and Unicode"
-date: 2014-12-05 15:01:54 -0800
-date-display: December 5, 2014
----
-I never realized that in Python 3 Unicode is the default; in particular, `str` in Python 3 is practically equivalent to `unicode` in Python 2. This might be the *one thing* that convince me to migrate. `str.encode()`, `str.decode()`, `unicode.encode()`, `unicode.decode()`, etc. are so confusing that I'm never 100% sure what I'm doing (only-occasionally-used-but-unavoidable-and-worst-of-all-very-confusing "features" are nightmares).
diff --git a/source/blog/2015-01-10-fonts-why-chinese-web-design-is-hard.md b/source/blog/2015-01-10-fonts-why-chinese-web-design-is-hard.md
index d8788913..9c531229 100644
--- a/source/blog/2015-01-10-fonts-why-chinese-web-design-is-hard.md
+++ b/source/blog/2015-01-10-fonts-why-chinese-web-design-is-hard.md
@@ -9,6 +9,6 @@ The problem with fonts boils down to the fact that the Chinese writing system ha
Another problem triggered by the vast number of glyphs is that font files are large. I looked at a dozen OTF fonts with SC or TC glyphs, and none seems to be below 10 MB. That's clearly a no go on the web — not until everyone has a gigabit connection, I suppose. I tried to Google for Chinese webfonts and had little success, so I'm not sure if woff helps. I've heard that Apple is able to pack a reduced set of PingHei glyphs into woffs less than 1 MB (keep in mind that PingHei being sans serif is simpler than serif fonts like Songti); that's pretty remarkable. I don't know much about font technologies so I can't comment more on this matter, but from my observation all Chinese websites (with the exception of apple.com/cn, I guess) rely on locally installed fonts, and most don't even have a list of fallbacks, i.e., typefaces simply aren't part of their designs. Even if they do have a list of fallbacks, they won't be able to guarantee uniform experience across the board (as far as I know, the lowest common denominator of Chinese fonts across all platforms seem to be zero). Apple has taught us that design must be integrated and perfected (well, Apple wasn't the first to do design, but they did bring it to the digital world and to the masses). Any fragmented design is doomed to fail.
-![](http://i.imgur.com/MPmtSJI.png)
+![A section of [apple.com/cn/iphone-6](https://www.apple.com/cn/iphone-6/).](http://i.imgur.com/MPmtSJI.png)
-![](http://i.imgur.com/hBpdv0B.png)
+![The English equivalent.](http://i.imgur.com/hBpdv0B.png)
diff --git a/source/blog/2015-01-21-web-design-microsoft-vs-apple.md b/source/blog/2015-01-21-web-design-microsoft-vs-apple.md
index 7ffd6c1d..d1b97556 100644
--- a/source/blog/2015-01-21-web-design-microsoft-vs-apple.md
+++ b/source/blog/2015-01-21-web-design-microsoft-vs-apple.md
@@ -9,9 +9,10 @@ I just had a look at Ars's live blog on today's Windows 10 Event to acquire a se
The only thing I would like to see Apple copy from Microsoft is the unlimited OneDrive — come on, we already paid enough for our hardware, why can't we have unlimited cloud storage? I would even pay $10 per month for that — Microsoft is offering Office 365 along with unlimited cloud storage, all for just $10, so it certainly won't hurt Apple. The current iCloud pricing is ridiculous.
-All the discussions above are not the main point of this post though. The point is, I went to the Windows website to learn more about Windows 10, and just can't believe my eyes in how awful it is designed. Just look at the font and the layout of <http://windows.microsoft.com/en-us/windows-10/about> (full web page screenshot courtesy of [web-capture.net](http://web-capture.net)). And compare that to <http://www.apple.com/osx/> (scroll past the Windows screenshot). Holy crap, I even booted my Windows 8.1 VM just to make sure I'm not lacking the necessary fonts available on Windows.
+All the discussions above are not the main point of this post though. The point is, I went to the Windows website to learn more about Windows 10, and just can't believe my eyes in how awful it is designed. Just look at the font and the layout of [windows.microsoft.com/en-us/windows-10/about](http://windows.microsoft.com/en-us/windows-10/about) (full web page screenshot courtesy of [web-capture.net](http://web-capture.net)). And compare that to [www.apple.com/osx/](http://www.apple.com/osx/) (scroll past the Windows screenshot). Holy crap, I even booted my Windows 8.1 VM just to make sure I'm not lacking the necessary fonts available on Windows.
Why Microsoft's web design is so shitty is always beyond my grasp. For OS X, a potential customer would be eager to set his hands on it just by looking at its beautifully-crafted homepage and a few screenshots there. For Windows it's exactly the opposite. I mean, apart from metro apps (worst and ugliest desktop experience ever), modern Windows actually looks pretty good. But their shitty advertising totally ruins it. I guess it doesn't matter much for Microsoft, for all design-savvy folks who are not stuck on Windows are already using OS X, and most of their customers just need a commodity OS.
-![](http://i.imgur.com/0eIt4SR.png)
-![](http://i.imgur.com/piUO0xY.png)
+![Full height screenshot of [windows.microsoft.com/en-us/windows-10/about](http://windows.microsoft.com/en-us/windows-10/about).](http://i.imgur.com/0eIt4SR.png)
+
+![Full height screenshot of [www.apple.com/osx/](http://www.apple.com/osx/).](http://i.imgur.com/piUO0xY.png)
diff --git a/source/blog/2015-02-17-microsoft-is-getting-cool-but-not-its-website.md b/source/blog/2015-02-17-microsoft-is-getting-cool-but-not-its-website.md
index fbd587de..70573c20 100644
--- a/source/blog/2015-02-17-microsoft-is-getting-cool-but-not-its-website.md
+++ b/source/blog/2015-02-17-microsoft-is-getting-cool-but-not-its-website.md
@@ -13,6 +13,6 @@ Meanwhile,
![](http://i.imgur.com/CNv76zw.png)
-* Microsoft's UI design is still shit, [as well as their website](/blog/2015/01/21/web-design-microsoft-vs-apple/); I mean, seriously:
+* Microsoft's UI design is still shit, [as well as their website](/blog/2015-01-21-web-design-microsoft-vs-apple.html); I mean, seriously:
![](http://i.imgur.com/wu66zZc.png)
diff --git a/source/blog/2015-02-24-the-new-onedrive-api.md b/source/blog/2015-02-24-the-new-onedrive-api.md
index 1ef5bc58..1c5ea101 100644
--- a/source/blog/2015-02-24-the-new-onedrive-api.md
+++ b/source/blog/2015-02-24-the-new-onedrive-api.md
@@ -5,4 +5,4 @@ date-display: February 24, 2015
---
Microsoft released the new OneDrive API today. See the blog post announcement [here](https://blog.onedrive.com/the-new-onedrive-api/). One highlight is that [large file upload](http://onedrive.github.io/items/upload_large_files.htm) is now officially supported. Previously, large file upload was handled with a semi-official API using the BITS protocol; the only documentation was a [gist](https://gist.github.com/rgregg/37ba8929768a62131e85). Now it is handled through standard HTTP `POST`. With this major release, there's likely a lot of work to be done with [python-onedrive](https://github.com/mk-fg/python-onedrive). I have opened an issue: `mk-fg/python-onedrive#52` — [New OneDrive API support](https://github.com/mk-fg/python-onedrive/issues/52).
-Interestingly, the new OneDrive API doc is hosted on GitHub Pages — [onedrive.github.io](http://onedrive.github.io), rather than MSDN. Exactly a week ago I wrote a piece, "[Microsoft is getting cool (but not its website)](http://zmwangx.github.io/blog/2015/02/17/microsoft-is-getting-cool-but-not-its-website/)". Looks like they are doing something about their website (or better put, their online identity), too.
+Interestingly, the new OneDrive API doc is hosted on GitHub Pages — [onedrive.github.io](http://onedrive.github.io), rather than MSDN. Exactly a week ago I wrote a piece, "[Microsoft is getting cool (but not its website)](/blog/2015-02-17-microsoft-is-getting-cool-but-not-its-website.html)". Looks like they are doing something about their website (or better put, their online identity), too.
diff --git a/source/blog/2015-05-03-why-oh-my-zsh-is-completely-broken.md b/source/blog/2015-05-03-why-oh-my-zsh-is-completely-broken.md
index eb576efc..c33f4c49 100644
--- a/source/blog/2015-05-03-why-oh-my-zsh-is-completely-broken.md
+++ b/source/blog/2015-05-03-why-oh-my-zsh-is-completely-broken.md
@@ -13,7 +13,8 @@ I was hardly involved in Oh My Zsh development, and I haven't even carefully ins
First, look at Oh My Zsh's core [lib](https://github.com/robbyrussell/oh-my-zsh/tree/140034605edd0f72c548685d39e49687a44c1b23/lib):
-```
+```zsh
+> ls lib
bzr.zsh directories.zsh grep.zsh misc.zsh spectrum.zsh
completion.zsh functions.zsh history.zsh nvm.zsh termsupport.zsh
correction.zsh git.zsh key-bindings.zsh prompt_info_functions.zsh theme-and-appearance.zsh
@@ -23,7 +24,7 @@ Wait, why do I see `bzr.zsh`, `git.zsh`, and even `nvm.zsh` in the core lib? The
Meanwhile, Prezto does it right. Prezto is highly modular, with the `pmodload` function defined in [`init.zsh`](https://github.com/sorin-ionescu/prezto/blob/08676a273eba1781ddcb63c4f89cfff9bd62eac4/init.zsh) to load modules. That's about the entirety of Prezto's core; everything else are in optional [modules](https://github.com/sorin-ionescu/prezto/blob/08676a273eba1781ddcb63c4f89cfff9bd62eac4/modules), including essential configs like `editor` (ZLE configs), `completion`, and `prompt`. Note that module loading order matters in some cases, but still, working with Prezto's modular structure is a joy. Apart from `init.zsh` and `modules/`, Prezto repo does contain a [`runcoms`](https://github.com/sorin-ionescu/prezto/tree/08676a273eba1781ddcb63c4f89cfff9bd62eac4/runcoms) directory with the rc files, but those are just recommendations that one may disregard. In fact, there are a total of eight lines related to Prezto in my `.zshrc`, and nowhere else (note that I only switched to Prezto today, so this freshly baked `.zshrc` is subject to change):
-```sh
+```zsh
# prezto
zstyle ':prezto:*:*' color 'yes'
zstyle ':prezto:environment:termcap' color 'no' # disable coloring of less, which is insanely ugly
@@ -49,7 +50,7 @@ I guess the list could go on; I didn't spend more time inspecting this crap.
We were discussing styles, but obviously style isn't the only problem with this code base. Next onto a case study of how Oh My Zsh does something in the most inefficient way possible. Let's have a look at [the `git.zsh` file](https://github.com/robbyrussell/oh-my-zsh/blob/140034605edd0f72c548685d39e49687a44c1b23/lib/git.zsh). It suffers from almost all problems we have talked about so far, but let's focus specifically on [the `git_prompt_status` function](https://github.com/robbyrussell/oh-my-zsh/blob/140034605edd0f72c548685d39e49687a44c1b23/lib/git.zsh#L78-L122):
-```sh
+```zsh
git_prompt_status() {
INDEX=$(command git status --porcelain -b 2> /dev/null)
STATUS=""
@@ -99,13 +100,13 @@ git_prompt_status() {
**This one single function intended to be invoked from a precmd hook (basically excuted every time the prompt is printed), calls `grep` a staggering 14 times inside command substitutions, forking the process 28 times — while all the greps can be replaced with pattern/regex matching right within the shell.** Keep in mind that forking is the most expensive operation of the shell. For instance, `$(echo "$INDEX" | grep '^A ' &> /dev/null)` may well be replaced with
-```sh
+```zsh
[[ $INDEX == *$'\nA '* ]]
```
or
-```sh
+```zsh
[[ $INDEX =~ $'\nA ' ]]
```
@@ -133,11 +134,15 @@ The only time I [submitted a PR](https://github.com/robbyrussell/oh-my-zsh/pull/
One more thing, among countless other problems: the recommended way to install Oh My Zsh is either
- curl -L https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh | sh
+```zsh
+curl -L https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh | sh
+```
or
- wget https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O - | sh
+```zsh
+wget https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O - | sh
+```
Cool, huh? How many of you have the `--no-check-certificate` option of `wget` automatically turned on? Thankfully there's no `sudo` in front.
diff --git a/source/css/normalize.css b/source/css/normalize.css
new file mode 100644
index 00000000..458eea1e
--- /dev/null
+++ b/source/css/normalize.css
@@ -0,0 +1,427 @@
+/*! normalize.css v3.0.2 | MIT License | git.io/normalize */
+
+/**
+ * 1. Set default font family to sans-serif.
+ * 2. Prevent iOS text size adjust after orientation change, without disabling
+ * user zoom.
+ */
+
+html {
+ font-family: sans-serif; /* 1 */
+ -ms-text-size-adjust: 100%; /* 2 */
+ -webkit-text-size-adjust: 100%; /* 2 */
+}
+
+/**
+ * Remove default margin.
+ */
+
+body {
+ margin: 0;
+}
+
+/* HTML5 display definitions
+ ========================================================================== */
+
+/**
+ * Correct `block` display not defined for any HTML5 element in IE 8/9.
+ * Correct `block` display not defined for `details` or `summary` in IE 10/11
+ * and Firefox.
+ * Correct `block` display not defined for `main` in IE 11.
+ */
+
+article,
+aside,
+details,
+figcaption,
+figure,
+footer,
+header,
+hgroup,
+main,
+menu,
+nav,
+section,
+summary {
+ display: block;
+}
+
+/**
+ * 1. Correct `inline-block` display not defined in IE 8/9.
+ * 2. Normalize vertical alignment of `progress` in Chrome, Firefox, and Opera.
+ */
+
+audio,
+canvas,
+progress,
+video {
+ display: inline-block; /* 1 */
+ vertical-align: baseline; /* 2 */
+}
+
+/**
+ * Prevent modern browsers from displaying `audio` without controls.
+ * Remove excess height in iOS 5 devices.
+ */
+
+audio:not([controls]) {
+ display: none;
+ height: 0;
+}
+
+/**
+ * Address `[hidden]` styling not present in IE 8/9/10.
+ * Hide the `template` element in IE 8/9/11, Safari, and Firefox < 22.
+ */
+
+[hidden],
+template {
+ display: none;
+}
+
+/* Links
+ ========================================================================== */
+
+/**
+ * Remove the gray background color from active links in IE 10.
+ */
+
+a {
+ background-color: transparent;
+}
+
+/**
+ * Improve readability when focused and also mouse hovered in all browsers.
+ */
+
+a:active,
+a:hover {
+ outline: 0;
+}
+
+/* Text-level semantics
+ ========================================================================== */
+
+/**
+ * Address styling not present in IE 8/9/10/11, Safari, and Chrome.
+ */
+
+abbr[title] {
+ border-bottom: 1px dotted;
+}
+
+/**
+ * Address style set to `bolder` in Firefox 4+, Safari, and Chrome.
+ */
+
+b,
+strong {
+ font-weight: bold;
+}
+
+/**
+ * Address styling not present in Safari and Chrome.
+ */
+
+dfn {
+ font-style: italic;
+}
+
+/**
+ * Address variable `h1` font-size and margin within `section` and `article`
+ * contexts in Firefox 4+, Safari, and Chrome.
+ */
+
+h1 {
+ font-size: 2em;
+ margin: 0.67em 0;
+}
+
+/**
+ * Address styling not present in IE 8/9.
+ */
+
+mark {
+ background: #ff0;
+ color: #000;
+}
+
+/**
+ * Address inconsistent and variable font size in all browsers.
+ */
+
+small {
+ font-size: 80%;
+}
+
+/**
+ * Prevent `sub` and `sup` affecting `line-height` in all browsers.
+ */
+
+sub,
+sup {
+ font-size: 75%;
+ line-height: 0;
+ position: relative;
+ vertical-align: baseline;
+}
+
+sup {
+ top: -0.5em;
+}
+
+sub {
+ bottom: -0.25em;
+}
+
+/* Embedded content
+ ========================================================================== */
+
+/**
+ * Remove border when inside `a` element in IE 8/9/10.
+ */
+
+img {
+ border: 0;
+}
+
+/**
+ * Correct overflow not hidden in IE 9/10/11.
+ */
+
+svg:not(:root) {
+ overflow: hidden;
+}
+
+/* Grouping content
+ ========================================================================== */
+
+/**
+ * Address margin not present in IE 8/9 and Safari.
+ */
+
+figure {
+ margin: 1em 40px;
+}
+
+/**
+ * Address differences between Firefox and other browsers.
+ */
+
+hr {
+ -moz-box-sizing: content-box;
+ box-sizing: content-box;
+ height: 0;
+}
+
+/**
+ * Contain overflow in all browsers.
+ */
+
+pre {
+ overflow: auto;
+}
+
+/**
+ * Address odd `em`-unit font size rendering in all browsers.
+ */
+
+code,
+kbd,
+pre,
+samp {
+ font-family: monospace, monospace;
+ font-size: 1em;
+}
+
+/* Forms
+ ========================================================================== */
+
+/**
+ * Known limitation: by default, Chrome and Safari on OS X allow very limited
+ * styling of `select`, unless a `border` property is set.
+ */
+
+/**
+ * 1. Correct color not being inherited.
+ * Known issue: affects color of disabled elements.
+ * 2. Correct font properties not being inherited.
+ * 3. Address margins set differently in Firefox 4+, Safari, and Chrome.
+ */
+
+button,
+input,
+optgroup,
+select,
+textarea {
+ color: inherit; /* 1 */
+ font: inherit; /* 2 */
+ margin: 0; /* 3 */
+}
+
+/**
+ * Address `overflow` set to `hidden` in IE 8/9/10/11.
+ */
+
+button {
+ overflow: visible;
+}
+
+/**
+ * Address inconsistent `text-transform` inheritance for `button` and `select`.
+ * All other form control elements do not inherit `text-transform` values.
+ * Correct `button` style inheritance in Firefox, IE 8/9/10/11, and Opera.
+ * Correct `select` style inheritance in Firefox.
+ */
+
+button,
+select {
+ text-transform: none;
+}
+
+/**
+ * 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio`
+ * and `video` controls.
+ * 2. Correct inability to style clickable `input` types in iOS.
+ * 3. Improve usability and consistency of cursor style between image-type
+ * `input` and others.
+ */
+
+button,
+html input[type="button"], /* 1 */
+input[type="reset"],
+input[type="submit"] {
+ -webkit-appearance: button; /* 2 */
+ cursor: pointer; /* 3 */
+}
+
+/**
+ * Re-set default cursor for disabled elements.
+ */
+
+button[disabled],
+html input[disabled] {
+ cursor: default;
+}
+
+/**
+ * Remove inner padding and border in Firefox 4+.
+ */
+
+button::-moz-focus-inner,
+input::-moz-focus-inner {
+ border: 0;
+ padding: 0;
+}
+
+/**
+ * Address Firefox 4+ setting `line-height` on `input` using `!important` in
+ * the UA stylesheet.
+ */
+
+input {
+ line-height: normal;
+}
+
+/**
+ * It's recommended that you don't attempt to style these elements.
+ * Firefox's implementation doesn't respect box-sizing, padding, or width.
+ *
+ * 1. Address box sizing set to `content-box` in IE 8/9/10.
+ * 2. Remove excess padding in IE 8/9/10.
+ */
+
+input[type="checkbox"],
+input[type="radio"] {
+ box-sizing: border-box; /* 1 */
+ padding: 0; /* 2 */
+}
+
+/**
+ * Fix the cursor style for Chrome's increment/decrement buttons. For certain
+ * `font-size` values of the `input`, it causes the cursor style of the
+ * decrement button to change from `default` to `text`.
+ */
+
+input[type="number"]::-webkit-inner-spin-button,
+input[type="number"]::-webkit-outer-spin-button {
+ height: auto;
+}
+
+/**
+ * 1. Address `appearance` set to `searchfield` in Safari and Chrome.
+ * 2. Address `box-sizing` set to `border-box` in Safari and Chrome
+ * (include `-moz` to future-proof).
+ */
+
+input[type="search"] {
+ -webkit-appearance: textfield; /* 1 */
+ -moz-box-sizing: content-box;
+ -webkit-box-sizing: content-box; /* 2 */
+ box-sizing: content-box;
+}
+
+/**
+ * Remove inner padding and search cancel button in Safari and Chrome on OS X.
+ * Safari (but not Chrome) clips the cancel button when the search input has
+ * padding (and `textfield` appearance).
+ */
+
+input[type="search"]::-webkit-search-cancel-button,
+input[type="search"]::-webkit-search-decoration {
+ -webkit-appearance: none;
+}
+
+/**
+ * Define consistent border, margin, and padding.
+ */
+
+fieldset {
+ border: 1px solid #c0c0c0;
+ margin: 0 2px;
+ padding: 0.35em 0.625em 0.75em;
+}
+
+/**
+ * 1. Correct `color` not being inherited in IE 8/9/10/11.
+ * 2. Remove padding so people aren't caught out if they zero out fieldsets.
+ */
+
+legend {
+ border: 0; /* 1 */
+ padding: 0; /* 2 */
+}
+
+/**
+ * Remove default vertical scrollbar in IE 8/9/10/11.
+ */
+
+textarea {
+ overflow: auto;
+}
+
+/**
+ * Don't inherit the `font-weight` (applied by a rule above).
+ * NOTE: the default cannot safely be changed in Chrome and Safari on OS X.
+ */
+
+optgroup {
+ font-weight: bold;
+}
+
+/* Tables
+ ========================================================================== */
+
+/**
+ * Remove most spacing between table cells.
+ */
+
+table {
+ border-collapse: collapse;
+ border-spacing: 0;
+}
+
+td,
+th {
+ padding: 0;
+}
diff --git a/source/css/theme.css b/source/css/theme.css
new file mode 100644
index 00000000..b06fe2a2
--- /dev/null
+++ b/source/css/theme.css
@@ -0,0 +1,90 @@
+body {
+ color: #333;
+ font-family: "PT Serif", serif
+}
+
+nav {
+ position: fixed;
+ left: 5%;
+ top: 10%;
+}
+
+article {
+ position: absolute;
+ width: 50%;
+ left: 20%;
+ padding: 5%;
+ font-size: 11pt;
+ text-align: justify;
+}
+
+h1.title {
+ text-align: center;
+ font-size: 18pt;
+}
+
+h2 {
+ text-align: center;
+ font-size: 14pt;
+}
+
+h2.meta {
+ font-size: 11pt;
+ font-weight: normal;
+ font-style: italic;
+}
+
+h3 {
+ font-size: 12pt;
+}
+
+code {
+ font-family: 'Courier', monospace;
+ font-size: 10.5pt;
+}
+
+pre {
+ margin: 0 2em;
+}
+
+pre code {
+ font-size: 10pt;
+}
+
+blockquote {
+ margin: 0 2em;
+ font-style: italic;
+}
+
+img {
+ display: block;
+ max-width: 100%;
+ max-height: 100%;
+ margin-left: auto;
+ margin-right: auto;
+}
+
+.figure .caption {
+ text-align: center;
+ font-size: 10pt;
+}
+
+a {
+ color: #333;
+}
+
+footer {
+ text-align: right;
+}
+
+footer .cc-icon {
+ width: 16px;
+ height: 16px;
+ padding: 0 4px;
+ display: inline-block;
+ background-image: url("http://mirrors.creativecommons.org/presskit/icons/cc.svg");
+ background-repeat: no-repeat;
+ background-position: center;
+ background-size: 16px;
+ vertical-align: middle;
+}
diff --git a/source/index.md b/source/index.md
new file mode 100644
index 00000000..0236fb77
--- /dev/null
+++ b/source/index.md
@@ -0,0 +1,10 @@
+---
+title: dl? cmplnts?
+---
+## About me
+
+I am an undergrad at Stanford (junior as of May 2015) studying mathematics and theoretical physics. I enjoy coding in my spare time, for fun and profit (getting things done). I am lazy in general so I try to automate things as much as possible.
+
+My first programming language was Pascal and I consider C my mother tongue, but recently I write my code in Python or Bash (non-interactive) most of the time. My text editor is Emacs, and my interactive shell is Zsh. I use four-space indents. What else is there to tell?
+
+The blog could be about anything, but most of the stuff should be technical.
diff --git a/templates/template.html b/templates/template.html
new file mode 100644
index 00000000..1b527e5e
--- /dev/null
+++ b/templates/template.html
@@ -0,0 +1,63 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"$if(lang)$ lang="$lang$" xml:lang="$lang$"$endif$>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ <meta http-equiv="Content-Style-Type" content="text/css" />
+ <meta name="generator" content="pandoc" />
+ <meta name="author" content="Zhiming Wang" />
+$if(date)$
+ <meta name="date" content="$date$" />
+$endif$
+ <title>$pagetitle$ — dl? cmplnts?</title>
+ <style type="text/css">code{white-space: pre;}</style>
+$if(quotes)$
+ <style type="text/css">q { quotes: "“" "”" "‘" "’"; }</style>
+$endif$
+$if(highlighting-css)$
+ <style type="text/css">
+$highlighting-css$
+ </style>
+$endif$
+$for(css)$
+ <link rel="stylesheet" href="$css$" $if(html5)$$else$type="text/css" $endif$/>
+$endfor$
+$if(math)$
+ $math$
+$endif$
+$for(header-includes)$
+ $header-includes$
+$endfor$
+<link href='/css/normalize.css' media="all" rel="stylesheet" type="text/css">
+<link href='/css/theme.css' media="all" rel="stylesheet" type="text/css">
+<link href="http://fonts.googleapis.com/css?family=PT+Serif:regular,italic,bold,bolditalic" rel="stylesheet" type="text/css">
+</head>
+<body>
+<article>
+$if(title)$
+<header>
+<h1 class="title">$title$</h1>
+$if(subtitle)$
+<h1 class="subtitle">$subtitle$</h1>
+$endif$
+<h2 class="meta">
+$if(date-display)$
+<time class="timestamp" $if(date)$timestamp="$date$"$endif$>$date-display$,</time>
+$endif$
+by <span class="author">Zhiming Wang</span>
+</h2>
+</header>
+$endif$
+$if(toc)$
+<div id="$idprefix$TOC">
+$toc$
+</div>
+$endif$
+$body$
+<hr>
+<footer>
+<a class="cc-icon" href="https://creativecommons.org/licenses/by/4.0/" target="_blank" title="Released under the Creative Commons Attribution 4.0 International license.">
+<a href="https://github.com/zmwangx">Zhiming Wang</a>
+</footer>
+</article>
+</body>
+</html>
diff --git a/tools/convert-from-octopress.awk b/tools/convert-from-octopress.awk
new file mode 100755
index 00000000..20556044
--- /dev/null
+++ b/tools/convert-from-octopress.awk
@@ -0,0 +1,36 @@
+#!/usr/bin/env gawk -f
+/---/ { meta_delim_count++ }
+{
+ if (meta_delim_count >= 2) {
+ # remove additional metadata (title, url, link text) other than the
+ # language from a Octopress fenced (backtick) code block
+ if (match($0, /\s*```\s*[[:alnum:]_-]+/, matchobj)) {
+ print matchobj[0]
+ next
+ }
+
+ # convert Octopress {% %} plugin blocks to verbatim (in fenced code
+ # blocks); this can't really handle multiline plugins (e.g.,
+ # blockquote), but sacrifices need to be made anyway
+ if (match($0, /\s*{%.+%}\s*/)) {
+ print "```"
+ print
+ print "```"
+ next
+ }
+
+ # correct internal links
+ $0 = gensub(/\/blog\/([0-9]{4})\/([0-9]{2})\/([0-9]{2})\/([a-zA-Z0-9%_-]+)\//, \
+ "/blog/\\1-\\2-\\3-\\4.html", "g")
+ print
+ } else if ($1 == "layout:" || $1 == "comments:" || $1 == "categories:") {
+ next
+ } else if ($1 == "date:") {
+ print
+ printf "date-display: "
+ # requires date from coreutils; BSD date doesn't work
+ system("date -d "$2" +'%B %_d, %Y'")
+ } else {
+ print
+ }
+}