diff options
author | neodarz <neodarz@neodarz.net> | 2017-05-04 03:27:33 +0200 |
---|---|---|
committer | neodarz <neodarz@neodarz.net> | 2017-05-04 03:27:33 +0200 |
commit | 785bde84dd4888817bb9825ba5ab388ec2b7c4b7 (patch) | |
tree | eb572026c9c953dbd67e3acc2104db11117b4e5f /source | |
parent | 15c05dbb86fe3d98ec6e6ebe7743fd85b860dcc6 (diff) | |
download | my_new_personal_website-785bde84dd4888817bb9825ba5ab388ec2b7c4b7.tar.xz my_new_personal_website-785bde84dd4888817bb9825ba5ab388ec2b7c4b7.zip |
Update to date
Diffstat (limited to 'source')
121 files changed, 442 insertions, 3807 deletions
diff --git a/source/blog/2014-10-20-hello-octopress.md b/source/blog/2014-10-20-hello-octopress.md deleted file mode 100644 index 8b6eb248..00000000 --- a/source/blog/2014-10-20-hello-octopress.md +++ /dev/null @@ -1,36 +0,0 @@ ---- -title: "Hello, Octopress!" -date: 2014-10-20T16:53:00-0700 -date_display: October 20, 2014 ---- - -This post marks my transition from Tumblr to Octopress & GitHub Pages. - -I've been microblogging for a while at [zshello3.tumblr.com](http://zshello3.tumblr.com) and I liked it. Not because of readers, which I suspect I have none; but there are certainly a huge amount of information I want to dump off my mind. Back in the days I *loved* my handwritten journals, and I really poured a lot into them. Peers were usually amazed when they saw my journals. These days typing seems to be a more robust solution to keeping my thoughts, especially when the thoughts are mostly technical. - -Tumblr is awesome. Compared to WordPress (.com for pedantic people), it is both lightweight and beautiful (you get all the customization for free), so you quickly get to the writing. However, it is not designed for geeks, so - -* Customization is capped at some point; -* I had the impression that the Markdown parser is herrendous; -* Email publishing is a mightmare, by the way; -* Code rendering always falls short — unless I spend a lot of time customizing (I'm pretty bad at HTML, CSS, and JS stuff). - -Speaking of the last point, I've always been envious of the beautiful code blocks found on Octopress blogs. So here I come! - -(Let me give it a try first.) - -``` C -#include <stdio.h> - -int main(int argc, char **argv) { - printf("Hello, Octopress!\n") -} -``` - -Gorgeous. I'll get to the theme customization later. I'm actually busy as crazy this week. - -Before I close this post, let me also try to embed a random gist I authored yesterday (for brewing): - -``` -{% gist 828fd00bdecd6611cf40 brew.sh %} -``` diff --git a/source/blog/2014-10-20-help-mou-hit-1-dot-0.md b/source/blog/2014-10-20-help-mou-hit-1-dot-0.md deleted file mode 100644 index 773e1916..00000000 --- a/source/blog/2014-10-20-help-mou-hit-1-dot-0.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -title: "Help Mou hit 1.0" -date: 2014-10-20T17:37:45-0700 -date_display: October 20, 2014 ---- - -Quick call for [Mou 1.0 fundraiser](https://www.indiegogo.com/projects/mou-1-0-markdown-editor-on-os-x-for-you) on Indiegogo. At the time of writing, it has raised $6,178/$20,000, and has 39 days to go (with 21 already passed). - - -I'm actually writing this post in Mou right now. It's far less powerful than Emacs, but when I want preview-on-the-fly, Mou is the Markdown editor to go. Right now it's far from perfect; for instance, GFM fenced blocks (now included in [CommonMark](http://commonmark.org)) are not supported, so you get nonsense preview when your code block is fenced rather than indented. (Of course, Mou is even less suitable for editing an Octopress post due to the yaml metadata upfront, but that's not a big deal.) - -Let's hope for Mou hitting the 1.0 mark. diff --git a/source/blog/2014-10-21-get-rolling.md b/source/blog/2014-10-21-get-rolling.md deleted file mode 100644 index 9d64fff7..00000000 --- a/source/blog/2014-10-21-get-rolling.md +++ /dev/null @@ -1,34 +0,0 @@ ---- -title: "Get rolling" -date: 2014-10-21T11:40:14-0700 -date_display: October 21, 2014 ---- - -Yesterday, on an internet forum, I saw someone’s signature, which translates to - -> Don’t even get started if you know you can't know from the beginning that you won't make it to the very end. - -This seems justified — persistence is the key to success; why even bother if you know you’ll fail? However, I have to profoundly disagree with this, and even dedicate a blog post to discussing this problem. - -The problem here is, the real world is much more complicated than the idealized world found in various quotes about persistence. Most of the time you have absolutely no clue where which road is leading, unless you embark on the journey, clueless. As for me, fortunately I knew I was gonna be a mathematician/physicist ever since elementary school, so the roadmap is sorta clear on the grand scale. Still, all those tiny building blocks for the ultimate goal are confusing, and even more so for things hardly related to the ultimate goal, for instance, coding, which is just a hobby and a way to simplify life — it has simplified my life in some sense, but has itself complicated my life in other ways (your life inevitably becomes more complicated when you know more and want to find out even more). - -And sometimes you are bound to fail — I know my code is shitty, for instance, but if I don’t get rolling, I won’t even have a working (albeit shitty) version that barely meets my needs. As another example, I was looking for a way to share and archive some photos. I started with [WordPress](http://apinkarchive.wordpress.com/), which turned out to be more formal and tiring than I’d thought. Then I ran a [Tumblr microblog](http://chorongmemories.tumblr.com/), which was great, but has certain limitations that in the end prevents it from being damn useful for myself, so in the end I went onto “indefinite hiatus.” In both cases I never declared that the thing was permanent — I was careful to say that the blogs were experimental, and I moved on when I found something better, or when they were no longer helping me. Yesterday I started yet another experiment, a [Tistory blog](http://apinkpcr.tistory.com). It is a random move triggered by something unexpected; the South Korean blogging platform is not that great, but at least it provides acceptable API access, and more importantly, I’ve got complete infrastructure built around the API to scrape photos, so it’s easy to build on top of that to automate things. It is also experimental. Again I’m not sure I long I can keep it up, but at least I’m happy with it for the time being. Being happy at the time being is the most important goal for hobbies. - -Choices are hard. Especially in today’s world, tools in every discipline are constantly improving, be it math, physics, programming, photography, blogging, or whatever. If you research over and over until you find “the perfect tool”, or “the perfect platform” (hint: the rank is constantly changing), you’re stuck on the first step to anywhere. In fact, reading other people’s blogs, for example, are not enough to learn what is the best — you need to at least have some working knowledge to even decide which tool or platform is more suitable for you. Therefore, the most sensible thing to do is to do a little bit of research (combined with your gut feeling), pick up something that makes you feel good at the moment, and immediately get rolling. Well, of course you need some research, otherwise you’re just kidding yourself; doing `>>> import this` in python tells you: - -> Now is better than never.<br> -> Although never is often better than *right* now. - -Then, when you have more experience and know what’s wrong with your original choice, correct it or trash it. There’s nothing wrong with abandoning dated crap, hopping bandwagons, or whatever; that’s the nature of change and improvement, and the most sensible thing for someone as busy as you are. - -Up till now I've been talking about tools and platforms, so maybe it seems that I'm attacking the straw man — you may argue that the original quote is not about what tools or platforms you use, but rather, what you try to accomplish with the tools or platforms. Okay, what about the grander things in life, like mathematical research, like *the final theory*? Well, similar. I’ll quote Ravi here, - -> …mathematics is so rich and infinite that it is impossible to learn it systematically, and if you wait to master one topic before moving on to the next, you’ll never get anywhere. Instead, you’ll have tendrils of knowledge extending far from your comfort zone. Then you can later backfill from these tendrils, and extend your comfort zone; this is much easier to do than learning “forwards”. - -Ravi is always hinting at “you should get started with actual research rather than ‘prepare’ yourself”! I can’t reckon that since I’ve yet to follow Ravi’s advice, but the thinking here is crystal clear. **You shouldn’t be afraid of failure; you shouldn’t be afraid of being “not prepared enough”; you shouldn’t be afraid of getting started.** Speaking of a final theory, I’m pretty sure I’m bound to fail, I’m pretty sure I won’t see a satisfactory one in my lifetime — the inconvenient truth is that, I have the gut feeling that the ultimate explanation is unfortunately intertwined with consciousness, and we are still far from having the right tools to understand consciousness. According to Feynman, **really knowing something is hard**. It’s hard, so failure is not shameful at all. Those who won’t even get started due to fear of failing or making the wrong choice won’t fail again, since they’ve already failed at the very beginning. So, get rolling. - -Yesterday I read [Fire and Motion](http://www.joelonsoftware.com/articles/fog0000000339.html) on *Joel on Software*. Joel’s metaphor is really nice, but he’s essentially conveying very similar ideas. - -------------------------------------------------------------------------------- - -By the way, I wrote this post in Emacs. I don’t know why but I seem to type much faster in Emacs than in Mou. (For Markdown editing `markdown-mode`, and `typo-mode`, a minor mode I found today which is useful for inserting smart quotes and smart dashes seamlessly into md articles). 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 deleted file mode 100644 index 53e3e40e..00000000 --- a/source/blog/2014-10-23-ripping-copy-protected-dvd-with-mpv.md +++ /dev/null @@ -1,37 +0,0 @@ ---- -title: "Ripping copy-protected DVD with mpv" -date: 2014-10-23T20:03:22-0700 -date_display: October 23, 2014 ---- - -**_11/02/2014 update:_** - -See [this post](/blog/2014-11-02-vobcopy-dvdbackup-etc.html) for issues, explanations, and more. - ---- - -**_10/25/2014 update:_** - -I'm such an idiot. `vobcopy` is the real, hassel-free way to go. - - brew install vobcopy - -Then, with the DVD mounted, - -> **vobcopy** without any options will copy the title with the most chapters into files of 2GB size into the current working directory. - -Of course there are a ton of options, but I generally hate to browse through options unless I have to, so I'm happy with calling without argument. - ---- - -Yesterday I was trying to rip a music video off a newly released DVD from Japan. I knew very little about how DRM (in this case, CSS) actually works and how to break it. I tried to operate directly on the VOB file with `ffmpeg` or `mpv` but both failed with a lot of header errors — I suppose more files than the VOB are required for authentication? Whatever, maybe I’ll learn the details in the future, but I don’t see the need since DVD is an outdated technology anyway. - -So, can we proceed from here? Most certainly. I noticed that although `mpv` won’t let me play a single VOB, I can simply hand it the DVD mount point, and it will play the whole DVD seamlessly. **Caution:** `mpv` needs to be compiled with `libdvdnav` and `libdvdread`! With brew you just do - - brew install mpv --with-libdvdnav --with-libdvdread - -For better performance and backup, I first cloned the DVD into a `.cdr` image (DVD/CD-R Master Image) using Disk Utility (I've never tried creating/cloning image with `diskutil` CLI, so nothing to report on that). Then I mount the image, say the mount point is `/Volumes/UPBX_80165`. As said I can hand that mount point to `mpv` and it simply works, but how about extracting the MPEG-2 video stream? The `--stream-capture=<filename>` option is there just for you. In principle `--stream-dump=<filename>` should also work, but without monitoring the output and controlling where to end, I’m not sure if it will ever terminate itself when reading from a DVD (when I stream captured the DVD it just kept repeating itself until I explicitly quit with `q`). So that's it: - - mpv --stream-capture=dump.mpg /Volumes/UPBX_80165 - -Then you can torture the `dump.mpg` with `ffmpeg` however you want. The most obvious thing is to cut out the music video part, and put into a new container like MPEG-TS. Or transcode it to H.264 for your iPhone. The nice thing about `dump.mpg` is that, unless I got it wrong, there's no quality loss here — the only thing you got rid of is that goddamn DRM. diff --git a/source/blog/2014-10-24-charles-munger-donated-$65m-to-kitp.md b/source/blog/2014-10-24-charles-munger-donated-$65m-to-kitp.md deleted file mode 100644 index 365ad718..00000000 --- a/source/blog/2014-10-24-charles-munger-donated-$65m-to-kitp.md +++ /dev/null @@ -1,22 +0,0 @@ ---- -title: "Charles Munger donated $65M to KITP" -date: 2014-10-24T16:41:36-0700 -date_display: October 24, 2014 ---- - -Today's news has it that Charles Munger made a $65 million donation to KITP at UCSB. See for instance [this article](http://nyti.ms/1D4zg24) on NYT. Of course I didn't learn it from NYT (I'm generally sick of any news other than math, physics, or IT-related ones). I learned it from [Not Even Wrong](http://www.math.columbia.edu/~woit/wordpress/?p=7247) instead (of course I don't agree with Woit, but some of his links are nice). - -I have no interest whatsoever in the business world, so I have no idea about Warren Buffett's business partners (although I'm still worldly enough to know Warren Buffett). However, the name Charles Munger sounded surprisingly familiar. After reading the sentence - -> Mr. Munger has frequently donated big sums to schools like Stanford and the Harvard-Westlake School. - -from the NYT article linked above, it finally hit me that Mr. Munger is the donor of the Munger Graduate Residence here at Stanford. Munger is really nice, much better than our undergrad residences AFAIK (location-wise Roble is still unbeatable for mathematicians and physicists, although Munger still kicks EV's ass). - -I'm glad to see more and more entrepreneurs funding physics, especially theoretical physics, whether they understand it or not. (**Aside:** Even for laypeople theoretical physics is cool isn't it, like the coolest kid in class. I won't comment on whether math is cooler, but breakthrough mathematical work certainly go largely unnoticed in the public, since theoretical physics is the last thing that laypeople can "vaguely understand". Do some name searches on Google to see how math and physics play out in the limelight — hint: - -* Gauss — 4,130,000 results; -* Euler — 855,000 results; -* Newton — 13,200,000 results; -* Einstein — 6,330,000 results. - -End of aside.) Engaging in physics is plain better than engaging in some questionable philanthropy. (Have you heard that Gates Foundation invested in G4S, the largest private military and security company in the world? I’m not sure about the details — I once read that off a bathroom flyer — but that’s definitely interesting philanthropy.) diff --git a/source/blog/2014-10-25-os-x-package-receipts.md b/source/blog/2014-10-25-os-x-package-receipts.md deleted file mode 100644 index e04f026a..00000000 --- a/source/blog/2014-10-25-os-x-package-receipts.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -title: "OS X package receipts" -date: 2014-10-25T13:26:02-0700 -date_display: October 25, 2014 ---- - -I just learned something new. Whenever you install a `pkg` on OS X, OS X stores a receipt of what was installed in `/var/db/receipts` (I'm running OS X 10.9.5 at the time of writing), called a **bom** — bill of materials (I’d rather call it a manifest, whatever). This feature was introduced in NeXTSTEP. From `man 5 bom`: - -> The Mac OS X Installer uses a file system "bill of materials" to determine which files to install, remove, or upgrade. A bill of materials, **bom**, contains all the files within a directory, along with some information about each file. File information includes: the file's UNIX permissions, its owner and group, its size, its time of last modification, and so on. Also included are a checksum of each file and information about hard links. - -`man 5 bom` is actually badly maintained, as it says "The bill of materials for installed packages are found within the package receipts located in /Library/Receipts," whereas those have been migrated to `/var/db/receipts` a long time ago. - -`.bom` files are binary, but you can access the contents via `lsbom`. For instance, to list the files installed, - - lsbom -f /var/db/receipts/org.macports.MacPorts.bom - -Note that the paths printed are always relative to `/`. See `man 1 lsbom` for detailed option listing. - -(Beware when you try to clean up unwanted packages using the `lsbom` listing. Packages might overwrite files, so make sure you review the listing first and know what you are doing. "Knowing what you are doing" is the prerequisite for using `sudo` anyway.) 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 deleted file mode 100644 index 6679537e..00000000 --- a/source/blog/2014-10-26-audio-cd-slash-dvd-to-iso-image-on-os-x.md +++ /dev/null @@ -1,29 +0,0 @@ ---- -title: "Convert Audio CD/DVD to ISO image on OS X" -date: 2014-10-26T23:29:47-0700 -date_display: October 26, 2014 ---- - -**_11/02/2014 update:_** - -See [this post](/blog/2014-11-02-vobcopy-dvdbackup-etc.html) for issues, explanations, and more. - ---- - -Today it occurred to me that I should make clones of my audio CDs (as stand-alone ISO images, I mean, not just rsyncing the AIFFs to subdirectories in `~/aud/lossless`). One can never have too many backups. - -Of course I could simply pack the aforementioned directories with AIFFs into ISOs — that’s not impressive. The end result might actually be the same, but I want to make the clones directly from the original CDs. It turns out that this is not so simple with the Disk Utility GUI — unlike DVDs, the “New Image” option is grayed out for Audio CDs. I’m not sure why, but maybe they want you to just use iTunes to deal with Audio CDs (which works well for all practical purposes — but theoretical curiosity never ends). - -So there comes `hdiutil`. `hdiutil` and `diskutil` are the utilities underlying Disk Utility. Unfortunately, so far I know little about them except for simplest things like `diskutil list`, `diskutil mount`, `hdiutil attach -stdinpass`, etc. (I'm so ignorant about anything filesystem related!) The `hdiutil` verb that makes cross-platform CD or DVD is `makehybrid`, which supports the following filesystem options: `-hfs` (holy crap, no HFS+ please! Apple ought to replace this thirty-year-old filesystem — ZFS or something better please!), `-iso`, `-joliet`, and `-udf`. For Audio CDs you use `-iso` and with `-joliet` extension: - - hdiutil makehybrid -iso -joliet -o AUDIO_CD_NAME.iso SOURCE - -where `SOURCE` can be the mount point, the disk device file, etc. Similarly, although you can create `.cdr` images from DVDs via the Disk Utility GUI, you can also do it with `hdiutil` (which is potentially more portable — I’ve never heard a definitive answer of whether renaming `.cdr` to `.iso` really cross-platform): - - hdiutil makehybrid -udf -o DVD_NAME.iso SOURCE - -This way CSS keys *seem* to be cloned as well, since I was able to authenticate such a CSS-protected DVD with `libdvdread`. - ---- - -P.S. I sincerely hope that one day lossless music tracks are no longer distributed through CD-ROMs. So painful — even my Internet speed is more than ten times faster than the [highest transfer rate](https://en.wikipedia.org/wiki/CD-ROM#Transfer_rates) available from any CD-ROM. (I’ve heard about some websites distributing lossless music digitally, but that won’t happen to the music I care about in the near future.) I still like physical albums though — a real sense of possession. Maybe they should contain the physical goodies and some sort of access codes? diff --git a/source/blog/2014-10-26-disk-visualizer-daisydisk.md b/source/blog/2014-10-26-disk-visualizer-daisydisk.md deleted file mode 100644 index c55eb4ba..00000000 --- a/source/blog/2014-10-26-disk-visualizer-daisydisk.md +++ /dev/null @@ -1,17 +0,0 @@ ---- -title: "Disk visualizer: DaisyDisk" -date: 2014-10-26T00:02:22-0700 -date_display: October 26, 2014 ---- - -DaisyDisk is a pretty famous name. I’ve heard a lot that DaisyDisk is beautiful, but as a “power user” I always feel ashamed about using a disk analyzer or visualizer (although no one really cares). I’m pretty comfortable with doing most filesystem operations right in the shell, and for other tasks too tedious for the shell (like renaming a bunch of files with no obvious pattern), Finder (equipped with TotalFinder) works just fine. - -Today I was trying clean up my drive a bit, as there were only 22GB left. I knew where the main problem lied: a huge number of highres videos lying in `~/vid/staging`, awaiting renaming and migration to my external drive. Anyway, it would be nice to have some visualization of a detailed breakdown of my disk usage, preferably on any level I want without multiple passes of `du`. The name DaisyDisk popped up from the cache in my brain, so I headed over to their website to download it. - -The result is not disappointing at all. Look at this: - -![DaisyDisk screen shot](https://i.imgur.com/vyIwSNQ.png) - -Beautiful. Moreover, functional. It indeed gives me a detailed breakdown on any level, within any directory (given enough priviledge). I can also collect items I don’t want and let DaisyDisk clean up for me at once (not surprising for a disk analyzer); this feature isn’t that useful for me since I know exactly where my queues of unorganized items are — `~/Downloads`, `~/aud/staging`, `~/img/staging`, and `~/vid/staging`. - -By the way, DaisyDisk seems to be WinRAR-free. (Rest assured; I’m a good guy and I *will* purchase a license — these days whether to purchase the website or the MAS version is a headache, though.) diff --git a/source/blog/2014-10-27-onedrive-goes-unlimited.md b/source/blog/2014-10-27-onedrive-goes-unlimited.md deleted file mode 100644 index 7f394254..00000000 --- a/source/blog/2014-10-27-onedrive-goes-unlimited.md +++ /dev/null @@ -1,22 +0,0 @@ ---- -title: "OneDrive goes unlimited" -date: 2014-10-27T09:44:51-0700 -date_display: October 27, 2014 ---- - -**10/28/2014 Update:** - -Yesterday Microsoft pushed an update to OneDrive.app to MAS. After uninstalling, reinstalling, and wiping the 10 GB folder I'd like to sync (that's for photos; I upload videos via the web interface) on both client and server sides, it actually began to work. The speed was around 1 MB/s during my last sync of 10 GB worth of data. Not fast, but I will be fairly satisfied if it can keep up with that speed. Time will tell. - ---- -The OneDrive team just [announced on their blog](https://blog.onedrive.com/office-365-onedrive-unlimited-storage/) that - -> Today, storage limits just became a thing of the past with Office 365. Moving forward, all Office 365 customers will get unlimited OneDrive storage at no additional cost. - -Hell, I hate Microsoft, but **I have to say that this is big**. OneDrive might not be the first to offer unlimited cloud storage (not sure), but it is certainly the first one to roll it out on such a grand scale. Remember, Office 365 is just $99.99 a year. OneDrive might not be the best cloud storage service, especially for OS X customers, but unlimited is unlimited — in comparison, I pay Google $9.99 a month for 1 TB. - -Microsoft products are indeed pure crap on a Mac. Office for Mac 2011 is horrible (speed and bloat aside, some features are simply not implemented — try to import a UTF-8 CSV into Excel, all non-ASCII characters become underscores; Microsoft’s response was that Unicode import was not implemented yet). OneDrive.app is slow like crawl, and it never finishes syncing — always stuck on the last few megabytes, eating up 100% CPU. Thank god I only use it for backups. The web interface is okay, although Google Drive is faster — blazing fast, I can easily upload with 20+MB/s. But again, **unlimited is unlimited.** - -Microsoft is opening a new chapter of cloud storage. In today’s world, we have so many huge video files, so storage limit should indeed be something of the past. This is a smart move for Microsoft — when you have, say, 100 TB up there (which seems very far at this moment, but what if all contents go 4K), and if competitors don’t offer comparable plans, then you are stuck with Microsoft. And Office. Oh my god, Microsoft Office must die. - -Of course I don’t want to be stuck with Microsoft, so I’m looking at how Google and Apple will handle this. Google ought to offer more affordable plans, preferably also unlimited. (My 1Password still has it that I purchased Office for Mac University 2011 on Nov 12, 2012 for $99.99. That turned into a free 4-year Office 365 subscription, which contains 60 world minutes of Skype per month, 1 TB of OneDrive — oh, now it’s about to go unlimited. All for $99.99. In comparison, Google charges me $119.88 per year.) Apple wants you to save everything to iCloud, and it introduced iCloud Drive and Cloud Kit this year — but plans still start at 5 GB and tops out at 1 TB, seriously? Dude, you sell top notch hardware with huge profits; why don’t you pay your customers back by offering better cloud storage — that’s also better for iCloud. diff --git a/source/blog/2014-10-28-google-drive-no-selective-subfolder-sync.md b/source/blog/2014-10-28-google-drive-no-selective-subfolder-sync.md deleted file mode 100644 index 06a72b4b..00000000 --- a/source/blog/2014-10-28-google-drive-no-selective-subfolder-sync.md +++ /dev/null @@ -1,53 +0,0 @@ ---- -title: "Google Drive — no selective subfolder sync?" -date: 2014-10-28T20:49:24-0700 -date_display: October 28, 2014 ---- - -Up to this point I've been using Google Drive as an online backup service, and uploads files mostly manually, although I do sync `~/img` with the client. - -**Aside.** Google Drive, OneDrive, etc. don't work with symlinks. Wanna keep your stuff free and duplicate-free yet still synced to the servers? Use `rsync` to automatically reproduce your folder structure with hard links: - - rsync -avzP --delete --link-dest=SOURCE/ SOURCE DESTINATION - -e.g., - - rsync -avzP --delete --link-dest=~/img/ ~/img/ ~/sync/GoogleDrive/img/ - -automatically reproduces my `~/img` in the `img` directory under Google Drive's root, yet every file in the `~/img` tree is replaced by hard links to the original file, so the new structure within Google Drive takes little additional space — for the directories only. - -That doesn't solve every problem though, as you will see shortly. *End of aside.* - -So, up to this point I’ve mostly used Google Drive as an online backup service by manually uploading (huge) stuff. But at some point I’m gonna automate parts of the uploading. As it turns out, I can keep some smaller video files on my hard drive; other bigger monsters (like movies, TV shows, etc., especially a lot of 1080i Transport Streams directly from TV broadcasts) are uploaded and then moved to external drives. Some of the smaller files, including things downloaded from YouTube, live in `~/vid/etc`, and I want to sync this folder to Google Drive. What's shocking is that this is not possible with the Google Drive client — it only allows selective syncing of the top level folders. Let me repeat this: - -**The Google Drive client only allows selective syncing of the _top level folders_.** - -This is *insane*. It’s almost 2015. Everyone supports this — Dropbox, Microsoft, Box, even Baidu. Google Drive launched on April 24, 2012, that’s 2.5 years ago. [This thread](https://productforums.google.com/forum/#!topic/drive/Gs2w1BL-B9U) on Google Drive Forum, “Ability to sync only selected sub folders”, was posted on August 27, 2012, and has garnered 139 replies. They are ignored by the developers, and the accepted “answer” is to utilize Google Drive’s assign-one-file/folder-to-multiple-folders feature to create a special “sync” directory. Okay, that’s a stupid hard link solution on the server side. Okay, if that works… *No*. “Hard links on the server side” cannot bear different names; so what if I want to sync, say, both `vid/etc` and `aud/etc`? Whoops. So I also have to do all sorts of ugly renaming. NO, GOOGLE, NO, I won't accept that much trouble. - -This kind of insanity makes me wander: - -**Do the Google Drive developers use Google Drive themselves?** - -For now I'm moving `vid/etc` to `vid_etc`. Sigh. - ---- - -There are other problems that I encountered with Google Drive sync today. For one thing, it rejects what I already have and insists on starting from scratch. I mean, say I have uploaded a folder via the web interface, and later wants to keep it in sync (of course that's only possible if it's top level), so I put what I already have there. Nope, Google Drive reports that as a conflict and insists on downloading all the stuff again. Apart from wasted traffic, that also ruins my hard links, so I have to either wipe everything clean on the server side and reupload, or redownload everything and redo all the hard-linking after the download finishes. Either way, very annoying. I opted for the first one. (I later empirically confirmed that OneDrive could handle this situation.) - -There are other problems that don't pop right off my mind. Anyway, the gist is, - -**Google Drive is not yet sync-ready for power users (maybe even laymen).** - ---- - -Then, is OneDrive perfect? No. I know it recently went unlimited, but there’s one major annoyance: the speed. Stanford’s Ethernet speed is almost 1 Gbps UL/DL, but the OneDrive client tops out at about 2 MBps. The web interface isn’t much better. Google Drive is a lot faster than that, which makes it a good backup service for manual uploading. Anyway, maybe OneDrive will improve over time; yesterday they delivered an update to OneDrive.app, and at least it finally works. - -OneDrive also boasts no file status indicators on OS X, which everyone else in the industry has. That’s not a show-stopper though, if you just use it as a backup service. - ---- - -What about Dropbox? Dropbox is a truly awesome sync-ready service, but it is at the same time pretty expensive compared to others. Also, since I use Dropbox as a sync service, it must be up at all times and constantly indexing, so I’m really cautious with what I put there to avoid unnecessary cycles and startup time. - ---- - -Everything is broken in one way or another. Sigh. Let's hope that OneDrive improves a lot in the coming months; if it's stable enough and the speed gets some boost, I'll cancel my Google Drive subscription. I am a Google supporter and Microsoft hater, but a service that *works* is more important than ideology. diff --git a/source/blog/2014-10-28-mou-1-dot-0-fundraiser-goal-reached.md b/source/blog/2014-10-28-mou-1-dot-0-fundraiser-goal-reached.md deleted file mode 100644 index f6aa8d0c..00000000 --- a/source/blog/2014-10-28-mou-1-dot-0-fundraiser-goal-reached.md +++ /dev/null @@ -1,16 +0,0 @@ ---- -title: "Mou 1.0 fundraiser: goal reached" -date: 2014-10-28T01:57:06-0700 -date_display: October 28, 2014 ---- - -A week ago I wrote a post [*Help Mou hit 1.0*](/blog/2014-10-20-help-mou-hit-1-dot-0.html). Today, I'm delighted to find out that Mou has reached its goal, $20,000, half way into the fundraiser. - -![Mou hit its goal on Indiegogo](https://i.imgur.com/vM298t5.png) - -So what do I expect from 1.0? Most importantly, - -* CommonMark support, especially GFM fenced code block and saner nested structures; -* Custom Markdown engine (I would like to call [`stmd`](https://github.com/jgm/CommonMark)). - -Whatever the case, Emacs is still my best friend. diff --git a/source/blog/2014-10-29-fun.md b/source/blog/2014-10-29-fun.md deleted file mode 100644 index 4e733427..00000000 --- a/source/blog/2014-10-29-fun.md +++ /dev/null @@ -1,14 +0,0 @@ ---- -title: "Fun" -date: 2014-10-29T11:26:29-0700 -date_display: October 29, 2014 ---- - - -This happened in yesterday's Math 210A lecture. - -> Ravi: I won't be here next Thursday.<br> -> Someone: Will there be a lecture?<br> -> Ravi: Yeah, Brian Conrad will give a lecture. Don't tell him, he don't know this yet. - -... diff --git a/source/blog/2014-11-02-vobcopy-dvdbackup-etc.md b/source/blog/2014-11-02-vobcopy-dvdbackup-etc.md deleted file mode 100644 index b0b1d8ca..00000000 --- a/source/blog/2014-11-02-vobcopy-dvdbackup-etc.md +++ /dev/null @@ -1,89 +0,0 @@ ---- -title: "vobcopy, dvdbackup, etc." -date: 2014-11-02T15: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.html). As said, the most important commands are - - hdiutil makehybrid -iso -joliet -o AUDIO_CD_NAME.iso SOURCE - -for Audio CDs and - - hdiutil makehybrid -udf -o DVD_NAME.iso SOURCE - -for DVDs. - -Those alone don't finish the story. I also tried other things and unfortunately encountered problems. I was too busy to report back then, but now I'll summarize some of the findings. - ---- - -For one thing, `hdiutil makehybrid` might fail, issuing an "Operation not permitted" for no obvious reason. This could even happen when you work with the Disk Utility GUI (for which I once got a "Permission denied"). Even `sudo` didn't help in my case. However, I was able to **circumvent the problem with the root shell** (I won't tell you how to enter the root shell — you need to at least have that amount of knowledge about the root shell before you are given the key). Not sure why. Just keep in mind that the root shell might help (that's also a general, albeit dangerous, advice for life). - ---- - -Next onto grabbing the raw VOB. - -`vobcopy` is pretty sweet, but at least for me it had one huge problem. When I tried to copy a single title, say title #2 with - - vobcopy --title-number TITLE_NUMBER -i SOURCE - -other titles got copied, too. I didn't have enough samples to test out, but presumably it's because the problematic DVD has a structure like this: - -![problematic DVD title structure](https://i.imgur.com/HTgmwQL.png) - -Anyway, no matter I `vobcopy` title 01, 02, or 03, the result was the same — the whole thing. That's pretty stupid. I don't know if it counts as a bug or unfinished feature. Definitely not cool. - -(One cool thing about `vobcopy`: as long as you complied with `libdvdread`, you can create a fully decrypted version of the DVD with - - vobcopy --mirror -i SOURCE - -Of course, to get an iso image out of the decrypted mirror, you run the `hdiutil makehybrid -udf` command given above.) - ---- - -So `vobcopy` is dead (for copying specific titles in unfortunate DVDs). What's next? - -There's `dvdbackup`. The man page is good, and [ArchWiki](https://wiki.archlinux.org/index.php/dvdbackup#A_single_title) is even better (*ArchWiki is awesome!*), providing you cookbook solutions of combining the power of `dvdbackup` and `dvdauthor` (cookbooks are nice when dealing with unexciting technologies like DVD). In fact, `dvdbackup` alone is enough for extracting the VOBs of relatively small titles (< 1GiB): - - dvdbackup -i SOURCE -o VOB_TARGET_DIR -t TITLE_NUMBER -n TITLE_NAME - -then grab your title-specific VOB in `VOB_TARGET_DIR/TITLE_NAME/VIDEO_TS`. Unlike `vobcopy`'s `-n/--title-number` option, `dvdbackup`'s `-t/--title` option does it right, trimming everything else. However, there's a problem when the title is larger than 1 GiB — then `dvdbackup` will split the VOB into several 1 GiB max pieces, and there's no way to disable this (since `dvdbackup` is targeting a DVD player — ancient technology — rather than `mpv` or whatever). What's sadder is that I can't seem to combine the split VOBs with FFmpeg stream copy — `pcm_dvd` audio always gets converted to `mp2` and fails when I use `-c copy`. I'm not a codec expert, but I suppose this is due to the fact that `pcm_dvd` isn't a supported encoding codec of FFmpeg (at least not my FFmpeg): - - > ffmpeg -codecs | grep pcm_dvd - D.A..S pcm_dvd PCM signed 20|24-bit big-endian - -`D` is for "Decoding supported", `A` is for "Audio codec", `S` is for "Lossless compression" — no encoding support. By the way, my FFmpeg is `brew`ed with the options `--with-fdk-aac`, `--with-ffplay`, `--with-freetype`, `--with-libass`, `--with-libbluray`, `--with-openjpeg`, `--with-openssl`, `--with-x265`: - - > \ffmpeg -version - ffmpeg version 2.4.2 Copyright (c) 2000-2014 the FFmpeg developers - built on Oct 19 2014 14:09:36 with Apple LLVM version 6.0 (clang-600.0.51) (based on LLVM 3.5svn) - configuration: --prefix=/usr/local/Cellar/ffmpeg/2.4.2 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-nonfree --enable-hardcoded-tables --enable-avresample --enable-vda --cc=clang --host-cflags= --host-ldflags= --enable-libx264 --enable-libfaac --enable-libmp3lame --enable-libxvid --enable-libfreetype --enable-libass --enable-ffplay --enable-libfdk-aac --enable-openssl --enable-libx265 --enable-libopenjpeg --disable-decoder=jpeg2000 --extra-cflags='-I/usr/local/Cellar/openjpeg/1.5.1_1/include/openjpeg-1.5 ' - libavutil 54. 7.100 / 54. 7.100 - libavcodec 56. 1.100 / 56. 1.100 - libavformat 56. 4.101 / 56. 4.101 - libavdevice 56. 0.100 / 56. 0.100 - libavfilter 5. 1.100 / 5. 1.100 - libavresample 2. 1. 0 / 2. 1. 0 - libswscale 3. 0.100 / 3. 0.100 - libswresample 1. 1.100 / 1. 1.100 - libpostproc 53. 0.100 / 53. 0.100 - -Maybe I missed some `--enable`. - -Sorry for the digression. So, it's not possible to stream-copy-concat the VOBs with FFmpeg. (In fact, since audio quality is not that important — you won't be able to tell 256k AAC from lossless anyway, especially when you are focusing on the video, so you can always transcode `pcm_dvd` into 256k AAC with `-c:a libfdk_aac -b:a 256k`. `mpeg2video` is an encoding supported codec so stream copy works fine. Or you may also use `flac` or whatever encoding-supported lossless codec.) However, if you insist on getting the original `pcm_dvd`, there is a way, an ugly way. You've gotta be creative here. [ArchWiki](https://wiki.archlinux.org/index.php/dvdbackup#A_single_title) already provides a cookbook solution on how to use `dvdbackup` and `dvdauthor` to create a DVD with a selected title. And `vobcopy` can copy the entire thing just fine, without the 1 GiB limit (make sure to use the `-l/--large-file` option if the size is greater than 2 GiB). Therefore, you can create a DVD with selected title from the original DVD, then `vobcopy` from the new DVD. This is insane, but it works, I've tested that. **Note, however, that timestamps might be wrong with `vobcopy`, so the VOB runs just fine linearly but might run into problems when you seek.** Therefore, FFmpeg is still the way to go. Or maybe you can do it right with one click using some closed source software ☹ — I've heard about success stories with the long ceased DVD Decrypter Windows project. In reality, I guess only people with theoretical interest or OCD will ever do this — FLAC or AAC should serve everyone just fine. It should have worked with `vobcopy` alone, but it doesn't. Hence the workaround. - ---- - -For future reference, I'll translate the ArchWiki cookbook solution here (it's too cookbook itself, specifying paths like `~/movie_name` and using unnecessary `cd`) about creating a title-specific DVD from a multi-title DVD (replace `SOURCE`, `VOB_TARGET_DIR`, `DVD_TARGET_DIR`, `TITLE_NUMBER`, and `TITLE_NAME` with sane values): - - dvdbackup -i SOURCE -o VOB_TARGET_DIR -t TITLE_NUMBER -n TITLE_NAME - dvdauthor -t -o DVD_TARGET_DIR VOB_TARGET_DIR/TITLE_NAME/VIDEO_TS/*.VOB - export VIDEO_FORMAT=NTSC - cd DVD_TARGET_DIR/VIDEO_TS && dvdauthor -T -o DVD_TARGET_DIR - -`export VIDEO_FORMAT=NTSC` is to avoid the `dvdauthor` error of "no default video format, must explicitly specify NTSC or PAL" (I'm not sure about the difference between NTSC and PAL, but I saw NTSC printed on my DVD, so I used it). And there you go, a shiny new DVD filesystem located in `DVD_TARGET_DIR`. (Note that unlike `vobcopy`, `dvdbackup` doesn't feature a nice progress bar even when `-v/--verbose` and `-p/--progress` are specified.) Then you can - - vobcopy -l DVD_TARGET_DIR - -if you'd like to. Recall that timestamps might be wrong, sadly. diff --git a/source/blog/2014-11-05-apple-is-pushing-yosemite-hard.md b/source/blog/2014-11-05-apple-is-pushing-yosemite-hard.md deleted file mode 100644 index 9b9bf3f1..00000000 --- a/source/blog/2014-11-05-apple-is-pushing-yosemite-hard.md +++ /dev/null @@ -1,31 +0,0 @@ ---- -title: "Apple is pushing Yosemite hard" -date: 2014-11-05T22:17:01-0800 -date_display: November 5, 2014 ---- - -Apple is pushing Yosemite hard and secretly Yosemitizing things. iTunes was updated to its shiny new look on Mavericks, day one upon Yosemite launch. I liked it. The only problems I had with the new iTunes are: - -* It's no longer possible to go to the Artists view and Music Videos view with one click. Artists is now a drop-down menu option in My Music view; Music Videos is now a sidebar tab in Playlists view. - -* The red icon doesn't look as good as the previous blue one, and it doesn't harmonize too well alongside the blue Finder and Mail. Maybe they will look better together in Yosemite. - -Just now I found that the Mac App Store in Mavericks is also Yosemitized: - -![Yosemitized Mac App Store](https://i.imgur.com/T7KIo6s.png) - -The chromeless UI certainly looks a bit weird, and the font seems a bit too small. However, I'm sure I'll quickly get over these shortcomings, and might even grow to appreciate them. Even more so when I finally upgrade to Yosemite (I'll wait for Thanksgiving break or 10.10.1 this year, whichever comes first — looks like the former will come first, considering the first 10.10.1 developer beta was out [merely two days ago](http://www.macrumors.com/2014/11/03/first-yosemite-10-10-1-beta-now-available/), [reportedly](https://i.imgur.com/IVFV7E2.png) focusing on WiFi, etc.). - -On the font side, unfortunately the small font size in the new Mac App Store does make text fuzzy on my non-Retina display. I didn't notice the fuzziness in the new iTunes. Anyway, everything is optimized for Retina — Apple is also secretly pushing Retina hard. In the Apple ecosystem, apparently you always want to stay at the top of the line. Due to Apple's nature, the degree of hardware-software integration is simply unparalleled, so only the latest hardware enjoys all the new features and love. Unfortunately, the typical lifespan of a Mac is much longer than the hardware/software release cycle. - -The truth is, we (or at least I) adapt to things much quicker and easier than we'd imagined (or otherwise would be willing to admit). When iOS 7 was demo'ed on WWDC 2013, I was like "no way! What's with those stupid flat crap?" But when the update came, I hopped on and was happy ever since. (I reserve my opinion on the icon design.) Later when I installed an app that was not updated for the new UI, I was like "OMG, what's with this clumsy UI?" I guess legibility issues, WiFi issues (with Yosemite) and responsiveness issue (with iOS 8 on iPhone 4S — *AT&T, where's my preordered 6 Plus?*) are harder to impossible to adapt to, but they will eventually be fixed, or support-dropped, or hardware-upgraded (with $$). So in the end (almost) everyone will be happy. And one day when we face the old thing again by chance, we'll flee as fast as we can: "what's with that..." (I did exaggerate. Also, I know, many people just don't care about design, or have ill tastes, or can't find the buttons after a minimal number of UI tweaks — I'm not including them in the "we" here.) Those who claim that "I won't upgrade until..." are just kidding themselves, and certainly no one will wait for them or make their "until..." come true. Most of those "won't upgrade" folks will eventually upgrade and be happy. Those that really don't upgrade (like those still running Snow Leopard) either can't afford the new hardware, or suffer from senility (seen from the deep hostility towards new things). Or they have some important legacy software that would break with an upgrade; poor dudes. - -Same goes for newer, shinier, seemingly unnecessary deluxe hardware. I'm still stuck on a Mid-2012 MBP 13" Non-Retina. Retina seems highly useless for me since I do most of my work on the 27" external display — the 13" internal LCD hosts a single maximized Activity Monitor window most of the time (and sometimes also a Transmission window). I expect my opinion about Retina to change after I upgrade to a Retina model next year. (It will be a pretty major purchase though — i7, 16 GB memory, and 512 GB SSD are musts, and there are like a million peripherals to buy — Thunderbolt to Ethernet, Super Drive, etc., etc.) This shift of opinion after upgrading to something unnecessarily good (and ending up not being able to tolerate anything inferior) is best described as "**sadly converted**". Some folks are already sadly converted by the Retina iMac. See, for example, [this article](http://arstechnica.com/apple/2014/11/yes-the-5k-retina-imacs-screen-runs-at-60hz-at-5k-resolution/#p11) on Ars Technica: - -> Prior to getting the Retina iMac on my desk, I would have said that "retina" isn’t necessarily something we need on the desktop. Most people don’t notice pixels on the desktop at a normal seating distance. However, after getting to A/B compare the Retina iMac with the standard one over the course of a week, I’m sadly converted. I just don’t know if my wallet can take the abuse. - -And others are bitterly desiring one (me included — sadly two Macs are too much for a university dorm). See, for example, [this comment](http://arstechnica.com/apple/2014/11/yes-the-5k-retina-imacs-screen-runs-at-60hz-at-5k-resolution/?comments=1&post=27896871) on the aforementioned article: - -> I WISH APPLE TECHNICA WOULD STOP WITH ALL THESE ARTICLES ABOUT THE IMAC. -> -> It really makes me want one unjustifiably. diff --git a/source/blog/2014-11-05-list-youtube-playlist-with-youtube-dl.md b/source/blog/2014-11-05-list-youtube-playlist-with-youtube-dl.md deleted file mode 100644 index fa624b69..00000000 --- a/source/blog/2014-11-05-list-youtube-playlist-with-youtube-dl.md +++ /dev/null @@ -1,73 +0,0 @@ ---- -title: "List YouTube playlist with youtube-dl" -date: 2014-11-05T10:37:58-0800 -date_display: November 5, 2014 ---- - -Of course you are always welcome to use the [Google APIs Client Library for Python](https://developers.google.com/api-client-library/python/) to wrestle with YouTube, which is usually pretty simple. (As an added bonus, YouTube has some [nice runnable sample scripts](https://developers.google.com/youtube/v3/code_samples/) to get you started.) With the client library, listing videos in a YouTube playlist is a breeze. - -However, if you don't feel like writing code yourself (I usually don't feel like writing code myself until I use something often enough and existing solutions are suboptimal), `youtube-dl` recently added the functionality to list videos in a playlist with the `--flat-playlist` option. - -[According to one of the project collaborators](https://github.com/rg3/youtube-dl/issues/4003#issuecomment-60322630), currently `--flat-playlist` is only helpful with the `-j` option for dumping JSON (so I suppose this feature is subject to change). For instance, `--flat-playlist` alone would emit something like this: - -```bash -> youtube-dl --flat-playlist 'https://www.youtube.com/watch?v=gdOwwI0ngqQ&list=PLPpZI8R1zUfrkDbmJMOBhEbJ9Td9vbV-F' -[youtube:playlist] Downloading playlist PLPpZI8R1zUfrkDbmJMOBhEbJ9Td9vbV-F - add --no-playlist to just download video gdOwwI0ngqQ -[youtube:playlist] PLPpZI8R1zUfrkDbmJMOBhEbJ9Td9vbV-F: Downloading webpage -[youtube:playlist] PLPpZI8R1zUfrkDbmJMOBhEbJ9Td9vbV-F: Downloading page #1 -[download] Downloading playlist: Cam By apinknomfan -[youtube:playlist] playlist Cam By apinknomfan: Collected 119 video ids (downloading 119 of them) -[download] Downloading video #1 of 119 -[download] Downloading video #2 of 119 -[download] Downloading video #3 of 119 -[download] Downloading video #4 of 119 -... - -``` - -which doesn't really make sense — it tells you that it collected 119 video ids, and no more. Once you have `-j` on, you get JSON data that you can parse with anything: - -```bash -> youtube-dl -j --flat-playlist 'https://www.youtube.com/watch?v=gdOwwI0ngqQ&list=PLPpZI8R1zUfrkDbmJMOBhEbJ9Td9vbV-F' -{"url": "gdOwwI0ngqQ", "_type": "url", "ie_key": "Youtube", "id": "gdOwwI0ngqQ"} -{"url": "j9l5nchv1Z8", "_type": "url", "ie_key": "Youtube", "id": "j9l5nchv1Z8"} -{"url": "znW5ALwWNQw", "_type": "url", "ie_key": "Youtube", "id": "znW5ALwWNQw"} -{"url": "qyE7-auTIcc", "_type": "url", "ie_key": "Youtube", "id": "qyE7-auTIcc"} -... - -``` - -The most straightforward way to parse this is to use a command line JSON parser, the best one being [jq](https://github.com/stedolan/jq): - -```bash -> youtube-dl -j --flat-playlist 'https://www.youtube.com/watch?v=gdOwwI0ngqQ&list=PLPpZI8R1zUfrkDbmJMOBhEbJ9Td9vbV-F' | jq -r '.id' | sed 's_^_https://youtube.com/v/_' -https://youtube.com/v/gdOwwI0ngqQ -https://youtube.com/v/j9l5nchv1Z8 -https://youtube.com/v/znW5ALwWNQw -https://youtube.com/v/qyE7-auTIcc -... - -``` - -There you go, a list of URIs you can use. Of course you can put this in a script to save some typing: - -```bash -#!/usr/bin/env bash -# Takes a YouTube URI to a playlist (fairly liberal, it's fine as long -# as the playlist id can be extracted), and prints a list of URIs in a -# YouTube playlist. -# -# Requires youtube-dl 2014.10.24, tested on youtube-dl -# 2014.11.02.1. Feature subject to change. -youtube-dl -j --flat-playlist "$1" | jq -r '.id' | sed 's_^_https://youtube.com/v/_' -``` - -**_Aside:_** I first embedded the gist here, but [it looked a bit off](https://i.imgur.com/m3cr0Im.png). See [imathis/octopress#1392](https://github.com/imathis/octopress/issues/1392). - -> In the next version of the Gist tag plugin we are just downloading the gists and embedding them upon generation so we don't have to worry about GitHub going down and breaking all your gists, or changing the HTML and breaking all the styles. -> -> For the time being I suggest embedding your code snippets directly if you want them to look good. - -Okay. End of aside. - -By the way, `youtube-dl` supports playlist bulk download natively. The reason I need a list of video ids or URIs, however, is that among other things, `youtube-dl` doesn't download highest resolution DASH video by default, so I have to rely on something like `youtube-dl-dash` ([link](https://github.com/zmwangx/sh/blob/master/youtube-dl-dash)) to download the best version. diff --git a/source/blog/2014-11-06-2014-nobel-prize-in-physics-led-lights-seriously.md b/source/blog/2014-11-06-2014-nobel-prize-in-physics-led-lights-seriously.md deleted file mode 100644 index 2805a7a8..00000000 --- a/source/blog/2014-11-06-2014-nobel-prize-in-physics-led-lights-seriously.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -title: "2014 Nobel Prize in Physics — LED lights, seriously?" -date: 2014-11-06T11:08:45-0800 -date_display: November 6, 2014 ---- - -For some reason, I only learned about this year’s laureates today, through [the reference frame](http://motls.blogspot.com/2014/11/ex-employer-wont-meet-blue-led-nobel.html). The prize goes to the inventors of the LED. Not exciting at all, so I don’t care if I’m ever informed. (Lubos has a good point on why applied physics — well, let’s even widen the concept of applied physics a bit — should not surprise anyone when they appear in a Nobel Prize announcement: “After all, Alfred Nobel might have very well considered his dynamite to be a discovery in physics, too.”) - -The Nobel Prize Physics Awards has been rather amusing in recent years. Partly due to controversy on the theoretical front and no breakthrough on the experimental front, I guess. (The discovery of Higgs was a breakthrough to some extent, but it was totally expected; little physics beyond SM at LHC before LS1 is sad. Since it was totally expected, the award went to theorists — some experimentalists might not be too thrilled.) Just look at the recent list: 2010, graphene (shouldn’t that be chemistry? if material science can be part of physics, then chemistry must surely encompass it, too); 2009, CCD sensor (whatever that means, maybe that’s important); 2008, fibers (okay, I love fast Internet connections). The list actually goes all the way down to early 20th century, but it’s much denser in recent decades. Now one more: 2014, LED. - -> “for the invention of efficient blue light-emitting diodes which has enabled bright and energy-saving white light sources” - -Wow, energy-saving. I guess next year’s prize will go to the inventors of high efficiency urinals, for being resource-saving. -**I mean, LEDs are great, but not great as physics, much less a physics breakthrough.** - -Let’s compare the applied folks to other laureates: Lorentz, J. J. Thomson, Planck, Einstein, Bohr, Heisenberg, Schrödinger, Dirac, Fermi, Pauli, Born, Lee, Yang, Landau, Feynman, Schwinger, Gell-Mann, Weinberg, ’t Hooft, etc. Not on the same level. - -It’s good to see that a growing body of physicists are (or at least as it seems to me) increasingly reserved about the Nobel Prize, and prizes in general. Same goes for math, with the Nobel Prize replaced by something else. (Employers still love the big titles, I suppose — good to have some star faculty on board.) diff --git a/source/blog/2014-11-07-interstellar.md b/source/blog/2014-11-07-interstellar.md deleted file mode 100644 index 4e7d9f92..00000000 --- a/source/blog/2014-11-07-interstellar.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -title: "Interstellar" -date: 2014-11-07T23:56:31-0800 -date_display: November 7, 2014 ---- - -Today (I mean November 7, 2014 — it’s technically November 8 at the time of writing) I saw [*Interstellar*](https://en.wikipedia.org/wiki/Interstellar_%28film%29) (IMAX digital) at AMC Mercado 20. I rarely go to movie theaters, less on the release day (film formats of *Interstellar* were released on November 5, and digital formats followed on November 7). However, reviews of it were positive (from the physics community), and I really need a way to release stress these days — I wasn’t in the right condition for months. So I figured I’d just spend an afternoon in front of the big screen. - -I’ve heard good things about IMAX 70mm film, like no trailers, among other things. But I didn’t bother the extra seven miles’ drive to Hackworth IMAX Dome, so I landed on IMAX digital. Still a pretty stunning experience, although I ended up watching forty minutes worth of trailers before the real thing (arrived fifteen minutes early). In hindsight maybe I’d be better off spending some extra time on the road. - -Speaking of the movie itself, they tried to make it as plausible as possible from a physics viewpoint, by involving [Kip Thorne](https://en.wikipedia.org/wiki/Kip_Thorne) of Caltech. (There’s even a book out, *The Science of Interstellar*.) For instance, the wormhole isn’t portrayed as a hole (I mean, imagine a ring in empty space, as you would picture in your mind when you hear the word “hole” out of nothing; that’s not how it looks like here, and there’s a nice explanation). Some of the physics still doesn’t work out quite well, though, like Cooper’s not crushed at the singularity… Also there are communications from within the horizon and breakdown of causality, explained in the movie as happening in four dimension slices of some five dimensional spacetime where time could be a physical dimension. Obviously these are needed to get the sci-fi story going, so no one should be blamed. - -I was there for the sci-fi and physics, but a nice surprise was that I was also touched by the humanity elements of story, I mean, family and stuff. - -The downside: Cooper’s accent was a bit hard on me ☹ diff --git a/source/blog/2014-11-10-average-phone-plan-in-the-u-dot-s-costs-ten-time-as-much-as-that-in-the-u-dot-k.md b/source/blog/2014-11-10-average-phone-plan-in-the-u-dot-s-costs-ten-time-as-much-as-that-in-the-u-dot-k.md deleted file mode 100644 index d80b421a..00000000 --- a/source/blog/2014-11-10-average-phone-plan-in-the-u-dot-s-costs-ten-time-as-much-as-that-in-the-u-dot-k.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -title: "Average phone plan in the U.S. costs ten time as much as that in the U.K." -date: 2014-11-10T11:11:46-0800 -date_display: November 10, 2014 ---- - -To quote [Opera News](http://blogs.opera.com/news/2014/11/mobile-data-anyway/), - -> According to research by the International Telecommunication Union, the average phone plan with 500MB of data costs $85 in the United States, compared to $24.10 in China and $8.80 in the United Kingdom. - -Holy shit! diff --git a/source/blog/2014-11-11-re-encoding-everything-for-iphone-6-plus.md b/source/blog/2014-11-11-re-encoding-everything-for-iphone-6-plus.md deleted file mode 100644 index c80cbe18..00000000 --- a/source/blog/2014-11-11-re-encoding-everything-for-iphone-6-plus.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -title: "Re-encoding everything for iPhone 6 Plus" -date: 2014-11-11T13:31:25-0800 -date_display: November 11, 2014 ---- - -AT&T finally delivered my iPhone 6 Plus (silver, 64 GB) after about fifty days since preorder… The 1080p Retina display is simply stunning. However, it turns out that my old videos don’t work so well on 6 Plus’s giant screen. My old mobile video collection was optimized for my 16 GB 4S, targeting the small screen and highly limited storage — you guessed it, they were resized to 960x540, and they looked great. But they’re not up to the task any more. 960x540 videos aren’t at all sharp on the stunning screen of 6 Plus, which is more than capable of handling 4x pixels. Therefore, I have no choice but to feed it more pixels. I’m left in a weird situation, where my 1080p desktop (or even HDTV) quality videos should fit the screen just fine, but H.264 profile stands in the way. iPhone 6 and 6 Plus are only capable of High Profile level 4.2, so anything encoded in level 5.1, for instance, needs to be re-encoded. Also there are still MPEG-2 and MPEG-4 videos out there (MPEG-4 should be obsolete by now, I assume, but some people still use it; and MPEG-2 is de facto in TV broadcasts), which have to be transcoded. Okay, it’s a daunting task to re-encode a fairly big collection, but I have to do it sooner or later. Presumably this weekend. I’ll also report whether 720p videos look sharp on the screen later. diff --git a/source/blog/2014-11-19-convolution-of-irreducible-characters.md b/source/blog/2014-11-19-convolution-of-irreducible-characters.md deleted file mode 100644 index 7466b1cd..00000000 --- a/source/blog/2014-11-19-convolution-of-irreducible-characters.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -title: "Convolution of irreducible characters" -date: 2014-11-19T20:40:37-0800 -date_display: November 19, 2014 ---- - -__*TL; DR:* The actual PDF write-up is [here](https://dl.bintray.com/zmwangx/generic/20141119-convolution-of-irreducible-characters.pdf).__ - ---- - -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. - -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 deleted file mode 100644 index ed3c706e..00000000 --- a/source/blog/2014-11-20-dropbot-for-geeks(r).md +++ /dev/null @@ -1,20 +0,0 @@ ---- -title: "Dropbot for Geeks®" -date: 2014-11-20T09:48:15-0800 -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. - ---- - -With the level of command line integration illustrated above, we'll finally get rid of clicking around and not being able to automate chores. Navgating the remote file system will be a breeze — click, click, click, click, click (sometimes click should be replaced by double click, which is even more painful) just to navigate to a directory will be made a thing of the past. `ln`, in particular, saves disk space for duplicates — Dropbot for Geeks does *not* want to charge you extra for multiple copies of the same file in different directories. (To facilitate syncing hardlinks, clients should be able to specify hardlinked files in a config file. Or maybe some better mechanism. This might be hard.) At last, checksums are a must. I’ve had traumatic experiences like having downloaded an eight-part RAR, 1 GiB each, only to find that it wouldn’t unRAR. Without checksums, it was impossible to find which part was corrupted. As a result, I had to re-download everything — a nightmare. I never want to experience similar problems again. Hence the precious checksums. - -Dropbot for Geeks looks like a pretty good (well, not really, but at least pretty cool®) model. Maybe I should patent it before anyone else? Then if some similar service surfaces in the future, I can [sue their ass off and enjoy some hot cash](http://arstechnica.com/tech-policy/2014/11/jury-apple-must-pay-23-6m-for-old-pager-patents/). diff --git a/source/blog/2014-11-24-iphone-photography-frustration.md b/source/blog/2014-11-24-iphone-photography-frustration.md deleted file mode 100644 index beb54f0e..00000000 --- a/source/blog/2014-11-24-iphone-photography-frustration.md +++ /dev/null @@ -1,31 +0,0 @@ ---- -title: "iPhone photography frustration" -date: 2014-11-24T12:42:25-0800 -date_display: November 24, 2014 ---- - -**TL; DR:** Jump to the paragraph “In the end…” - ---- - -I'm not a photo-savvy guy. I've never taken a single selfie in my life, and my iPhone Photos app witnesses about twenty photos a year — fifteen of which are accidental screenshots. Okay, a little bit of exaggeration. The iPhone, aka iCamera, especially the 6 Plus model, is sort of a waste in my possession. However, my grandparents came to visit me on campus yesterday, and my grandma *loves* photos. So I took one with them, using my phone (which is obviously better than my grandma’s digital camera). The lighting was wrong, but I was able to fix that in five seconds — clicked “Edit”, clicked on the little sun icon (whatever it is called), clicked on “Light”, slided the slidebar all the way to the right, and all of a sudden it looked perfect. (This is the first time I ever clicked those, but I got it nicely done in five seconds — very intuitive, deeply impressed.) From a layman’s perspective, the builtin edit feature of the Photos app is really smart. Later I tried to reproduce the same edit with iPhoto, but I had to manually wrestle with exposure, highlights, shadows, brightness, contrast, etc., and I just never got it right. Call me a moron if you feel like it, but I’ve already given you the context at the beginning of this article, so you can’t blame me. (For your reference, I do ’shop some images for fun and profit from time to time, but I never deal with actual unedited photos, so I never have to worry about exposure and stuff.) - -So far so good. The frustation began when I try to import the photo to my Mac. I’m certainly not a mobile guy who keeps everything on his phone or the cloud. I have the photo import feature of Dropbox turned on, so as I plugged in my phone the photo already appearred in the Camera Upload folder. Wait what, two copies? Two copies that looked exactly the same, albeit one is about 0.1 MB larger than the other? Not cool. Pulled up Image Capture; Apple’s own software should do the trick, I guess. Nope, same thing. Googled, found this article on support.apple.com: [*iOS: Edited photos show original photo after import or in other apps*](http://support.apple.com/en-us/HT203612). Okay sure, they know this. Let's listen to what they have to say. - -> Apple uses Extensible Metadata Platform (XMP), a standard created by Adobe, for nondestructive photo editing. XMP allows you to undo edits and to revert back to an original photo without the loss of quality. Displaying the edited photo requires OS X v10.9 or later and software that can read XMP. The following applications support XMP: -> -> * iPhoto 9.5 or later -> * iPhoto for iOS -> * Aperture 3 or later -> * Adobe Lightroom -> * Adobe Photoshop Elements -> -> Other photo-management applications and some iOS apps may also display XMP. - -Adobe Lightroom, oh well. I don’t yet have Adobe CC installed — Photoshop is certainly a powerhouse (plus Illustrator, InDesign, etc. are nice to have at times), but Pixelmator works fine for me most of the time, and I’m happy to go to a library iMac or Mac Pro when I do need the power; $29.99/$19.99 is just too much if I use it twice a month. I theorize that I can indefinitely extend the free trial by running CC in a VM, reverting to a clean snapshot and regenerating the MAC address from time to time, but that’s only a theory — I haven’t got the incentive to test it out. As for iPhoto, I know it’s pretty lame from past experience, and I was very much baffled by the ugly and unintuitive UI, so normally I don’t even want to waste disk space on it; but since it’s only official solution other than expensive Adobe products and Aperture, I decided to install it. 1.7 GB gone. *So does the wasted 1.7 GB do the trick? Sadly, no.* Still the same thing in iPhoto 9.6, which is clearly “iPhoto 9.5 or later”. Totally baffled. - -In the end, I came up with an ugly solution. Just email or iMessage the photo to yourself from the phone. If you use email though, be sure to use the builtin Mail, or you would likely lose Exif data (I sent from Mailbox and lost Exif; I then sent from Mail and didn’t). This is really annoying since setting up accounts in the builtin Mail app is not fun — Google 2FA is not supported, and I have to generate an app-specific password. Compare to Mailbox, where *I signed into Dropbox on the new phone and within five seconds all of my ten email accounts are ready to use*. The loss of Exif data is probably related to [this thread on SO](http://stackoverflow.com/questions/20763814), but I didn’t delve into it since I’m not a Cocoa Touch dev. What’s more confusing, sending the photo via different applications result in different filesizes. The one sent from Mail (I chose original size when I sent it) was a 2 MB JPEG; the one sent from Mailbox was a 4.5 MB JPEG (without the right Exif); and the one sent via iMessage and later opened from the Messages app on Yosemite could be saved as a 10 MB lossless PNG (Exif was there). I went with the 2 MB one in the end. - -I don’t know if iCloud Photo Library will solve the problem in the end. From my perspective, *Apple should train Preview and QuickLook to recognize their XMP technology.* Seriously, they talk about continuity, and I expect to enjoy my enhanced photos on my Mac without going through all the hessle and confusion. Photo enhancing is already such a breeze, thank you; now make sharing and archiving easy, at least within the Apple ecosystem. (Although I’m not familiar with photography and image editing in general, considering how tech-savvy I am, I bet most users can’t even figure out one annoying solution.) - -By the way, Continuity and Handoff only work intermittently for me, and AirDrop between my iPhone (6 Plus) and MacBook Pro (mid-2012, model 9,2) doesn’t work at all. Continuity and Handoff sometimes turn up when they are unexpected (and serve as kinda nice surprises), but when I try to nail them, they remain elusive. Not a big deal for me, but certainly not the most pleasant thing ever. I bet these have to do with the fact that my Mac is connected to Ethernet and sharing the Ethernet connection to my iPhone; these days they expect everyone to be on Wi-Fi (and ironically they messed up big in Yosemite), but Wi-Fi simply can’t beat the speed and stability of Ethernet. I didn’t bother to test whether the features work when my devices are connected to the same Wi-Fi network; even if they do, that’s not my production setup, so they’re still useless to me. 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 deleted file mode 100644 index 43ce2b76..00000000 --- a/source/blog/2014-11-24-why-i-abandoned-mathjax-and-fell-back-to-pdf.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -title: "Why I abandoned MathJax and fell back to PDF" -date: 2014-11-24T20:54:36-0800 -date_display: November 24, 2014 ---- - -Recently I wrote an expository article, [*Convolution of irreducible characters*](https://dl.bintray.com/zmwangx/generic/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. - -By the way, Terry Tao and others use [Luca's LaTeX to WordPress, aka LaTeX2WP](http://lucatrevisan.wordpress.com/latex-to-wordpress/) for math blogging. From Terry's experience it works fairly well. I don't know if `amsthm` and `\def` are in the feature set, though. Anyway, since WordPress handles LaTeX as pre-compiled images (which is also the default on Wikipedia, and which looks poor in general and plays horribly with scaling), LaTeX2WP won't help MathJax users the slightest. diff --git a/source/blog/2014-11-25-i-got-16-gigs-of-ram.md b/source/blog/2014-11-25-i-got-16-gigs-of-ram.md deleted file mode 100644 index 75aecc29..00000000 --- a/source/blog/2014-11-25-i-got-16-gigs-of-ram.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -title: "I got 16 gigs of RAM" -date: 2014-11-25T16:28:30-0800 -date_display: November 25, 2014 ---- - -Today I upgraded the RAM of my MacBook Pro mid-2012 to 2x8GB. I purchased the [Crucial 16GB Kit (8GBx2) DDR3/DDR3L 1600 MHz (PC3-12800) CL11 SODIMM 204-Pin 1.35V/1.5V Memory for Mac CT2K8G3S160BM](http://smile.amazon.com/dp/B008LTBJFW) from Amazon, which cost me $146.64 after tax. I followed the [official guide](http://support.apple.com/en-us/HT201165) as well as the [iFixit guide](https://www.ifixit.com/Guide/MacBook+Pro+13-Inch+Unibody+Mid+2012+RAM+Replacement/10374). To finish the job I needed a Phillips #00 screwdriver and a spudger, so I purchased the [spudger](https://www.ifixit.com/Store/Tools/Spudger/IF145-002) and the [54 bit driver kit](https://www.ifixit.com/Store/Tools/54-Bit-Driver-Kit/IF145-022-1) from iFixit. - -The actual process was pretty simple. I had a little bit of hard time pulling out the bottom module and pushing in the top module, but overall it was smooth. The only stupid thing I did was that I forgot to push the battery connector back in before I closed the case; I only realized this when I was screwing in the eighth screw (that was a close one!), and had to unscrew everything again. - -After I replaced the RAM modules, booting was just normal. And now I've got 16 gigs of RAM! - -![About This Mac->Memory](https://i.imgur.com/PGhdEGr.png) - -Want to run multiple memory hoggers *along with a Windows VM* (with 4GB of RAM)? No problem. - -![Activity Monitor->Memory](https://i.imgur.com/czDcVaK.png) - -By the way, Yosemite is indeed really aggressive at RAM usage. I reserve my opinion on whether there's a memory leak. But so far the performance has been fine, even with 8GB of RAM. diff --git a/source/blog/2014-11-26-original-images-in-day-one-journal.md b/source/blog/2014-11-26-original-images-in-day-one-journal.md deleted file mode 100644 index d68d365e..00000000 --- a/source/blog/2014-11-26-original-images-in-day-one-journal.md +++ /dev/null @@ -1,41 +0,0 @@ ---- -title: "Original images in Day One journal" -date: 2014-11-26T00:22:16-0800 -date_display: November 26, 2014 ---- - -**TL; DR:** Jump to the paragraph beginning with “workaround”. - ---- - -I started a Day One journal two days ago. I've heard good things about Day One, but after using it for a dozen entries, I'm not that satisfied. For one thing, the editor is pretty horrible — keybindings aside, I can’t even find and replace?! And the overview doesn’t look very pretty if you are a heavy Markdown user (i.e., you have a lot of markups, e.g., italics and inline links) — the markups are displayed as is. Moreover, I can’t even `#` my title: it kills the bold font rendering in the bird’s-eye view. What a let down. Anyway, it’s better than nothing, and I hope it will help me keep on track. (I used to manage a Markdown journal in an encrypted sparse bundle, and it was a pain in the ass — mentally. Maybe some GUI sugar is necessary, although Day One is certainly not as pretty as advertised.) Also a private journal means more privacy — I certainly don’t want to publish everything I write on this public blog. - -Too much irrelevant talking. Onto one of the most annoying “features”, and the subject of this post. Images are automatically JPEG-compressed when imported into Day One. See [this support article](https://dayone.zendesk.com/hc/en-us/articles/200145875-Are-photos-resized-when-imported-into-Day-One-), which says: - -> Every photo imported into Day One is converted to JPEG format and resized to a maximum resolution of 2100 x 2100 pixels. The aspect ratio is maintained. We resize photos for more efficient sync and storage. At this size the average photo is about 700KB which means you can store: -> * Dropbox: 2,500+ photos using the free 2GB account -> * iCloud: 6,000+ photos using the free 5GB account - -What the heck. Dude, who cares about storage these days? And transfer rate? I have a gigabit Ethernet. I certainly have much more than 2GB in my Dropbox. Even for those underpriviledged folks with only 2GB, remember, Day One allows *only one photo per entry*. That’s 2,500+ entries. At any rate, this should be an opt-in rather than an uncustomizable “feature”. I’m about to submit a ticket, but I doubt the outcome (I’m sure many people have submitted tickets about the plain text format even when password-protected, but so far, no response). - -With photos, most of the time JPEG compression works pretty well (but people surely want to keep photos in highest quality). However, I’m a techie guy, and my images are often screenshots or precision images, where JPEG compression totally ruins the sharpness. - -Workaround? Simple (yet a bit annoying). Day One lets you show the photo in Finder. So just go ahead and replace that compressed image with the original using `cp` or `mv`. I shouldn’t have needed to do this, but every piece of software comes with some annoyances. Overall Day One’s pretty good — at least it does what it was designed for, albeit not perfectly. - ---- - -By the way, here is my support ticket: - -> I understand that Day One does JPEG compression to every imported photo, as written in the support article “Are photos resized when imported into Day One?” http://goo.gl/Rzi017 . Yet I beg an option. The reason is that the benefits outlined in the support article are virtually non-existent: -> -> * “More efficient sync and storage”: these days transfer rates are really high with SSDs and gigabit Ethernet, so reducing a few hundred KBs won’t help me the slightest; -> -> * “Dropbox: 2,500+ photos using the free 2GB account”: I have much more than 2GB in my Dropbox; even if I only have 2GB, Day One allows only one photo per entry, and that means 2,500+ entries with photos, which is more than enough for most users, I suppose. By the way, Dropbox storage shouldn’t be your concern; people will buy more when they need more. -> -> And some of the bad things about JPEG compression: -> -> * JPEG compression usually works pretty well with photos, but when I import high precision images, the sharpness is totally ruined; -> -> * People want to keep their photos in highest quality, which is defeated by forced compression. -> -> I know an ugly workaround, which is simply replace the compressed image with the original in the filesystem. But I would love to see an option to import images as originals (in fact, compression should be an opt-in). Really, transfer rates and storage grow so rapidly that they are not people’s primary concerns anymore. (For your information, OneDrive recently rolled out truly unlimited storage to Office 365 subscribers. Online storage is that cheap.) Thanks. diff --git a/source/blog/2014-11-28-given-infinite-time.md b/source/blog/2014-11-28-given-infinite-time.md deleted file mode 100644 index a0d3648f..00000000 --- a/source/blog/2014-11-28-given-infinite-time.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -title: "Given infinite time" -date: 2014-11-28T00:18:19-0800 -date_display: November 28, 2014 ---- - -Given infinite time. There's so much I can do *given infinite time*. I don't think I'll ever be bored. But sadly the time assigned to each human being is finite. Actually it's epsilon, epsilon approaching zero. Sadly. diff --git a/source/blog/2014-11-28-going-diceware.md b/source/blog/2014-11-28-going-diceware.md deleted file mode 100644 index 0e66daac..00000000 --- a/source/blog/2014-11-28-going-diceware.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -title: "Going Diceware" -date: 2014-11-28T19:05:59-0800 -date_display: November 28, 2014 ---- - -Today I'm officially going [Diceware](http://world.std.com/~reinhold/diceware.html). I published my simple C implementation of diceware on [GitHub](https://github.com/zmwangx/diceware). - -I've been using 1Password for a couple years now, and I've always been a bit worried about my master password. It's a ~30 byte monster with uppercase, lowercase letters, numbers, and special symbols. By any measure it is very safe. The problem is there are (extremely) personal things in there. I assembled several unrelated things that I (secretly) hold dearest to my heart, obfuscated them with rules not found in best64, and mixed with semi-gibberish. My daily login password is a combo similar in nature, with less obfuscation to facilitate typing. People who dig really deep into my identity might be able to compromise it (or not); I'm afraid that I'm more predictable than I thought I was. I know, the worry is pretty much unwarranted, as I’m not likely the target of a focused attack — I’m neither rich nor equipped with sensitive information or power, and for wide-range exploits, 99.9% of people are lower-hanging fruits. Even for a targeted attack, [xkcd 538: Security](http://xkcd.com/538/) broke a crypto nerd’s imagination with a $5 wrench. However, a geek is a geek, you can’t block a geek’s imagination. - -Therefore, after worrying for so long, today I’m going Diceware. Eight diceware words give you at least 100 bits of true entropy. Unfortunately I don’t have a die, and don’t bother to get one. (Amazon Prime: get it Monday? No. Target, six miles away? No.) So I read my random bits from `/dev/urandom`. The C implementation is [here](https://github.com/zmwangx/diceware). By publishing this I’m announcing to the world that I’m using diceware. But I’m not afraid, since I’m now protected by true entropy that’s not compromised by publishing the scheme. diff --git a/source/blog/2014-11-30-opera-style-advanced-keyboard-shortcuts-in-safari.md b/source/blog/2014-11-30-opera-style-advanced-keyboard-shortcuts-in-safari.md deleted file mode 100644 index 3e0d005e..00000000 --- a/source/blog/2014-11-30-opera-style-advanced-keyboard-shortcuts-in-safari.md +++ /dev/null @@ -1,44 +0,0 @@ ---- -title: "Opera-style advanced keyboard shortcuts in Safari" -date: 2014-11-30T17:20:20-0800 -date_display: November 30, 2014 ---- - -I've been using the Chromuim Opera for a long time, after Chrome's design went unbearably ugly around v32 (IIRC Opera stable channel was on v19 when I switched, which was released on January 28, 2014). From then on, Opera's [advanced keyboard shortcuts](http://help.opera.com/opera/Mac/1583/en/fasterBrowsing.html#advanced) has become an integral part of my browsing habit. In particular, the following are especially handy for me: - -* `1`: Cycle left through tabs; -* `2`: Cycle right through tabs; -* `/`: Find on page; -* `Z`: Go back one page; -* `X`: Go forward one page; -* `0`: Zoom in; -* `9`: Zoom out; -* `6`: Reset zoom to 100%. - -Lately, with the Yosemite release, Safari has become a much more competitive browser. I won't say why, and I admit that it has major missing features that still prevents it from becoming my default — but I have to say I’m gradually moving more of more of my browsing, especially reading, to Safari. It would be nice if I could carry my power user shortcuts with me. Fortunately, this is possible. Just modify the plist in the following way: - -```bash -#!/usr/bin/env bash -defaults write com.apple.Safari NSUserKeyEquivalents '{ -"Actual Size"="6"; -"Back"="z"; -"Find..."="/"; -"Forward"="x"; -"Show Previous Tab"="1"; -"Show Next Tab"="2"; -"Zoom In"="0"; -"Zoom Out"="9"; -}' -``` - -Relaunch Safari. You are all set! Enjoy the ultrafast single key navigating experience. To reset, - -```bash -defaults delete com.apple.Safari NSUserKeyEquivalents -``` - ---- - -**_2014/12/22 Update:_** - -There's one caveat to this approach — unlike in Opera, where the default layman shortcuts (e.g., ⌘F) are still available when advanced keyboard shorts are enabled, in Safari they are simply overwritten. This is annoying when the web page or web app binds certain keys, especially `/` to its own search bar (a notable example being google.com). In that case I have to admit defeat and click on the menu bar item, which takes a hundred times as long as a single `/` keystroke. diff --git a/source/blog/2014-12-05-distraction-free-writing.md b/source/blog/2014-12-05-distraction-free-writing.md deleted file mode 100644 index a65ab166..00000000 --- a/source/blog/2014-12-05-distraction-free-writing.md +++ /dev/null @@ -1,33 +0,0 @@ ---- -title: "Distraction free writing" -date: 2014-12-05T21:09:10-0800 -date_display: December 5, 2014 ---- - -This is not the first time that a distraction free writing app is featured on the Mac App Store. This time the candidate is [Desk](https://itunes.apple.com/us/app/desk/id915839505?mt=12). The official website is [here](http://desk.pm), but licensing is MAS-exclusive. The icon looks like this: - -![The icon of Desk](https://i.imgur.com/OprXSEU.png) - -Skeuomorphism, oh man. And this is the only screenshot I can find on the official website: - -![Screenshot of editing in Desk](https://i.imgur.com/WBaYzho.png) - -I can find a few other screenshots on MAS, but you know how shitty MAS screenshots are, plus the screenshots of this app only focus on specific UI elements. The official website also features an intro video (which provides no information at all) and a brief feature list with no further details, all on one page. The MAS description is somewhat more comprehensive, but again, "WordPress integration" and the like are not so informative. So, after a certain amount of research, I have to say I know little about this app. To do the app justice, there's an [accompanying blog](http://blog.desk.pm), with all kinds of noise though — like what a good blog should be, no complaint about that. So I guess anyone who wants to know more about this app should go digging there. Not me, so I didn't read. - -Strangely enough, reception is great, although the price tag is currently set at $30 — definitely a premium price. John Gruber [has a piece](http://daringfireball.net/linked/2014/11/22/desk), but I think "My thanks to Johb Saddington for sponsoring this weeks' DF RSS feed to promote Desk, his blogging app for the Mac" kind of defeats credability. MAS featuring is also a good sign (although not always). Out of the 55 MAS ratings at the time of writing (9:42 PM, Friday, December 5, 2014), 45 are five stars. - -That brings home my curiosity about "distraction free writing apps" in general. _Why would anyone pay $30 for a "distraction free writing app" (which basically justifies any lack of feature — "we deliberately give you no choice for anything so you can focus on writing!"), **without even a trial**?_ MAS is such a bad model for utility and productivity software since you can't just look at five screenshots (seriously?) and decide "this is for me!" Yet I have the impression that more developers prefer this model nowadays, especially in this focused-writing business, another example being IA Writer. Sure it makes licensing and combating piracy simple, but again, I need to feel it to decide if it's the right tool for me, especially for a feature-deprived focused-writing app. (This is a general thought — in this case I don't need to feel it to tell that it's not for me.) - -More specifically, let's think about distraction free writing. What does IA Writer, or Desk, or other apps offer that's not already available to you with your OS? They support Markdown syntax highlighting, or even WYSYWYG (but only the very simple kind of WYSYWYG limited by the Markdown feature set), sure. They support some select-and-click type of formatting (by the way, Desk's formatting tools look a lot like those found on medium.com), which is good for some who are not competent enough to type simple markups, I guess. Desk supports drag-and-drop of media (although I'm sure it's limited to certain platforms and not portable at all — I always upload images to Imgur and embed the Imgur links, which is super simple for me since I have several homemade scripts to take care of that). So are these features essential? Not at all. For the general public, plain Markdown without rendering should be more than enough, since Markdown was designed to be human-readable as plain text in the first place. Markdown only gets ugly when you have a lot of inline hyperlinks, or worse still, plain HTML tags, but that's not what I would expect from the general public. The technical population who do probably need the rendering, on the other hand, aren't the target audience of these apps; certain needs of the technical folks are hardly ever addressed by these feature-deprived focused-writing apps — e.g., where are my keybindings (full-featured, not just C-k, C-y, C-p, C-n, C-b, C-f, M-del, etc.; in particular, what about M-d, M-b, etc.)? What about custom Markdown engine? What about Jekyll integration (no need for that, actually — I'm happy with tty)? So, to sum up, for the target audience, realtime rendering isn't necessary, although I guess people with technophobia hate to see markups like `**` so no rendering will kill them. Second point, select-and-click type of formatting, is already dismissed. Third point, drag-and-drop of media might be useful for some people, but not all. After all, Desk uses a typewriter as its icon, and there's no way you could throw photos into your typewriter. It's about writing, and most of the time writing is enough. - -I have dismissed the "additional features" of focused-writing apps as non-essential. And I can argue that they are actually sources of distraction — as soon as you have WYSYWYG and formatting and mouse, you could, in principle, begin to fiddle. But when I say "additional features", you might ask, "additional" compared to what? Okay here's the magic. The magic is designed by Apple in California®, and it's present on every single Mac running OS X. It's called TextEdit.app. Distraction free? How can you be more distraction free than this: - -![TextEdit: The most distraction free writing experience on the Mac. Designed by Apple in California.](https://i.imgur.com/z3LEu0U.png) - -It's either text or blank. Nothing else. It's more than capable of handling plain text, our best friend (and computer's best friend — the universal interface). You can customize the font once and for all, or you can even live with the factory setting. That's better than having a font you don't like forced upon you, as many of those focused-writing apps do. You can even auto save to iCloud if you'd like to. Of course there's no one click publishing or timeline management or whatever, but you could leave that to a publishing app (like Desk, when used as a publishing app). Better yet, you can use Jekyll or Octopress or whatever command line solution, where everything is at your fingertip, a few keystrokes away. No limitation whatsoever. But that's out of question for most people. (The easy-to-use command line interface, and not needing to worry about hosting myself, are two of the primary reasons that brought me to Octopress on GitHub Pages, rather than wordpress.com or self-hosted wordpress.org). - -Of course I'm not saying TextEdit is good enough as a text editor (it is good enough for most people, though), or it is my text editor of choice. My text editor has always been Emacs, which can be distraction free when I need it to be (I've hidden everything I feel like to hide), and which can be an almost feature-complete operating system when I need it to be. Apart from a slightly frustrating loading time, there's no such bullshit as "we deliberately left no feature and no choice to you so you won't fiddle." Mostly importantly, it is extensible — I can start writing Elisp right away, and every single line of code I write can potentially save me thousands of keystrokes in the future; I don't need to submit a feature request to the developer and wait forever (usually power users' feature requests are ignored, unless the software was built for power users to begin with or mainly popular within power users). Plus Emacs is free (both as in beer and in speech), rather than being proprietary and costing $30. At any rate, when I'm writing in Emacs, most of the time I'm just furiously typing away — no distraction whatsoever. That's the ideal state of writing, and I feel really good at those moments. That's the main charm of writing, at least to me. - -![Editing in iTerm2 + Emacs + Solarized Dark. Paradise.](https://i.imgur.com/2Jx9Mpv.png) - -The whole command line experience is awesome (most of what I do with the computer are either done in the browser or in iTerm2 — well, plus some time spent with PDF in Preview.app and some with emails in Mail.app). And most of my tools either ship with the operating system (OS X is a great operating system), or are FOSS. Things that hardly ever die. Of course the command line experience is infeasible for laymen, but my argument is, **most of the time the things you need are already there, e.g., TextEdit.** I feel bad about those folks who are constantly on the lookout for distraction-free writing apps, and pay a ridiculous amount for them — only to distract themselves. Just open TextEdit and type away (or if you're capable of it, Emacs or Vim or SublimeText or TextMate or BBEdit or whatever). That's the most productive thing to do. **Publishing is not the top priority; writing is, and it's really simple.** diff --git a/source/blog/2014-12-10-omnifocus-change-sync-behavior-mac-and-ios.md b/source/blog/2014-12-10-omnifocus-change-sync-behavior-mac-and-ios.md deleted file mode 100644 index 3f68969b..00000000 --- a/source/blog/2014-12-10-omnifocus-change-sync-behavior-mac-and-ios.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -title: "OmniFocus: change sync behavior, Mac and iOS" -date: 2014-12-10T22:45:34-0800 -date_display: December 10, 2014 ---- - -On OS X, the following URIs are relevant: - -* <a href="omnifocus:///change-preference?MaximumTimeBetweenSync=30">omnifocus:///change-preference?MaximumTimeBetweenSync=30</a> -* <a href="omnifocus:///change-preference?TimeFromFirstEditToSync=2">omnifocus:///change-preference?TimeFromFirstEditToSync=2</a> - -What they do are self-evident. - -On iOS, use the following URIs instead: - -* <a href="x-omnifocus-debug:set-default:MaximumTimeBetweenSync:60">x-omnifocus-debug:set-default:MaximumTimeBetweenSync:60</a> -* <a href="x-omnifocus-debug:set-default:TimeFromFirstEditToSync:2">x-omnifocus-debug:set-default:TimeFromFirstEditToSync:2</a> - -Source: [Change Default Sync Times of OmniFocus For Mac and iOS](http://www.macstories.net/links/change-default-sync-times-of-omnifocus-for-mac-and-ios/). diff --git a/source/blog/2014-12-13-the-mac-like-evernote.md b/source/blog/2014-12-13-the-mac-like-evernote.md deleted file mode 100644 index 8f8d5f6b..00000000 --- a/source/blog/2014-12-13-the-mac-like-evernote.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -title: "The Mac-like Evernote" -date: 2014-12-13T21:47:31-0800 -date_display: December 13, 2014 ---- - -Once in a while (maybe a year, maybe several months — not set in stone), I give big name free services not in use a chance to convince me. Evernote is one such service. The interface used to look very cheap and cluttered. I hated it. However, this time I'm sold. Now everything Evernote, from its Mac app to its iOS app to its web design to its physical products, looks distinctively Mac-like. (I use Mac-like to refer to Apple's design philosophy, including iOS. Well, I guess the Android and Windows apps aren't Mac-like.) I mean, just look at the screenshots: - -![Web UI, beta](https://i.imgur.com/AZelofm.png) -![Evernote Market, Pfeiffer Collection](https://i.imgur.com/tZuWBlY.png) -![Mac app](https://i.imgur.com/R4QF8OM.png) - -Bright, simplistic, elegant, clutter-free. Mac-like. The Mac app takes advantage of the translucent material of Yosemite, and it looks gorgeous. The iOS app also feels great on a full HD Retina screen; I didn't bother to take a screenshot. Now it's much likely that I'll put it into good use — cluttered and cheap-looking interfaces give me nightmares and actually hinders my productivity, and now they are gone. - -No one can argue that Apple products make great screenshots. They are also much more intuitive, functional, and productive than most Windows folks are willing to believe. I hope our world is more Mac-like. diff --git a/source/blog/2014-12-14-speeding-up-emacs-with-emacsclient.md b/source/blog/2014-12-14-speeding-up-emacs-with-emacsclient.md deleted file mode 100644 index 54cded76..00000000 --- a/source/blog/2014-12-14-speeding-up-emacs-with-emacsclient.md +++ /dev/null @@ -1,35 +0,0 @@ ---- -title: "Speeding up Emacs with emacsclient" -date: 2014-12-14T10:06:02-0800 -date_display: December 14, 2014 ---- - -Emacs is notorious for its loading time. For me, this is especially annoying when I'm editing LaTeX files — AUCTeX takes about five seconds to load, and once I exit Emacs (especially after a quick edit), all that work is wasted, and next time I want to do some quick editing with that same LaTeX file — sorry, another five seconds. - -This problem can be solved by "using that same Emacs", i.e., running Emacs in server mode, then connecting to the server via `emacsclient`. Below is my script, which I call `emc`, to make `emacsclient` more user-friendly. `emc` opens a file (given as `$1`) on the server, launching one on its way if none is detected. Note that I used `-cqta=` for `emacsclient`. The `-c` option is `--create-frame`, i.e., create a new frame (in the current tty, for instance) instead of using the existing frame (in another tty, for instance); this allows for multiple frames accross different ttys. The `-q` option is for `--quiet`, suppressing messages like "Waiting for Emacs..." The `-t` option is for `--tty`, or equivalently, the familiar `-nw` option of `emacs`. The `-a=` options is `--alternate-editor=`; according to the manpage, `-a, --alternate-editor=EDITOR` has the following effect: - -> if the Emacs server is not running, run the specified editor instead. This can also be specified via the \`ALTERNATE_EDITOR' environment variable. If the value of EDITOR is the empty string, run \`emacs --daemon' to start Emacs in daemon mode, and try to connect to it. - -Note that `emacsclient` requires a filename, so my script prompts for one if `$1` is empty. - -``` bash -#!/usr/bin/env bash -if [[ -n $1 ]]; then - file=$1 -else - while [[ -z ${file} ]]; do - read -p 'filename: ' file - done -fi -emacsclient -cqta= "${file}" -``` - -Note that using `emacsclient` has the additional benefit that the same buffer is simultaneously updated accross different ttys (See screenshot, where I opened the current post in two different ttys). This way, you won't face the nasty "file changed on disk" problem when you accidentally edited the same file in another tty session. - -![screen shot of multiple copies of the same buffer](https://i.imgur.com/9KxEWKq.png) - -By the way, remember to re-configure your other programs that uses an external editor. For instance, change `$EDITOR` to `emacsclient -cqta=` in your `env`, and `core.editor` to `emacsclient -cqta=` in your `~/.gitconfig`. - -*Note*: if you use `emacsclient` to edit git commit messages in Git Commit Mode, remember to use `C-c C-c` (`git-commit-commit`) to save the commit message rather than using `server-edit` or `C-x C-c` to exit Emacs. Otherwise, the `COMMIT_EDITMSG` buffer will persist in the Emacs server, and you'll be prompted to revert buffer the next time you edit another commit message, which is pretty annoying. - -I just started using `emacsclient`, so the above script might be buggy in certain edge cases. I'll report when I run into issues. diff --git a/source/blog/2014-12-14-the-google-chrome-comic-a-classic.md b/source/blog/2014-12-14-the-google-chrome-comic-a-classic.md deleted file mode 100644 index f3d7f791..00000000 --- a/source/blog/2014-12-14-the-google-chrome-comic-a-classic.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -title: "The Google Chrome Comic — A classic" -date: 2014-12-14T17:42:55-0800 -date_display: December 14, 2014 ---- - -I was cleaning up my Opera bookmarks just now — I'm semi-officially leaving Opera for Safari. Of course, Safari still can't handle everything (e.g., Adblock Plus is still not so good on Safari, YouTubeCenter lags behind and I don't bother to compile myself — yes, I have a certificate, and some power user features simply don't exist), so I'm still going to Opera/Opera beta/Chrome/Firefox for certain tasks. But Safari is very nice. For the first time. - -I started out as a Chrome user (well, don't want to recall the IE days), branched out to the Chromium Opera, and now ended up in Safari. Not sure about the future. When I look back, something nostalgic pops up in mind — [the Google Chrome Comic](http://www.google.com/googlebooks/chrome/). I enjoyed it more than once, but I never seemed to have archived it. So here it is, combined into [one PDF](https://dl.bintray.com/zmwangx/generic/2008-chrome-comic.pdf). In fact, you can create the PDF yourself: - -``` -seq 0 39 | parallel wget -q http://www.google.com/googlebooks/chrome/images/big/{}.jpg -convert $(ls -v *.jpg) 2008-chrome-comic.pdf -``` - -Here I was a bit lazy and used a GNU `ls` feature: `-v` for natural sorting of numbers (doesn't work for BSD `ls`). - -And here's page 1 of the comic as a teaser: - -![Google Chrome — Behind the Open Source Browser Project](https://i.imgur.com/W5pJTjl.jpg) diff --git a/source/blog/2014-12-19-app-suggestion-dropzone-3.md b/source/blog/2014-12-19-app-suggestion-dropzone-3.md deleted file mode 100644 index d2695d9a..00000000 --- a/source/blog/2014-12-19-app-suggestion-dropzone-3.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -title: "App suggestion: Dropzone 3" -date: 2014-12-19T14:08:57-0800 -date_display: December 19, 2014 ---- - -I recently tried and purchased [Dropzone 3](https://aptonic.com/dropzone3/). See a list of features on the linked official website. In short, Dropzone 3 provides an intermediate zone for drag-n-drop. You can use it as a stash (called "Drop Bar" — stacking is available), use it as a shortcut by putting frequently used folders and applications there, or trigger actions by dropping. There are a dozen builtin actions and [an additional list of readily available actions](https://aptonic.com/dropzone3/actions/), covering common web drives, SNS and file sharing sites. **Better yet, you can develop your custom actions with the easy-to-use [Ruby API](https://github.com/aptonic/dropzone3-actions/blob/master/README.md#dzalerttitle-message).** For instance, I wrote a simple Google Translate action, `Google Translate.dzbundle` ([link](https://gist.github.com/zmwangx/b27f106a8ba47468a43d)), based on [translate-shell](https://github.com/soimort/translate-shell). (You know, it's Ruby, so calling external commands and concatenating strings feel at home, as if you are coding in Perl or directly in shell; unlike Python, where you at least need to `import subprocess` then `subprocess.check_output` to get the output of an external command, and have to use a bunch of stupid `+`'s to get your goddamn message to print.) - -Although I use the terminal for most tasks, drag-n-drop is still useful and convenient at times, not to mention the custom actions. (And the stock drag-n-drop is kinda hit-and-miss, especially for people like me who are mostly working with windows maximized — except terminal windows.) After using Dropzone 3 for a while, I found it well worth $4.99. - -Wait, I didn't mention the pricing? Dropzone 3 is only [$4.99 on MAS](https://itunes.apple.com/us/app/dropzone-3/id695406827?ls=1&mt=12), so get it while supplies last. (Somehow the license is $10 on the developer's online store, so definitely buy from MAS and change to the [unsandboxed version](https://aptonic.com/dropzone3/sandboxing.php) later — de-sandboxing is free.) There's also a 15-day free trial. diff --git a/source/blog/2014-12-22-10k-images-on-imgur.md b/source/blog/2014-12-22-10k-images-on-imgur.md deleted file mode 100644 index 19760764..00000000 --- a/source/blog/2014-12-22-10k-images-on-imgur.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -title: "10k images on imgur" -date: 2014-12-22T12:42:16-0800 -date_display: December 22, 2014 ---- - -I happened to check my imgur account just now (haven't been to the web interface for ages), and you know what, I have uploaded 10,744 images since I created the account in February this year! (I've been using imgur for longer than that; previously I uploaded images anonymously.) Most of the 10k images were uploaded via scripts using the API. This again demonstrates the importance of a good API — without the imgur API I wouldn't have been able to upload hundreds of images with a few keystrokes all in a snap, and getting links would be a huge pain in the ass. There are myriad image hosting services out there, but imgur rules 'em all, thanks to its decent API (and also its good CDN and direct image links, of course). diff --git a/source/blog/2014-12-23-mpv-launcher.md b/source/blog/2014-12-23-mpv-launcher.md deleted file mode 100644 index 24741a5a..00000000 --- a/source/blog/2014-12-23-mpv-launcher.md +++ /dev/null @@ -1,29 +0,0 @@ ---- -title: "mpv launcher" -date: 2014-12-23T00:51:05-0800 -date_display: December 23, 2014 ---- - -**_04/06/2015 update:_** - -I just noticed that `daemonize` doesn't play too well with the OS; in particular, when you use dark menu bar on OS X Yosemite, apps launched with `daemonize` won't conform to that. So a native shell solution would be using `/bin/zsh` and run - -```zsh -mpv $@ &>/dev/null </dev/null &! -``` - -instead. - ---- - -[`mpv`](http://mpv.io) is a nice simplistic video player (fork of MPlayer and mplayer2). The CLI is flawless (and you can run as many instances as you want), but when it comes to the OS X application bundle, there's one major annoyance. Each app bundle could only have one running instance (unless `open -n`’ed, which is not how sane people use app bundles), and one instance of `mpv` only supports one video. So, say I'm playing one video with the app bundle, and unsuspectingly opens another in Finder (which is associated to `mpv.app` by default), then the latter video immediately takes over, and the position in the first video is lost. That happens *a lot*. - -Today I finally gave this issue some serious thought (I've been on a bug report/enhancement request spree these days so it's natural for me to start thinking about enhancements). Turns out that there's a pretty simple workaround. I created an automator app `mpv-launcher.app` that does one thing: "Run Shell Script" (pass input as arguments) - -```bash -daemonize /usr/local/bin/mpv "$@" -``` - -in the shell of your choice (for me the shell of choice is `zsh` since the env would be readily available from my `zshenv`). `daemonize`, as the name suggests, daemonizes the process so that the process doesn't block; this way, `mpv-launcher.app` immediately quits after launching, making multiple "instances" possible. (`daemonize` can be installed via `brew install daemonize`; note that you need to specify the full path of the command to daemonize, which in my case is `/usr/local/bin/mpv`). And there you go. Associate your video files to `mpv-launcher.app`. Launch as many instances as you want. Enjoy. - -By the way, I also filed an [enhancement request](https://github.com/mpv-player/mpv/issues/1377) with `mpv-player/mpv`. We'll see what the developers can do. Hopefully the app bundle will support multiple videos out of box in the future. diff --git a/source/blog/2015-01-01-os-x-system-ruby-encoding-annoyance.md b/source/blog/2015-01-01-os-x-system-ruby-encoding-annoyance.md deleted file mode 100644 index f0c6b70b..00000000 --- a/source/blog/2015-01-01-os-x-system-ruby-encoding-annoyance.md +++ /dev/null @@ -1,42 +0,0 @@ ---- -title: "OS X system ruby encoding annoyance" -date: 2015-01-01T22:49:39-0800 -date_display: January 1, 2015 ---- - -I've been using RVM (with fairly up-to-date Rubies) and pry since my day one with Ruby (well, almost), so it actually surprises me today when I found out by chance how poorly the system Ruby behaves when it comes to encoding. - -The major annoyance with the current system Ruby (2.0.0p481) is that it can't convert `UTF8-MAC` to `UTF-8` (namely, NFD to NFC, as far as I can tell), at least not with Korean characters. Consider the following script: - -```ruby -# coding: utf-8 -require 'hex_string' -str = "에이핑크" -puts str.to_hex_string -puts str.encode("UTF-8", "UTF8-MAC").to_hex_string -``` - -Here are what I get with the system Ruby and the latested brewed Ruby: - -```bash -> /usr/bin/ruby --version -ruby 2.0.0p481 (2014-05-08 revision 45883) [universal.x86_64-darwin14] -> /usr/local/bin/ruby --version -ruby 2.2.0p0 (2014-12-25 revision 49005) [x86_64-darwin14] -> /usr/bin/ruby utf8-mac.rb -e1 84 8b e1 85 a6 e1 84 8b e1 85 b5 e1 84 91 e1 85 b5 e1 86 bc e1 84 8f e1 85 b3 -e1 84 8b e1 85 a6 e1 84 8b e1 85 b5 e1 84 91 e1 85 b5 e1 86 bc e1 84 8f e1 85 b3 -> /usr/local/bin/ruby utf8-mac.rb -e1 84 8b e1 85 a6 e1 84 8b e1 85 b5 e1 84 91 e1 85 b5 e1 86 bc e1 84 8f e1 85 b3 -ec 97 90 ec 9d b4 ed 95 91 ed 81 ac -``` - -As you can see, in the case of the system Ruby, NFD is left untouched. This leads to problems with, for instance, Google Translate. One obvious solution is to outsource the task to `iconv`, but I have the impression that outsourcing language features to shell commands is a generally despised practice. - -There's one more surprise. While `pry` with latest Rubies tend to handle Unicode very well (unlike `irb`), I tried `pry` with the current system Ruby, and it doesn't work; due to this annoying limitation, I couldn't even test the above problem interactively, and had to resort to a script. Maybe the problem can be resolved by compiling Ruby with `readline` or whatever; I didn't bother. The bottom line is, the system Ruby is not very pleasant for men in the 21st century — good Unicode support ought to be a must. (By the way, NFD in HFS+ is maddening. It breaks Terminal, iTerm, Google Translate, scp with Linux hosts, and the list goes on.) - -P.S. In Dropzone 3 custom actions you can select a custom Ruby with the `RubyPath` meta field, e.g., - -```ruby -# RubyPath: /usr/local/bin/ruby -``` 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 deleted file mode 100644 index 41d84c57..00000000 --- a/source/blog/2015-01-10-fonts-why-chinese-web-design-is-hard.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -title: "Fonts: why Chinese web design is hard" -date: 2015-01-10T09:30:02-0800 -date_display: January 10, 2015 ---- - -For years I've been complaining about Chinese websites' horrendous designs. Yesterday I tried to translate one of my simple project websites to Chinese, and finally realized that web design for the Chinese language is no simple task — much harder than for English. The problem is fonts. This might not be the only problem (and cannot take blame for all the horrendous designs), but it certainly seems to be a roadblock. - -The problem with fonts boils down to the fact that the Chinese writing system has too many glyphs. I still remember learning things about the GB 2312 charset when I was twelve — there are 3755 Level 1 characters (more commonly seen), 3008 Level 2 characters, and other symbols and foreign glyphs. Designing more than six thousand Chinese characters is so much harder than designing 26 letters. I'm not sure if many glyphs are auto-generated from parts, but that would certainly degrade the quality. The result? Availability of digital fonts suffers. There are simply not so many choices of Chinese fonts. Chinese writing is beautiful, but I've yet to see a font for screens (let alone the web) that conveys that beauty. This might be subjective, but I have the impression that fonts generally look worse on screen than in print, and more so for Chinese fonts (Retina doesn't help much). For the record, I checked Apple's font usage at the moment, and they are using a tailored font named "PingHei" ("平黑", I guess; see screenshot at the end); I'm not at all impressed. Compare that to the English counterpart (also at the end) — not on the same level. (I won't talk about Microsoft since it doesn't feature a design department, or that department is brain dead. Well, I'm a little opinionated.) - -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. - -![A section of [apple.com/cn/iphone-6](https://www.apple.com/cn/iphone-6/).](https://i.imgur.com/MPmtSJI.png) - -![The English equivalent.](https://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 deleted file mode 100644 index de0ada46..00000000 --- a/source/blog/2015-01-21-web-design-microsoft-vs-apple.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -title: "Web design: Microsoft vs Apple" -date: 2015-01-21T16:30:51-0800 -date_display: January 21, 2015 ---- - -I just had a look at Ars's live blog on today's Windows 10 Event to acquire a sense of where Windows is heading. There's not much to report. Safari rip-off (Microsoft's new Spartan — wait, is this name also inspired by Safari? — features reading mode and offline reading list, Safari's killer features) aside, the focus seems to be virtual assistant, PC-tablet-phone integration, and gaming, none of which I'm interested in. The hologram thing does look cool, but putting the hype aside, I doubt if it will be really useful for the masses (except probably in gaming, one of my most despised applications of computing). I'm not a visionary so maybe I'm underestimating this. - -(Another interesting development is "Windows as a Service" — WaaS? Microsoft isn't communiating it effectively. If it means paid subscription, am I ever going to subscribe to an OS? No. If it instead means free system updates for the lifetime of a device, then this WaaS thing is just a vacuous buzz phrase — Apple has already been doing it for two years. Longer if you count the cheap upgrades. However, if free system updates is indeed the case, then what about VMs? Not sure.) - -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 [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. - -![Full height screenshot of [windows.microsoft.com/en-us/windows-10/about](http://windows.microsoft.com/en-us/windows-10/about).](https://i.imgur.com/0eIt4SR.png) - -![Full height screenshot of [www.apple.com/osx/](http://www.apple.com/osx/).](https://i.imgur.com/piUO0xY.png) diff --git a/source/blog/2015-02-10-monitor-progress-of-your-unix-pipes-with-pv.md b/source/blog/2015-02-10-monitor-progress-of-your-unix-pipes-with-pv.md deleted file mode 100644 index 59c77a25..00000000 --- a/source/blog/2015-02-10-monitor-progress-of-your-unix-pipes-with-pv.md +++ /dev/null @@ -1,59 +0,0 @@ ---- -title: "Monitor progress of your Unix pipes with pv" -date: 2015-02-10T02:18:30-0800 -date_display: February 10, 2015 ---- - -Recently I found a very useful utility called `pv` (for "pipe viewer"). [Here](http://www.ivarch.com/programs/pv.shtml) is its home page, and it can be easily installed with `brew`. According to its man page, - -> `pv` shows the progress of data through a pipeline by giving information such as time elapsed, percentage completed (with progress bar), current throughput rate, total data transferred, and ETA. - -For more info, see its home page (linked above) and [man page](http://linux.die.net/man/1/pv). - -Why is it useful? Well, pretty obvious if you are in the right audience. For me, one particularly important use case is with `openssl sha1`. I deal with videos on a daily basis, and back up all of them to OneDrive (ever since OneDrive went unlimited). To ensure integrity of transfer (in future downloads), I append the first seven digits of each video to its filename. This should be more than enough to reveal any error in transfer except for active attacks. One additional advantage is that I can now have multiple versions of a same show, event, or whatever and don't have to worry about naming conflicts (and don't have to artificially say `-ver1`, `-ver2`, etc.). This little merit turns out to be huge and saves me a lot of trouble, since naming things is intrinsically hard: - -> There are only three hard things concurrency, in computer science: cache invalidation, naming things, and off-by-one errors. - -(I learned this beefed up version of two hard things only recently.) Well, too much digression. So SHA-1 sum is useful. (By the way, I learned in my crypto class that SHA-1 is broken as a collision-resistant hash function — not HMAC, which doesn't assume collision-resistance — and SHA-256 should be used instead. However, I'm not protecting against active attacks — I won't be able to without a shared secret key anyway — so the faster SHA-1 is good for my purpose.) But at the same time, SHA-1 is slow. Maybe what's actually slow is my HDD. Whatever the bottleneck, generating a SHA-1 digest for a 10 GB video file isn't fun at all; it's even more of a torture when there's no progress bar and ETA. But hopelessly waiting has become a thing of the past with the advent (well, discovery in my case) of `pv`. Now I have nice and informative progress bars, which reduces the anxiety of waiting by an order of magnitude. - -For the record, here's the current version of my ruby script that attaches the first seven digits of the SHA-1 digests of the given files to their filenames: - -```ruby -#!/usr/bin/env ruby - -require 'fileutils' - -def rename(items) - num_items = items.length - num_done = 0 - items.each {|path| - printf($stderr, "%d/%d: %s\n", num_done + 1, num_items, File.basename(path)) - - if ! File.directory?(path) - extname = File.extname(path) - basename = File.basename(path, extname) - dirname = File.dirname(path) - sha1sum = `pv '#{path}' | openssl sha1` - new_basename = basename + "__" + sha1sum[0,7] - new_path = File.join(dirname, new_basename + extname) - FileUtils.mv(path, new_path) - else - STDERR.puts("#{path}: directory ignored") - end - - num_done += 1 - } -end - -rename(ARGV) -``` - -You might ask why I used ruby (littered with bash) when it's obviously a job for bash or perl. Well, the reason is that I first wrote this thing in ruby as a [Dropzone 3 action](https://gist.github.com/zmwangx/d6406fb8bf51ac768770). I'm lazy, so I just borrowed that script and modified its printout for shell use. - ---- - -By the way, I also found a project called `cv` (Coreutils Viewer), which is [officially described as](https://github.com/Xfennec/cv) - -> ... a Tiny, Dirty, Linux-Only C command that looks for coreutils basic commands (cp, mv, dd, tar, gzip/gunzip, cat, etc.) currently running on your system and displays the percentage of copied data. - -I'll look into it when I have time, but it from its description, it seems to be limited to coreutils, and OS X support might not be too awesome (at this point). 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 deleted file mode 100644 index 3928e2df..00000000 --- a/source/blog/2015-02-17-microsoft-is-getting-cool-but-not-its-website.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -title: "Microsoft is getting cool (but not its website)" -date: 2015-02-17T18:57:19-0800 -date_display: February 17, 2015 ---- - -Microsoft is getting kind of cool. For instance, open sourcing .NET last year caused quite a buzz. Ars has a good piece about this: [Microsoft’s continuing efforts to be cool](http://arstechnica.com/information-technology/2015/02/microsofts-continuing-efforts-to-be-cool/). - -Three weeks ago Microsoft made another minor but totally unexpected move: they integrated AgileBits' `onepassword-app-extension` ([GitHub](https://github.com/AgileBits/onepassword-app-extension)) into the 5.0 release of the OneDrive iOS app. I didn't realize this until I read [yesterday's blog post on the OneDrive Blog](https://blog.onedrive.com/onedrive_secure_password/). This is really amazing when you put it in context: I mean, take a look at [Apps that love 1Password](https://blog.agilebits.com/1password-apps/), i.e., apps that have integrated that extension. Out of the ninety apps listed to date, there are only a dozen apps that I've heard of, and the only brands bigger than 1Password are Microsoft, Tumblr, Uber (infamous), and Walmart (what?). Microsoft embracing third party is surely an interesting phenomenon. - -Meanwhile, - -* Microsoft still won't let us use our password managers to its fullest (of course we can't blame it on the OneDrive folks): 16 characters max in this day and age (screenshot taken today)? Hmm. And I remember Microsoft recently said password length isn't the main source of vulnerability of its customers. WTF. Who cares about *your* stupid customers. I just want to protect *my own* data, and make sure that in case of a breach on *your* side, I won't face the same loss as your technologically illiterate customers. But that's not currently possible with Microsoft. - -![It's 2015, yet "your password can't be longer than 16 characters".](https://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.html); I mean, seriously: - -![What the heck are those blue blocks?](https://i.imgur.com/wu66zZc.png) diff --git a/source/blog/2015-02-20-my-dock-and-updated-omnifocus.md b/source/blog/2015-02-20-my-dock-and-updated-omnifocus.md deleted file mode 100644 index ce022ab3..00000000 --- a/source/blog/2015-02-20-my-dock-and-updated-omnifocus.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -title: "My dock and updated OmniFocus" -date: 2015-02-20T16:16:10-0800 -date_display: February 20, 2015 ---- - - -> Simplicity is the ultimate sophistication. - -Here's a screenshot of my dock at the moment. - -![My dock](https://i.imgur.com/EhaJw57.png "My current dock. Left to right: Finder (TotalFinder), Mail, Safari, Chrome, iTunes, OmniFocus, iTerm2, Activity Monitor, and mpv. Everything except mpv is persistent.") - -Left to right: Finder (TotalFinder), Mail, Safari, Chrome, iTunes, OmniFocus, iTerm2, Activity Monitor, and mpv. Everything except mpv is persistent; mpv is there because I happen to be looping a piece of music with mpv that I don't plan to add to the iTunes library. The point is that it never looked this good, mainly due to the updated OmniFocus icon. Finally they put some serious thought into graphics design! Just compare [the v2.1 icon](https://dl.bintray.com/zmwangx/generic/omnifocus-v2.1.icns) to [the v2.0 version](https://dl.bintray.com/zmwangx/generic/omnifocus-v2.0.icns). - -![OmniFocus Mac app icon, v2.0 vs v2.1](https://i.imgur.com/KeTz5wK.png) - -Obviously the overpolished (and honestly, badly polished) 2.0 one belongs to the past. It "stood out" even among Mavericks dock icons (in terms of color), not to mention among the flattened-down Yosemite ones. Today, it finally becomes a native member of the dock. (Well, actually not today — I've been using the beta for a while, so the new icon didn't come as a surprise.) In fact, this time the Omni Group seems to be on a graphics design streak these days, and today they have a really impressive App Store feature banner: - -![OmniFocus's MAS feature banner](https://i.imgur.com/tILmveQ.png) diff --git a/source/blog/2015-02-21-all-is-not-lost.md b/source/blog/2015-02-21-all-is-not-lost.md deleted file mode 100644 index 942965bc..00000000 --- a/source/blog/2015-02-21-all-is-not-lost.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -title: "All is not lost" -date: 2015-02-21T17:12:32-0800 -date_display: February 21, 2015 ---- - -Lubos Motl always attacks the Many-Worlds Interpretation as if it is on the same level as anti-scientific claims. He even went on to attack Hugh Everett (the guy who first formulated this interpretation) personally; *ad hominem* is of course typical Motl shit, and I don't bother to find those posts. Anyway, here's yet another one: [Many worlds: a Rozali-Carroll exchange](http://motls.blogspot.com/2015/02/many-worlds-rozali-carroll-exchange.html). - -Disclaimer: I'm not really a proponent of Many-Worlds, at least not of the part of it that says history really *branches* into *many* worlds. Well, Lubos is at least right about one thing: "many worlds", taken literally, can't even be well-defined. However, I do believe that the world is can be described by a "universal wavefunction" (I prefer to call it the "universal state vector") in some gargantuan Hilbert space. And the universal state vector has to evolve deterministically. The reason is simple: **_all information is not lost_**. This principle is fundamental to physics and it's simply not on the same level as falsifiability, which is little more than a philosopher's toy and a nice thing to have. In quantum mechanics' terms, *unitarity must be respected*; this is why the Copenhagen Interpretation, or at least the wavefunction-collapsing part of it, cannot hold up to serious scrutiny — no operator can ever collapse the wavefunction and break unitarity. Those who hold the Copenhagen Interpretation are confusing *their* lack of knowledge (albeit a fundamental one, as they were entangled into the system when they make an observation) with the fundamental loss of information (which is not possible). - -One may question that if the universal state vector is *real*, then where's all the unavailable information stored (why is there a *fundamental* lack of knowledge)? Well, who told you that all information in this universe can be observed or written down? Everything outside our event horizon is also unavailable to us, yet modern physics knows for sure that some of those *do* exist. Of course we have a hierarchy of belief in the existence of different things, with the universal state vector being hard to believe (and very hard to not believe) or make sense of. But there's no hard cut, and we might some day be able to reason about it. - -I don't know how exactly the observed universe is the way it is (i.e., how exactly it fell — or "collapsed", which is a convenient word for communication — into the eigenstate that we observed). I'm not even sure if the observed universe is the way it is in the objective (ontological) sense — if there were no observers, would it just be an "uncollapsed" state vector? I suspect that this problem has something to do with consciousness, and I suspect that we are at least hundreds of years from understanding consciousness. (Of course this kind of predictions are all nonsense — no one can look thirty years into the future). At the very least, we may eliminate some possibilities when we know more about consciousness. At any rate, this is an interesting problem that might be outside the capability of human reason, or might not. One may hate it and refuse to talk about it, but one cannot dismiss it as unphysical. - -When Lubos dismisses *ontology* as "exactly the same thing" as classical physics, he's dismissing the problem above, and making a hard compromise. He's basically saying that we cannot and should not reason about anything outside of what we can observe (this is also a crude classification because obviously he reasons beyond black hole horizons every day). This compromise is very dangerous for physics — sometimes one has to reason beyond one's horizon to formulate a complete and consistent answer. Black holes are one good example of getting of the limit. If we can extend spacetime beyond our event horizon, then why can't we accept **_the possibility of existence_** outside our "existence horizon", i.e., outside our perceived existence of the universal (and the first hand experience of our own existence inside it)? It's a wild and not well-defined idea, but all new physics starts out not well-defined. - -I still remember the last lecture of my first quantum mechanics course in my freshman year, taught by Prof. Michael Peskin. He discussed the interpretations of quantum mechanics. I forgot the exact arguments, but after rejecting other interpretations (including Copenhagen and hidden variable), he resorted to Many-Worlds, citing "Once you eliminate the impossible, whatever remains, no matter how improbable, must be the truth." I was not particularly satisfied. To me, once you eliminate the impossible, if whatever remains is still improbable, then maybe your imagination is not wild enough. I also remember the second time I took QM I, this time the graduate version, taught by Prof. Lenny Susskind. He stressed unitarity so much and showed us how wavefunction-collapsing is unnecessary (it was never well-defined anyway, unless you impose it). Unitarity is so important that triggered his "black hole war". - -The point of mentioning my two professors is that the interpretation problem of quantum mechanics has never been settled, and people who hold opinions contrary to Copenhagen should be respected. Lubos, on the other hand, tries to convince people that this problem has been settled, and actually settled for ninety years. He is either lying or delusional himself. diff --git a/source/blog/2015-02-24-the-new-onedrive-api.md b/source/blog/2015-02-24-the-new-onedrive-api.md deleted file mode 100644 index ba185ff0..00000000 --- a/source/blog/2015-02-24-the-new-onedrive-api.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -title: "The new OneDrive API" -date: 2015-02-24T18:31:19-0800 -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)](/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-03-22-back-up-os-x-app-icons.md b/source/blog/2015-03-22-back-up-os-x-app-icons.md deleted file mode 100644 index 0ec91559..00000000 --- a/source/blog/2015-03-22-back-up-os-x-app-icons.md +++ /dev/null @@ -1,45 +0,0 @@ ---- -title: "Back up OS X app icons" -date: 2015-03-22T16:58:50-0700 -date_display: March 22, 2015 ---- - -OS X application icons are valuable assets, and it's interesting to see how they evolve over time. This is especially the case when we upgraded to OS X 10.10 Yosemite, when Apple and many design-aware third party developers overhauled (mainly flattened) their icons. - -However, we lose all the old icons when we do a major OS upgrade. Technically they still live in Time Machine backups, but those are a pain to pull out. Therefore, I wrote a script just now to back up app icons of all applications living in `/Applications` (including those symlinked to `/Applications`, e.g., apps installed through `brew cask`) and its level-one subdirectories, and `/System/Library/CoreServices` (for `Finder.app` and such). Here's the script: - -```bash -#!/usr/bin/env bash -function app_version -{ - # $1 is the path to the app - /usr/libexec/PlistBuddy -c "print CFBundleShortVersionString" "$1"/Contents/Info.plist 2>/dev/null || date +%Y%m%d -} - -function app_icon_path -{ - # $1 is the path to the app - filename=$(/usr/libexec/PlistBuddy -c "print CFBundleIconFile" "$1"/Contents/Info.plist 2>/dev/null) - [[ -n ${filename} ]] || return - filename=$(basename "${filename}" .icns) - echo "$1/Contents/Resources/${filename}.icns" -} - -function process_app -{ - # $1 is the path to the app - name=$(basename "$1" .app | tr -d ' ') - path=$(realpath -e "$1") || { echo "${RED}error: broken link '${path}'${RESET}" >&2; return 1; } - version=$(app_version "${path}") - icon_path=$(app_icon_path "${path}") - [[ -n ${icon_path} ]] || { echo "${YELLOW}warning: '$1' has no app icon${RESET}"; return 1; } - [[ -f ${icon_path} ]] || { echo "${RED}error: '${icon_path}' does not exist${RESET}" >&2; return 1; } - cp "${icon_path}" "${name}-${version}.icns" - echo "${name}-${version}.icns" -} - -find /Applications -maxdepth 2 -name '*.app' | while read app; do process_app "${app}"; done -find /System/Library/CoreServices -maxdepth 1 -name '*.app' | while read app; do process_app "${app}"; done -``` - -The script is also available as a [gist](https://gist.github.com/zmwangx/fad97e085045a21ebc1d). diff --git a/source/blog/2015-04-26-using-python-3-with-emacs-jedi.md b/source/blog/2015-04-26-using-python-3-with-emacs-jedi.md deleted file mode 100644 index c84cf0d5..00000000 --- a/source/blog/2015-04-26-using-python-3-with-emacs-jedi.md +++ /dev/null @@ -1,30 +0,0 @@ ---- -title: "Using Python 3 with Emacs Jedi" -date: 2015-04-26T21:19:14-0700 -date_display: April 26, 2015 ---- - -Recently I'm working on [a hobby project in Python](https://github.com/zmwangx/storyboard), which means editing Python source files a lot. I've been using [Emacs Jedi](https://github.com/tkf/emacs-jedi) for almost as long as I've been writing Python, and it has been pretty helpful at completing away long names. - -However, Jedi uses `python` by default, which means `python2` on most of our systems at this point. Occasionally I'm writing Python 3 specific code but Jedi completes to Python 2 or refuses to complete; for the record, I enjoy writing and debugging Python 3.3+ much better than 2.7 (I realized this after trying to create a code base that is backward compatible with 2.7, which means reinventing the wheel or introducing annoying branches from time to time). So naturally I'm looking into using Python 3 in Jedi. - -The [official docs](https://tkf.github.io/emacs-jedi/latest/#how-to-use-python-3-or-any-other-specific-version-of-python) has been confusing and unhelpful at least for me, since it insists on setting up the virtualenv from within Emacs, and it failed for me. Why can't I set up the virtualenv myself? Turns out I can, and it's incredibly simple. The commands below assume that you have installed Jedi and friends (well, dependencies) using `package.el`. - -```bash -mkdir -p ~/.emacs.d/.python-environments -virtualenv -p /usr/local/bin/python3 ~/.emacs.d/.python-environments/jedi # or whatever your python3 path is -# If you feel like installing the server with 'M-x jedi:install-server', also do the following -~/.emacs.d/.python-environments/jedi/bin/pip install --upgrade ~/.emacs.d/elpa/jedi-20150109.2230/ # you might need to change the version number -``` - -And that's it. Put the following in your `~/.emacs`: - -```commonlisp -(add-hook 'python-mode-hook 'jedi:setup) -(setq jedi:complete-on-dot t) -(setq jedi:environment-root "jedi") -``` - -where the first two lines should be there whether you want to use Python 3 or not — so only the third line is new, and its meaning is obvious. - -At last, start Emacs and do `M-x jedi:install-server` if you haven't run the `pip` command above yet. Restart Emacs (if necessary). That's it. Enjoy your Jedi with Python 3. (Type `import conf`, for instance, to be convinced that you're really autocompleting Python 3). 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 deleted file mode 100644 index cb76693e..00000000 --- a/source/blog/2015-05-03-why-oh-my-zsh-is-completely-broken.md +++ /dev/null @@ -1,177 +0,0 @@ ---- -title: "Why Oh My Zsh is completely broken" -date: 2015-05-03T17:15:49-0700 -date_display: May 3, 2015 ---- - -Today I moved from [Oh My Zsh](https://github.com/robbyrussell/oh-my-zsh) to [Prezto](https://github.com/sorin-ionescu/prezto), after using Oh My Zsh for about three years since 2012. I'll try to shed some light on the reasons in this post. - -Zsh is a rather complicated shell (compared to Bash), with a hell lot of builtins and a complex completion system. The complexity makes it powerful, but also makes it intimidating to mortals; moreover, it doesn't look as sweet as it could be out of box. Most mortals, me included, want an interactive shell that's sweet and "just works", so we need wizards to guide us in configuring this beast. Oh My Zsh and Prezto are just two of such configuration frameworks. Oh My Zsh is somewhat older: the first commit of Oh My Zsh dates back to [August 2009](https://github.com/robbyrussell/oh-my-zsh/commit/e20401e04e057a39c228dbb99dda68ec7fa4235a), while Prezto was forked from Oh My Zsh in [February 2011](https://github.com/sorin-ionescu/prezto/commit/8d487d4f6c2d38cb108d7c8c0c2de9f0385da402), and has since been completely rewritten. `robbyrussell/oh-my-zsh` as of today has 23,610 stars on GitHub, while `sorin-ionescu/prezto` has 4,069. This doesn't imply Oh My Zsh is any better — I guess the fancy name of Oh My Zsh earned it a lot more undeserved stars; you'll see why soon. - -I was hardly involved in Oh My Zsh development, and I haven't even carefully inspected Oh My Zsh's source code until yesterday, so my soon-to-come complaints about Oh My Zsh might not be completely true. But here it is: **Oh My Zsh brings the worst of community-driven development, where the "community" knows not of what it is doing, and just wants to get things done in the sloppiest way possible.** Let's look at some examples. All discussions are based on [`1400346`](https://github.com/robbyrussell/oh-my-zsh/commit/140034605edd0f72c548685d39e49687a44c1b23), the latest commit at the time of writing. - -## The core lib hodgepodge - -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 -``` - -Wait, why do I see `bzr.zsh`, `git.zsh`, and even `nvm.zsh` in the core lib? Why are all of these mandatory (all files in `lib` are sourced from `oh-my-zsh.sh`)? Why should I load `bzr.sh` and `nvm.zsh` when I don't use Bazaar or NVM at all?[^bazaar] Moreover, since we already have `bzr.sh`, `git.zsh` and `nvm.zsh` in the core library, why don't we also have `hg.zsh`, `rvm.zsh`, `svn.zsh` and `virtualenv.zsh`, just to name a few? - -[^bazaar]: This is not entirely true. I use [git-remote-bzr](https://github.com/felipec/git-remote-bzr) when I have to clone a Bazaar repo for some reason. - -I suppose these marginal scripts are in the core because they define functions (`bzr_prompt_info`, `git_prompt_info`, `nvm_prompt_info`, etc.) that are called from many themes; well, at least this is the case for `git.zsh`. But that doesn't answer any of the questions above. **The underlying question is: why aren't they simply plugins?**[^plugins] Loading a plugin in Oh My Zsh isn't sophiscated at all (compared to Prezto; see discussion below), just annoying to type in full, which [boils down to](https://github.com/robbyrussell/oh-my-zsh/blob/140034605edd0f72c548685d39e49687a44c1b23/oh-my-zsh.sh#L68-L72): - -```zsh -if [ -f $ZSH_CUSTOM/plugins/$plugin/$plugin.plugin.zsh ]; then - source $ZSH_CUSTOM/plugins/$plugin/$plugin.plugin.zsh -elif [ -f $ZSH/plugins/$plugin/$plugin.plugin.zsh ]; then - source $ZSH/plugins/$plugin/$plugin.plugin.zsh -fi -``` - -where `$plugin` is the name of the plugin. They can easily wrap this in a function and let theme authors painlessly load plugins,[^pollution] but they just don't. Also, the consistency issue (think of my question about `hg`, `rvm`, `svn` and `virtualenv`) is beyond my grasp. The only way I could make sense of this situation is that all the mess was created by clueless community contributions that didn't think about the code base as a whole (the code base is small!), and maintainers didn't care either. - -[^plugins]: Note that outside the core, there are additional plugins for `git` and `nvm`. Oh well. -[^pollution]: Whether aliases defined in a plugin (e.g. for `git`) should be loaded can be easily controlled via a switch. - -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 (doing things like sourcing module init scripts and marking module functions for autoloading). 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 the `modules` directory, the Prezto repo does contain one other [`runcoms`](https://github.com/sorin-ionescu/prezto/tree/08676a273eba1781ddcb63c4f89cfff9bd62eac4/runcoms) directory with rc files, but those are just recommendations that one may safely ignore. 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): - -```zsh -# prezto -zstyle ':prezto:*:*' color 'yes' -zstyle ':prezto:environment:termcap' color 'no' # disable coloring of less, which looks horrible -zstyle ':prezto:load' pmodule environment editor history directory utility colors spectrum git completion prompt ruby -zstyle ':prezto:module:editor' key-bindings 'emacs' -zstyle ':prezto:module:prompt' theme 'zmwangx' -[[ "$OSTYPE" == darwin* ]] && export BROWSER='open' -source ~/.zprezto/init.zsh -``` - -Here `zmwangx` is my [personal theme](https://github.com/zmwangx/prezto/blob/master/modules/prompt/functions/prompt_zmwangx_setup) that looks like [this](https://i.imgur.com/nCBK8ZB.png). - -## Incredibly poor code quality - -Oh My Zsh's code quality is incredibly poor. Even within the core library. Pick any file from `lib/`, and you'll be amazed by the hot mess in front of your eyes. There's no coding standard whatsoever: - -* You can find four-space indents and two-space indents mixed [in the same file](https://github.com/robbyrussell/oh-my-zsh/blob/140034605edd0f72c548685d39e49687a44c1b23/lib/functions.zsh); -* You can find function definitions with the `function` keyword and without [in the same file](https://github.com/robbyrussell/oh-my-zsh/blob/140034605edd0f72c548685d39e49687a44c1b23/lib/git.zsh); -* You can find [167-character-long lines](https://github.com/robbyrussell/oh-my-zsh/blob/140034605edd0f72c548685d39e49687a44c1b23/lib/functions.zsh#L2) mixed with early-broken lines (yes, sometimes [in the same file](https://github.com/robbyrussell/oh-my-zsh/blob/140034605edd0f72c548685d39e49687a44c1b23/lib/git.zsh#L69)); -* You can find completely commented out blocks of code [in the core lib](https://github.com/robbyrussell/oh-my-zsh/blob/140034605edd0f72c548685d39e49687a44c1b23/lib/key-bindings.zsh#L70-L87), where the average user is not supposed to touch; - -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 [`git.zsh`](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): - -```zsh -git_prompt_status() { - INDEX=$(command git status --porcelain -b 2> /dev/null) - STATUS="" - if $(echo "$INDEX" | command grep -E '^\?\? ' &> /dev/null); then - STATUS="$ZSH_THEME_GIT_PROMPT_UNTRACKED$STATUS" - fi - if $(echo "$INDEX" | grep '^A ' &> /dev/null); then - STATUS="$ZSH_THEME_GIT_PROMPT_ADDED$STATUS" - elif $(echo "$INDEX" | grep '^M ' &> /dev/null); then - STATUS="$ZSH_THEME_GIT_PROMPT_ADDED$STATUS" - fi - if $(echo "$INDEX" | grep '^ M ' &> /dev/null); then - STATUS="$ZSH_THEME_GIT_PROMPT_MODIFIED$STATUS" - elif $(echo "$INDEX" | grep '^AM ' &> /dev/null); then - STATUS="$ZSH_THEME_GIT_PROMPT_MODIFIED$STATUS" - elif $(echo "$INDEX" | grep '^ T ' &> /dev/null); then - STATUS="$ZSH_THEME_GIT_PROMPT_MODIFIED$STATUS" - fi - if $(echo "$INDEX" | grep '^R ' &> /dev/null); then - STATUS="$ZSH_THEME_GIT_PROMPT_RENAMED$STATUS" - fi - if $(echo "$INDEX" | grep '^ D ' &> /dev/null); then - STATUS="$ZSH_THEME_GIT_PROMPT_DELETED$STATUS" - elif $(echo "$INDEX" | grep '^D ' &> /dev/null); then - STATUS="$ZSH_THEME_GIT_PROMPT_DELETED$STATUS" - elif $(echo "$INDEX" | grep '^AD ' &> /dev/null); then - STATUS="$ZSH_THEME_GIT_PROMPT_DELETED$STATUS" - fi - if $(command git rev-parse --verify refs/stash >/dev/null 2>&1); then - STATUS="$ZSH_THEME_GIT_PROMPT_STASHED$STATUS" - fi - if $(echo "$INDEX" | grep '^UU ' &> /dev/null); then - STATUS="$ZSH_THEME_GIT_PROMPT_UNMERGED$STATUS" - fi - if $(echo "$INDEX" | grep '^## .*ahead' &> /dev/null); then - STATUS="$ZSH_THEME_GIT_PROMPT_AHEAD$STATUS" - fi - if $(echo "$INDEX" | grep '^## .*behind' &> /dev/null); then - STATUS="$ZSH_THEME_GIT_PROMPT_BEHIND$STATUS" - fi - if $(echo "$INDEX" | grep '^## .*diverged' &> /dev/null); then - STATUS="$ZSH_THEME_GIT_PROMPT_DIVERGED$STATUS" - fi - echo $STATUS -} -``` - -**This one single function intended to be invoked from a precmd hook (basically executed 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, - -```zsh -$(echo "$INDEX" | grep '^A ' &> /dev/null) -``` - -may well be replaced with - -```zsh -[[ $INDEX == *$'\nA '* ]] -``` - -or - -```zsh -[[ $INDEX =~ $'\nA ' ]] -``` - -(Note that the `git status --porcelain -b` call always prints the branch info such as `## master...origin/master` in the first line, so "<code>A </code>", if present at the beginning of any line, must be preceded by a newline; that's why the above works.) All other grep calls can be similarly replaced with pattern/regex matching. No forking. - -By the way, whoever wrote this function seems to be unaware of the `-q,--quite,--silent` switch of `grep` (which should be available in all implementations), and every call is littered with `&> /dev/null`. In fact, using the `-q` switch is even (slightly) faster: a reasonable implementation of `-q` exits immediately when a match is found, while what is written here waits until all input is processed. - -I haven't exhausted the problems with this function just yet. As a bonus: despite being awfully inefficient, **this function *can't even be used* in many cases for which it is designed.** You might have noticed that the order of different status bits is completely fixed by whoever wrote this function (by the way, all those `$ZSH_THEME_GIT_PROMPT_*` variables are documented nowhere, so one who wants to write a theme has to dig into the source — only to find the function useless except for polluting the namespace). If one wants to use a different order, or put some of the bits in `RPROMPT`, one has to roll his own (or good luck parsing the output of `git_prompt_status`). In fact, even a [dumbed down function `git_prompt_info`](https://github.com/robbyrussell/oh-my-zsh/blob/140034605edd0f72c548685d39e49687a44c1b23/lib/git.zsh#L2-L8), which only prints the branch name and whether it's dirty, is similarly uncustomizable; [the `gallois` theme](https://github.com/robbyrussell/oh-my-zsh/blob/140034605edd0f72c548685d39e49687a44c1b23/themes/gallois.zsh-theme), my first theme and on which I later based my own theme, needs to define a `git_custom_status` function to achieve what it needs — otherwise something as simple as adding a pair of brackets around the branch name is super painful. - -One might wonder how Prezto solves the same problem. The answer is in [`modules/git/functions/git-info`](https://github.com/sorin-ionescu/prezto/blob/08676a273eba1781ddcb63c4f89cfff9bd62eac4/modules/git/functions/git-info). The `git-info` function does more, and again in a highly modular way (without grep calls, for God's sake): status bits or their combinations are [formatted on demand with `zformat` and stored in an associative array `git_info`](https://github.com/sorin-ionescu/prezto/blob/08676a273eba1781ddcb63c4f89cfff9bd62eac4/modules/git/functions/git-info#L393-L416), where users specify format strings via `zstyle` with [thoroughly documented escape sequences](https://github.com/sorin-ionescu/prezto/tree/08676a273eba1781ddcb63c4f89cfff9bd62eac4/modules/git#theming). Very beautiful solution. - -## The completely broken community contribution process - -I'm not sure if the project maintainers are Zsh wizards (I'm afraid not). I'll just assume that most of the code with incredibly poor quality came from community contribution. Okay, community. But even the community contribution process is completely broken. - -At the time of writing there are 159 open issues and 446 open pull requests in `robbyrussell/oh-my-zsh` (the stats are 13/35 in `sorin-ionescu/prezto` — not proportional to the number of stars or forks). There's even [a PR called "Easy-to-Merge"](https://github.com/robbyrussell/oh-my-zsh/pull/3809) that is said to collect PRs that are either extremely simple fixes or have been discussed–tested–and–signed-off (wait, then why aren't they already merged?). This makes it almost impossible to open new, substantial PRs (such as a complete rewrite of the `git_prompt_status` criticized above) — God knows whether other people have already proposed the same fix, or a different fix for the same problem, whether it's been discussed–tested–and–signed-off, and how much discussion will be needed for a new PR. - -You might infer from the above that the actually merged PRs are discussed–tested–and–signed-off. Well, of course not (think about the code quality), and here's one more case study. - -The only time I [submitted a PR](https://github.com/robbyrussell/oh-my-zsh/pull/3591) is when [a previous PR](https://github.com/robbyrussell/oh-my-zsh/pull/3564) broke aliases of the `ls` family, which most of us run tens to hundreds of times every day. The `-h` option was stripped from all aliases but one (which was ridiculous since the option seemed to be lost during copy/paste), and anyone who used the affected aliases regularly and lived with the PR for ten minutes should notice. Apparently nobody looked at the diffs before merging, or nobody cared (before I and one other guy jumped in). My PR was merged three days later; the delay was okay. - -[In another instance](https://github.com/robbyrussell/oh-my-zsh/pull/3341), the delay was totally unbearable. [grep 2.21](https://savannah.gnu.org/forum/forum.php?forum_id=8152) was released on November 23, 2014, and it deprecated `GREP_OPTIONS`. Oh My Zsh was using `GREP_OPTIONS` back then, so anyone who upgraded to grep 2.21 and used grep regularly was getting a lot of deprecation warnings (oh, before you ask, `grep.zsh` is in the core lib). Core lib stuff spitting deprecation warnings on all platforms all the time is a pretty big thing, right? There were multiple ways to fix this problem, all of them trivial to the reasonably trained eyes; and they won't break user scripts, unless someone was doing something insane in the first place (like relying on exported `GREP_OPTIONS` for certain behaviors in a script). However, there were quite a bit of discussion spanning multiple issues and PRs (most notably [this one](https://github.com/robbyrussell/oh-my-zsh/pull/3341)), and despite all the discussions, not a single maintainer or collaborator joined or showed any interest. [A fix was merged not until December 14, 2014](https://github.com/robbyrussell/oh-my-zsh/pull/3403). Of course there were temporary fixes (remember, the issue was trivial to begin with), but the problem must have been confusing to the less-proficient Zsh users during the twenty day window. - -## Easter egg - -One more thing, among countless other problems: the recommended way to install Oh My Zsh is either - -```zsh -curl -L https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh | sh -``` - -or - -```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. - -## Summary - -Oh My Zsh was a great idea when it took off. Over the years however, through low-quality community contributions from people who barely understand Zsh (and shell scripting idioms and best practices in general), it evolved into a beast that no one except the maintainers could fix or seriously contribute to; yet the maintainers seem to be pretty satisfied with it. - -Therefore, I'm moving to Prezto, the project with far better modularity and code quality. In fact, this rant all began from yesterday, when I was about to embark on a stripped down Zsh configuration system for myself. I was thinking about borrowing code from both Oh My Zsh and Prezto; but after reading some code from both projects, I soon realized that Oh My Zsh is totally crap and Prezto can be taken almost unmodified. I hope that more people will take a look at Prezto, realize how awesome it is (especially in comparison to the famed Oh My Zsh), fork it, and possibly submit patches. diff --git a/source/blog/2015-05-05-graceful-handling-of-sigint-when-using-pythons-multiprocessingprocess.md b/source/blog/2015-05-05-graceful-handling-of-sigint-when-using-pythons-multiprocessingprocess.md deleted file mode 100644 index 6e6037a4..00000000 --- a/source/blog/2015-05-05-graceful-handling-of-sigint-when-using-pythons-multiprocessingprocess.md +++ /dev/null @@ -1,74 +0,0 @@ ---- -title: "Graceful handling of <code>SIGINT</code> when using Python's <code>multiprocessing.Process</code>" -date: 2015-05-05T22:03:39-07:00 -date_display: May 5, 2015 ---- - -Today I learned something about Python's (at least CPython's) multiprocessing and signal handling, and I would like to share it here. Basically my situation was such (when developing [`pydoc`](https://github.com/zmwangx/zmwangx.github.io/blob/source/pyblog) that powers this blog): - -* I would like to serve the blog with an HTTP server while auto-regenerating for changes; -* The auto-regeneration is handled in the main process with a while loop, whereas the HTTP server (requiring little human intervention) is put in a `multiprocessing.Process` and launched with `http.server.HTTPServer.serve_forever()`; -* Upon sending `SIGINT`, both processes need to clean up and quit; in particular, the server needs to exit its `serve_forever()` loop (which can be done via `shutdown()`, but how to invoke the method is a problem, since `serve_forever()` blocks); -* Handling of `SIGINT` must be graceful in the main process — there might be an ongoing build that must not be interrupted until finishing. - -Given this context, I learned the following two critical concepts (at least true in the current version of CPython) through trial and error: - -1. **A user-triggered `SIGINT` is sent to both processes** — the main process and the `multiprocessing.Process` instance; -2. **Except for the defined interfaces, a `multiprocessing.Process` instance is almost completely separated from the main process, sharing as little resources as possible**; by "defined interfaces" I mean the defined attributes and methods of a `Process` instance, as well as defined communication channels like `multiprocessing.Pipe` or `multiprocessing.Queue`. And to expand on resource sharing: yes, the two processes have their own copies of global variables, so using global variables as state registers is a no-go. - -Both concepts can be used to one's benefit or detriment. Below is how I solved my problem, using the two concepts. Observe that without a custom handler, Python translates a `SIGINT` to a `KeyboardInterrupt` exception; therefore, I use the default `KeyboardInterrupt` to interrupt the HTTP server in its own process (through handling the exception and calling `shutdown()`), but instead install a custom `SIGINT` handler in the main process that translates `SIGINT` to setting a `sigint_raised` flag that can be picked up by the while loop once the current build (if any) is finished. The proof of concept script is as follows (the production code is [here](https://github.com/zmwangx/zmwangx.github.io/blob/a7a0b2073f30b1d0214c3152998d95e40a39b438/pyblog#L567-L635)): - -```python -#!/usr/bin/env python3 - -import http.server -import multiprocessing -import signal -import sys -import time - -class HTTPServerProcess(multiprocessing.Process): - def run(self): - httpd = http.server.HTTPServer( - ("", 8000), http.server.SimpleHTTPRequestHandler) - try: - httpd.serve_forever() - except KeyboardInterrupt: - httpd.shutdown() - -def do_things(): - for i in range(10): - sys.stderr.write(".") - sys.stderr.flush() - time.sleep(1) - sys.stderr.write("\n") - -def main(): - server_process = HTTPServerProcess() - server_process.start() - - # define and install custom SIGINT handler - sigint_raised = False - - def sigint_mitigator(signum, frame): - nonlocal sigint_raised - sigint_raised = True - - signal.signal(signal.SIGINT, sigint_mitigator) - - while not sigint_raised: - do_things() - - server_process.join() - -if __name__ == "__main__": - main() -``` - -Beware that with this solution, if there are external programs or OS level operations happening in the main process, then the operation at the time of `SIGINT` will still be interrupted[^OS-specific] (for example, in the script above, the `time.sleep(1)` at the exact point of `SIGINT` is still interrupted, but otherwise `do_things` is carried on to its completion). I'm not sure how to explain this — maybe the handler isn't capturing the signal fast enough?[^naive] Anyway, one single early interruption is at least more acceptable than a completely corrupted build[^interruption], and certainly more graceful. - -[^naive]: That's awfully naive and layman-sounding, I know, but I *am* almost a layman when it comes to system-level programming. - -[^OS-specific]: [CPython's `multiprocessing` is written in C](https://hg.python.org/cpython/file/1320ec1b24af/Modules/_multiprocessing), so the behavior might depend on the OS. I'm talking about OS X here. I haven't inspected and won't inspect the C source code. - -[^interruption]: That's assuming your build isn't interdependent in which any single failure corrupts everything. In that case, what can we do? I honestly see no way of injecting signal handling in `subprocess.Popen`. diff --git a/source/blog/2015-05-05-new-blog-new-start.md b/source/blog/2015-05-05-new-blog-new-start.md deleted file mode 100644 index 580d33c0..00000000 --- a/source/blog/2015-05-05-new-blog-new-start.md +++ /dev/null @@ -1,43 +0,0 @@ ---- -title: "New blog, new start" -date: 2015-05-05T02:42:44-07:00 -date_display: May 5, 2015 ---- - -Octopress has been serving me for the past six months, during which even Octopress itself underwent major changes — in fact, [Octopress 3.0.0](https://github.com/octopress/octopress/releases/tag/v3.0.0) was only released 3 days ago, which I never got to try. Anyway, Octopress's heavily colored interface grew old on me fairly quickly. I'm especially unhappy with the inline `<code>` tag, which is always wrapped in a white box and stands out too much (worse still, there's no visual difference when such a `<code>` tag is placed inside an `<a>` tag). Since I use inline code/verbatim a lot, many of my articles were littered with arbitrary boxes everywhere. - -![Farewell, Octopress.](https://i.imgur.com/hxfSnOk.png) - -Apparently I need something simpler. Because - -> Simplicity is the ultimate sophistication. - -But how? Simiplicity 101: get rid of the "platform". There's no reason why I need a blogging platform like Jekyll (let alone the WordPress monster). When I initially switched to Octopress, I thought code highlighting was something fancy that I need heavy machinery to achieve, but it turned out that Pandoc is battery-included when it comes to syntax highting,[^pandoc] so all I need is to specify a highlight style, e.g., Pygments: - -[^pandoc]: Well, Pandoc is heavy-machinery, but it's both generic and self-contained, unlike a specialized blogging platform. - -``` -pandoc input.md --highlight-style=pygments --template template.html --output output.html -``` - -That's it. Write the Markdown, compile with Pandoc, instantly awesome. So the HTML posts are there (assuming the HTML template is written, which is not hard to kick off). - -The rest of the job is to design the stylesheets and compile the posts into a coherent blog — basically, generate an index. I was able to realize both in several hours. For the former task, I borrowed a lot from [mort.ninja](http://mort.ninja/) by [Mort Yao](https://github.com/soimort). Interestingly, we were born in the same city (Nanjing, China), and I benefit from at least two of his open source projects: [you-get](https://github.com/soimort/you-get) and [translate-shell](https://github.com/soimort/translate-shell). The latter task is more interesting but also not hard. I'm rolling my own toolchain in Python, which you can find in [`pyblog`](https://github.com/zmwangx/zmwangx.github.io/blob/source/pyblog). In fact, the complete source of this blog (down to how image assets are generated) are in the [`source` branch](https://github.com/zmwangx/zmwangx.github.io/tree/source) of my GitHub Pages repo, so you may take a look if you're interested. `pyblog` is highly specialized[^pyblog] and is still a work in progress at the time of writing, but it's already well capable of generating the blog — currently missing are auto gen-deploy and preview (with auto-update), which will also come soon. - -[^pyblog]: Which is fine since I don't expect anyone else to use it, anyway. - -By the way, the most annoying thing in the development process was working with XML and generating [the Atom feed](/atom.xml). Standard library `xml.etree.ElementTree` doesn't support the `![CDATA[` tag, and in the end I had to hack [library internals](https://github.com/zmwangx/zmwangx.github.io/blob/source/pyblog#L34-L54), which is likely to break in future versions. Remember the quotes? - -> XML is a classic political compromise: it balances the needs of man and machine by being equally unreadable to both. - -> XML combines the efficiency of text files with the readability of binary files. - -Sigh. - -Anyway, here is my new shiny blog. - -![Welcome to the completely revamped dl? cmplnts?](https://i.imgur.com/VS5f9eJ.png) - -It looks ten times better than Octopress, and ever builds much faster than Octopress[^speed]. As a bonus, the codebase is so small that it's super trivial to hack (no, not *that* hack). - -[^speed]: I have the impression that a complete build of all posts (about fifty of them) with `pyblog` is faster than regenerating for a single modified post in Octopress. That's in the context of absolutely no categories; when you have a dozen or more categories, Octopress slows down to a halt. diff --git a/source/blog/2015-05-06-searchable-settings-are-one-honking-great-idea-lets-do-more-of-those.md b/source/blog/2015-05-06-searchable-settings-are-one-honking-great-idea-lets-do-more-of-those.md deleted file mode 100644 index a2f30cd4..00000000 --- a/source/blog/2015-05-06-searchable-settings-are-one-honking-great-idea-lets-do-more-of-those.md +++ /dev/null @@ -1,54 +0,0 @@ ---- -title: "Searchable settings are one honking great idea — let's do more of those!" -date: 2015-05-06T19:29:46-07:00 -date_display: May 6, 2015 ---- - -I had to tweak some iOS settings just now, which wasn't a delightful experience. Since I just renovated my blog inside out and am still in the hype mode, I'll write a post on the interface design of settings or preferences. - -The Zen of Python says, - -> Namespaces are one honking great idea -- let's do more of those! - -Namespaces are in general great stuff for sure, and I love them a lot.[^NSHell] But they are not so great when badly designed. One problem is that sometimes things belong to the unexpected namespace. There are already examples in Python's STL, e.g., `os.remove` and `shutil.rmtree` — for Unix guys they're just `rm` and `rm -r`, but in Python they live in two separate <del>universes</del> namespaces. The other problem is that if one takes namespaces too far and design several levels of nested namespaces, then either the names are super long and annoying to use, or one needs to leave out part of the hierarchy with `from .. import ..`, defeating the security of namespaces and making code harder to understand locally. - -[^NSHell]: Thinking about [`NSHell`](http://nshipster.com/namespacing/) and the like kinda creeps me out, although there are quite some reasonable pro-class prefix arguments. - -When designing an interface for settings or preferences, there are also "namespaces", or sections (and subsections), although sections are more about grouping preferences by kind than about avoiding name clashes. However, section structures more often than not suffer from the same problems as badly designed namespace structures. Take iOS Settings for example. There are both unintuitive groupings and very deep nestings. - -Regarding unintuitive groupings, there's this top-level section named "General" (among other unintuitive things), which contains many subsections: "About", "Software Update", "Siri", "Spotlight Search", "Handoff & Suggested App" "Accessibility", "Usage", "Background App Refresh"... And others I'm too tired to list. But what does "General" even mean? How are other top level sections like "Notifications", "Control Center", "Display & Brightness", etc. less general than the subsections found in "General"? No clue. I think Apple just wants to put (what they perceive as) the most used sections in the top-level, but sometimes it's hard to remember what's in "General" and what's not without going through both lists one by one (and missing what you are looking for in the first three tries). - -Regarding deep nestings, try to find "Frequent Locations". It's "Privacy->Location Services->System Services->Frequent Locations", or if you locked down Location Services with Restrictions,[^find-my-iphone] "General->Restrictions->Location Services->System Services->Frequent Locations". Of course it's rarely used, but it still makes me gasp.[^location-services] - -[^find-my-iphone]: Which you should: what's the point of Find My iPhone when the thief can disable it in Location Services? -[^location-services]: This brings another problem of the interface design of iOS Settings. When restricted, one cannot make modifications to "Privacy->Location Services", and instead has to go to "General->Restrictions->Location Services". What's the point? "Restrictions" is about *setting restrictions*, not about *editing restricted items or sections in a central place exclusively"*. Ideally one should be able to tap on a lock icon in "Privacy->Location Services" and enter the restrictions passcode to unlock it, like what we find in OS X's System Preferences. - -I think in general **one should be really careful with subsections (i.e., two or more levels of nesting)**, especially in designing a settings interface. There's a reason why most INI files have no hierarchy, just sections. I believe the reason is that **our text processing capability is inherently linear.** Hypertext and jumping interfaces disrupt the linear workflow, but even when faced with a network of stuff, we still process them one at a time, linearly. Linearity is even more important in designing a settings interface since unlike reading articles, one is typically looking for a specific item. **Finding one item linearly in a list of irrelevant distractions is already annoying enough, and you certainly don't want to make it quadratic or even cubic, which is simply unbearable when coupled with unexpected groupings.** - -I can understand why designing a settings interface for a system as complicated as iOS (yet somehow has to keep all settings in a central place) is hard — there are too many atomic items, and often items do not fall nicely into categories. But I think it still important to try to reduce nesting. Maybe having long lists, but putting the most commonly used items on top is a good idea. Or maybe... Bypass the linear searching experience altogether? - -## Searchable settings - -I'm not sure who invented searchable setting pages, but I first noticed their great efficiency in Google Chrome many years ago, when one had to look for setting items tab after tab in all other major browsers. In fact, even to this day, the Chromium Opera (i.e., Opera 15+) is the only major browser other than Chrome that has adopted searchable settings. (I remember arguing with someone over whether this was a change for the good on [blogs.opera.com/desktop](http://blogs.opera.com/desktop/).) Searchable settings is also available in OS X's System Preferences, which is a joy to use. See screenshots below about how Google and Apple implement a searchable interface. Windows Control Panel is also searchable, and the search feature is capable of turning up deeply buried settings (e.g., "Control Panel->System and Security->System->Advanced system settings->Environment Variables"), so one point for them also. - -As I said above, looking for an item in a list of irrelevant stuff is really annoying. Searchable settings completely bypass this issue by bringing users right to the desired item. This way, unintuitive groupings or deep nestings are no longer that problematic. Just like Google will tell me whether `rmtree` is in `os` or `shutil`[^rmtree], System Preferences' search will tell me whether "Dark menu bar or Dock" is in "General" or somewhere else. - -In fact, it is somewhat surprising to me that searchable settings are only available in a handful of applications. Seriously, these days we can search for almost anything on our computers and anything on the grand grand Internet, but we can't search the pool of available settings? If we have an INI, Plist XML, JSON, YAML, or whatever text configuration/preference file, then we can search it. Why not in GUI applications? - -Of course, designing clear structures (with the principles and pitfalls discussed in the first half of this post) pays. But searchable settings are one honking great idea, and they are just long due in most applications. Come on, let's do more of them. - -[^rmtree]: This is of course just a metaphor; I'm not dumb enough to be unable to remember `shutil.rmtree`. - -![How Google designed their award-winning searchable settings.](https://i.imgur.com/NazieEk.png) - -![Apple.](https://i.imgur.com/aKgW29W.png) - -![Microsoft.](https://i.imgur.com/7zJxr8P.png) - ---- - -**May 16, 2015 update:** Ars Technica [published an article today](http://arstechnica.com/apple/2015/05/what-wed-like-to-see-in-ios-9-at-wwdc-next-month/) listing "what we'd like to see in iOS 9 at WWDC next month", and "Settings page overhaul" is listed as the third item. Apparently I'm not the only one who's concerned about the iOS Settings maze. In addition, their proposed solution is similar to mine;[^similarity] the key, of course, is search. - -**June 27, 2015 update:** [Wish granted in iOS 9](/blog/2015-06-26-ios-9-searchable-settings.html). - -[^similarity]: Which is not at all surprising, since Apple's very own OS X has already set an example. diff --git a/source/blog/2015-05-09-storyboard-reached-01.md b/source/blog/2015-05-09-storyboard-reached-01.md deleted file mode 100644 index cfc44e5f..00000000 --- a/source/blog/2015-05-09-storyboard-reached-01.md +++ /dev/null @@ -1,84 +0,0 @@ ---- -title: "<code>storyboard</code> reached 0.1" -date: 2015-05-09T00:32:28-07:00 -date_display: May 9, 2015 ---- - -For quite some time I've been working on a Python project called [`storyboard`](https://github.com/zmwangx/storyboard), and today I finally released the 0.1 stable (or you can think of it as 1.0). - -As described on [the index page](https://storyboard.readthedocs.org/en/0.1/index.html), - -> `storyboard` is a FFmpeg-based customizable video storyboard generator with metadata reporting directly embedded in the generated images. Reported metadata fields include, but are not limited to, title, filename, file size, SHA-1 digest, container format, duration, pixel dimension, display aspect ratio (DAR), scan type (progressive, interlaced, or telecined), frame rate, and per-stream metadata (type, codec, profile, dimensions, bitrate, etc.). - -And the motivation was - -> `storyboard` was inspired by the storyboards I frequently encounter on video-sharing Internet forums, mostly generated by proprietary video players. Those storyboards often come with video/file metadata bundled, which I see as a great all-in-one solution for video sharing, saving one the labor of typing multiple console commands, copying and pasting output, and worrying about the forum’s crappy formatting. However, I, for one, dislike proprietary players. Also, those storyboards are usually ugly and uninformative, using stupid fonts and lacking crucial information that hackers look for (e.g., hash). Therefore, I developed this customizable storyboard generator for hackers. - -The project itself isn't very important, and I don't see any possibility of it gaining recognition; but its educational value to me was pretty huge. This is the first full package I ever developed, in the sense that it's complete with documentation, test suites, continuous integration and tested portability, as well as distributed to a package index ([PyPI](https://pypi.python.org/pypi/storyboard) in this case). Here's what I observed and learned: - -1. It's just really different from casual hacking, where I would try to achieve what I need in the shortest amount of programmer time possible, drop hard-coded values (even OAuth tokens) in scripts, leave things undocumented, etc. I'm a perfectionist so my casual code is usually not so bad, but `storyboard` is just different — to ensure quality of API and CLI, I wrote more documentation than actual code. Through this project I realized how hard real-world coding (or idealized real-world coding) is: the initial 10% is excitement, and the rest is just chores (compare that to casual hacking, where at least 30% is excitement). - -2. Write once, debug everywhere. Not really, but ensuring portability is really difficult. Trying to debug something on a platform which I can't lay my hands upon is insanely frustrating. This afternoon I spent a long time trying to pin down a weird hanging bug on AppVeyor; the complete process is documented in [this squashed commit](https://github.com/zmwangx/storyboard/commit/e8a28e5a92f744157fedd03893fa8fe5a5e7d445). In the end the bug wasn't in my program, but in that specific version of FFmpeg (which I wouldn't believe since FFmpeg is really stable from my experience), or that specific version of FFmpeg combined with AppVeyor, or that specific version of FFmpeg combined with AppVeyor combined with Azure, or... who knows. The only thing I could say is it was not in my program, because I could reproduce the infinite loop in ``ffprobe`` even before I launched my program... Anyway, in this case I can lay my hands on the platform, just indirectly and painful. What about real world development where developers need to handle bug reports from users who could have broken everything? I don't want to imagine. - -3. The project was a clear manifestation of Hofstadter's law: - - > It always takes longer than you expect, even when you take into account Hofstadter's Law. - - Enough said; so true. In fact, towards the end of the development cycle I got pretty bogged down[^bogged-down] and stopped for a while to work on renovating this blog (60% excitement!). Meanwhile, I was too busy with other parts of life, so I rushed towards the stable 0.1 release in the past two days, dropping several ideas I wanted to implement (for completeness). Although I "rushed", it still took at least four times as long as I expected. - -[^bogged-down]: I was implementing stuff that I wouldn't ever need myself — for completeness, and that was not rewarding in the slightest. - -Anyway, here it is, the [0.1](https://github.com/zmwangx/storyboard/releases/tag/0.1) [release](https://pypi.python.org/pypi/storyboard/0.1). The badges certainly weren't bad: - -![`storyboard`'s got quite a few badges of honor](https://i.imgur.com/miOoX5Y.png) - -I created [an asciinema recording](https://asciinema.org/a/19782) to commemorate the release (the original asciicast is [here](https://dl.bintray.com/zmwangx/generic/storyboard-0.1-walkthrough-asciicast.json)):[^solarized-dark] - -[^solarized-dark]: The screencast's color scheme is actually off in some places, since in my iTerm2 bold font is displayed as bold, not bright. - -<div style="width: 672px; text-align: center; margin: auto;"> -<script type="text/javascript" src="https://asciinema.org/a/19782.js" id="asciicast-19782" async></script> -<noscript> -Javascript disabled. Check out the cast [here](https://asciinema.org/a/19782). -</noscript> -</div> - -And, just to demonstrate `storyboard`, I re-screen-recorded the asciinema screencast with QuickTime, saved to [an MOV file](https://dl.bintray.com/zmwangx/generic/storyboard-0.1-walkthrough.mov), and ran it through my `metadata` and `storyboard`: - -``` -> metadata storyboard-0.1-walkthrough.mov -Filename: storyboard-0.1-walkthrough.mov -File size: 60418244 (57.7MiB) -Container format: QuickTime movie -Duration: 00:06:36.30 -Pixel dimensions: 672x846 -Display aspect ratio: 112:141 -Scan type: Progressive scan -Frame rate: 60 fps -Streams: - #0: Video, H.264 (Main Profile level 3.2), 672x846 (DAR 112:141), 60 fps, 1213 kb/s - -> storyboard storyboard-0.1-walkthrough.mov -Processing storyboard-0.1-walkthrough.mov -Crunching metadata... -Trying to determine scan type... -Inspecting frame 40/40... -Generating main storyboard... -Extracting frame 16/16... -Generating thumbnail 16/16... -Tiling thumbnails... -Generating metadata sheet... -Computing SHA-1 digest... -57.7MiB 0:00:00 [ 571MiB/s] [=================================================================================>] 100% -Generating promotional banner... -Assembling pieces... - -storyboard saved to: /tmp/storyboard-se3fbiif.jpg - -``` - -Here's the actual image: - -![storyboard of ``storyboard-0.1-walkthrough.mov`` (1964x2694), generated with the default settings by `storyboard 0.1`](https://i.imgur.com/c3E3M8R.jpg) - -Credit to `lolcat` for making my storyboard colorful. diff --git a/source/blog/2015-05-19-bash-the-special-slash-character-in-filename-expansion.md b/source/blog/2015-05-19-bash-the-special-slash-character-in-filename-expansion.md deleted file mode 100644 index a30c220f..00000000 --- a/source/blog/2015-05-19-bash-the-special-slash-character-in-filename-expansion.md +++ /dev/null @@ -1,41 +0,0 @@ ---- -title: "Bash: the special slash character in filename expansion" -date: 2015-05-19T18:33:51-07:00 -date_display: May 19, 2015 ---- - -It is well-known and common sense that the slash character (`/`) serves a special role in Bash filename expansion. For instance, the asterisk `*` certainly won't match `/` or `.` when used in filename expansion; otherwise, a standalone `*` would match everything in the filesystem. - -However, it is less clear how a literal slash character[^expansion] is treated in extended glob patterns. Naively one would expect it to just match a literal slash, but the real situtation is more complicated than that. Consider the following examples: - -[^expansion]: Here, "a literal slash character" also applies to one that comes from tilde expansion, parameter expansion or command substitution, since they are performed before filename expansion in Bash. - -```bash -bash-4.3$ shopt -s extglob nullglob -bash-4.3$ echo /usr/@(bin|lib) -/usr/bin /usr/lib -bash-4.3$ echo /usr@(/bin|/lib) - -bash-4.3$ [[ /usr/bin == /usr@(/bin|/lib) ]] && echo matching -matching -``` - -As seen from this example, patterns with slash simply doesn't work (in filename expansion) when placed in an extended glob pattern list, and there's no error whatsoever. I looked up the [Bash Reference Manual](https://www.gnu.org/software/bash/manual/html_node/Pattern-Matching.html#Pattern-Matching) and the [Bash Guide](http://mywiki.wooledge.org/BashGuide/Patterns) but neither mentioned this behavior. One might need to delve into the source code to say for sure what exactly is going on. - -In comparison, Zsh and its [docs](http://zsh.sourceforge.net/Doc/Release/Expansion.html#Filename-Generation) are much more up front about this issue: - -> Note that grouping cannot extend over multiple directories: it is an error to have a ‘/’ within a group (this only applies for patterns used in filename generation). ... - -And when we run equivalent code in Zsh: - -```zsh -zsh-5.0.5$ setopt NULL_GLOB -zsh-5.0.5$ echo /usr/(bin|lib) -/usr/bin /usr/lib -zsh-5.0.5$ echo /usr(/bin|/lib) -zsh: bad pattern: /usr(/bin|/lib) -zsh-5.0.5$ [[ /usr/bin == /usr(/bin|/lib) ]] && echo matching -matching -``` - -The lesson? Be careful not to use a pattern like `@(path1|path2|path3)` in Bash when the paths are absolute, or relative but contain the slash. Unlike Zsh, Bash just silently fails on a pattern like this, which is rather dangerous in scripts. diff --git a/source/blog/2015-05-22-using-a-command-table-as-wallpaper.md b/source/blog/2015-05-22-using-a-command-table-as-wallpaper.md deleted file mode 100644 index 7e3e6fcc..00000000 --- a/source/blog/2015-05-22-using-a-command-table-as-wallpaper.md +++ /dev/null @@ -1,161 +0,0 @@ ---- -title: "Using a command table as wallpaper" -date: 2015-05-22T00:48:19-07:00 -date_display: May 22, 2015 ---- - -Recently I cleaned up my source code directory, removed a lot of rarely-used, dated scripts, and grouped the remaining standalone scripts into a central place (`~/dev/scripts`)[^dev]. One thing I learned in this process is that I tend to write a reusable script but rarely actually reuse it (even if it sits on `PATH`), sometimes implementing the same functionality twice or typing a long command line over and over again. - -[^dev]: The `~/dev` directory stands for development, and contains all my source code and almost all local builds. The point is by having a `~/dev` directory, I no longer need to have `bin`, `include`, `lib`, and `share` in my `HOME`, thus saving a few slots. Backing up and restoring is also slightly easier. - -To remind myself of which scripts are at my fingertip, I decided to use a command table as wallpaper on my secondary display. So I wrote a shitty Python script[^shitty] (depending on XeLaTeX and ImageMagick) to automate the generation of such a wallpaper. It's pretty customizable, and anyone may grab it and do whatever they want to with it (also [available as a gist](https://gist.github.com/zmwangx/b06aa923abf061b33fc9)): - -[^shitty]: Yeah, I know it's a shitty script, so don't nitpick on style problems. - -```python -#!/usr/bin/env python3 - -"""Generate command table.""" - -import argparse -import os -import shlex -import subprocess -import sys -import tempfile - -# pylint: disable=wildcard-import,unused-wildcard-import - -from zmwangx.colorout import * - -DEFAULT_COLUMN_WIDTH = 120 -DEFAULT_FOREGROUND_COLOR = "white" -DEFAULT_BACKGROUND_COLOR = "black" -DEFAULT_FONT = "Consolas" -DEFAULT_BORDER = 20 -DEFAULT_DENSITY = 300 -DEFAULT_SIZE = "1280x800" - -HERE = os.path.dirname(os.path.realpath(sys.argv[0])) -XELATEX_PROGRAM = (r""" -\documentclass[varwidth=\maxdimen,border={border}pt]{{standalone}} -\usepackage{{color}} -\pagecolor{{{background}}} -\color{{{foreground}}} -\usepackage{{fontspec}} -\setmonofont{{{font}}} - -\begin{{document}} -\begin{{verbatim}} -{table} -\end{{verbatim}} -\end{{document}} -""") - -def text_table(**kwargs): - """Generate the text version of the table.""" - width = kwargs["width"] if "width" in kwargs else DEFAULT_COLUMN_WIDTH - directory = kwargs["directory"] if "directory" in kwargs else HERE - command_line = (r"find {directory} -maxdepth 1 -type f -perm -u=x -exec basename {{}} \; " - "| column -c {width} | expand".format( - directory=shlex.quote(directory), width=width)) - ccommand(command_line) - return subprocess.check_output(command_line, shell=True).decode("utf-8") - -def pdf_table(**kwargs): - """Generate the PDF version of the table. - - Returns 0 on success or 1 on failure. Generated PDF is "table.pdf" - in the current working directory. - - """ - border = kwargs["border"] if "border" in kwargs else DEFAULT_BORDER - foreground = kwargs["foreground"] if "foreground" in kwargs else DEFAULT_FOREGROUND_COLOR - background = kwargs["background"] if "background" in kwargs else DEFAULT_BACKGROUND_COLOR - font = kwargs["font"] if "font" in kwargs else DEFAULT_FONT - program = XELATEX_PROGRAM.format(table=text_table(**kwargs).strip(), - font=font, border=border, - foreground=foreground, background=background) - with open("table.tex", "w") as texfileobj: - texfileobj.write(program) - try: - ccommand("xelatex table.tex") - subprocess.check_call(["xelatex", "table.tex"], - stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) - return 0 - except subprocess.CalledProcessError: - cerror("xelatex failed on the following program:") - cerrnewline() - cerrwrite("default", program) - return 1 - -def png_table(**kwargs): - """Generate the PNG version of the table. - - Returns 0 on success or 1 on failure. Generated PNG is "table.png" - in the current working directory. - - """ - if pdf_table(**kwargs) == 1: - return 1 - density = kwargs["density"] if "density" in kwargs else DEFAULT_DENSITY - size = kwargs["size"] if "size" in kwargs else DEFAULT_SIZE - background = kwargs["background"] if "background" in kwargs else DEFAULT_BACKGROUND_COLOR - command_line = ("convert -density {density} table.pdf -resize {size} -size {size} " - "xc:{background} +swap -gravity center -composite table.png".format( - density=density, size=size, background=background)) - try: - ccommand(command_line) - subprocess.check_call(shlex.split(command_line)) - return 0 - except subprocess.CalledProcessError: - cerror("the following ImageMagick command failed:") - cerrprint("default", command_line) - return 1 - -def main(): - """CLI.""" - description = "Generate a PNG table of all executable commands in a directory." - parser = argparse.ArgumentParser(description=description) - parser.add_argument("--width", type=int, default=DEFAULT_COLUMN_WIDTH, - help="""line width, default is 120""") - parser.add_argument("--directory", - help="""directory containing executables, default is - the directory containing this command""") - parser.add_argument("--border", type=int, default=DEFAULT_BORDER, - help="""default is 20pt""") - parser.add_argument("--foreground", default=DEFAULT_FOREGROUND_COLOR, - help="""foreground color, default is white""") - parser.add_argument("--background", default=DEFAULT_BACKGROUND_COLOR, - help="""background color, default is black""") - parser.add_argument("--font", default=DEFAULT_FONT, - help="""default is Consolas""") - parser.add_argument("--density", default=DEFAULT_DENSITY, - help="""used for the -density argument of convert, - default is 300""") - parser.add_argument("--size", default=DEFAULT_SIZE, - help="""size of image, default is 1280x800""") - args = parser.parse_args() - kwargs = {k: v for (k, v) in args.__dict__.items() if v is not None} - - fd, tmpfilepath = tempfile.mkstemp(suffix=".png", prefix="table-") - os.close(fd) - with tempfile.TemporaryDirectory(prefix="table-") as working_directory: - os.chdir(working_directory) - if png_table(**kwargs) == 1: - cerror("execution failed") - os.remove(tmpfilepath) - else: - os.rename("table.png", tmpfilepath) - cprogress("saved to:") - print(tmpfilepath) - -if __name__ == "__main__": - main() -``` - -By the way, the `zmwangx.colorout` module is [here](https://github.com/zmwangx/pyzmwangx/blob/41b0bffaad9439888d68097a85c7aed594240283/zmwangx/colorout.py), just to ease the printing of progress and errors to tty. You may safely remove all the `ccommand`, `cerr*` and `cprogress` calls. - -Here is an example wallpaper reflecting my current `~/dev/scripts`: - -![Command table wallpaper for my secondary display (MBP 13'' builtin display).](https://i.imgur.com/mccQu1e.png) diff --git a/source/blog/2015-05-29-apples-customer-service-is-still-the-best-plus-an-authy-horror-story.md b/source/blog/2015-05-29-apples-customer-service-is-still-the-best-plus-an-authy-horror-story.md deleted file mode 100644 index 7d17f6bb..00000000 --- a/source/blog/2015-05-29-apples-customer-service-is-still-the-best-plus-an-authy-horror-story.md +++ /dev/null @@ -1,25 +0,0 @@ ---- -title: "Apple's customer service is still the best (plus an Authy horror story)" -date: 2015-05-29T20:40:05-07:00 -date_display: May 29, 2015 ---- - -Recently the mute switch (officially known as the Ring/Silent switch) on my little-more-than-half-a-year-old iPhone 6 Plus stopped working. It almost always bounced back to ON (ring) position upon turning, and even if I could keep it at the OFF position for five seconds, it would most likely bounce back when I thrust it into my pocket. I got bitten a few times — almost got heart attacks when the phone dinged loudly in class. Minor yet annoying problem. - -So I took my phone to the Genius Bar today, prepared to have it sent to a repair center[^repair-center] and get a loan in the mean time — basically, I was prepared for all sorts of trouble. But nope. I demoed the problem for three seconds, my agent explained to me in five seconds that the switch alone was hard to replace and took fifteen seconds to verify my warranty status (I suppose), then off he went to retrieve a brand new replacement for me. No questions asked about the little dent on my old phone or whatever. *So I ended up with a brand new phone in less than five minutes.* (Of course, redoing setup and restoring backup took much longer than that.) - -[^repair-center]: As I see no obvious way to replace the switch in store. My intuition was later confirmed. - -This is *the* customer service we should receive everywhere. Unfortunately, Apple seems to be one of the very few tech giants (or the only one?) that take customers seriously. Yeah, Apple sells products at a premium; but hey, they also live up to what one would expect from a premium product. - ---- - -By the way, my only gripe during the process wasn't with Apple; it's about setting up Authy on the new phone. I verified my phone number via SMS and signed into Authy. I entered my backup password, which must be correct since it came straight off 1Password. My Authenticator accounts were displayed (I didn't verify if they would produce TOTPs) but a weird error message along the line of "data is corrupted" was shown to me, asking me to verify my phone for a second time. Unsuspecting, I asked Authy to send me another SMS, and entered the code I got. Then boom! All of a sudden *all my Authenticator accounts were gone*, leaving me with merely an Authy dev and a Coinbase account, which were the only ones that use Authy's native auth system. My heart almost sank for a second; I could almost foresee hours going down the drain, recovering (dozens of) accounts and regenerating new keys for two-factor auth. - -That was before I immediately realized that all my secret keys were safe and sound in 1Password's database. In the past few months, AgileBits implemented TOTP support in both the iOS and OS X versions of 1Password. The day [OS X support came into stable 5.3](https://blog.agilebits.com/2015/04/06/1password-5-3-for-mac-the-bionic-edition-is-out/), I exported all my Authenticator secret keys from Authy to 1Password (with help from [this blog post](https://www.pommepause.com/2014/10/how-to-extract-your-totp-secrets-from-authy/)[^blog-post]). At that time I didn't expect 1Password would save my day later. Overall, the $50 (OS X) plus $17 (iOS) I spent on 1Password was my most worthwhile spend on software, ever. - -[^blog-post]: The first comment below that post is mine. - -The lesson to learn from my Authy horror story is that one should export and backup Authenticator secret keys from Authy before it's too late. Moreover, this one shitty experience with Authy is enough to keep me away from it for the ages to come, except for services that are Authy-specific, e.g., Coinbase[^bitcoin]. 1Password is the way to go, and with the addition of TOTP, it is one more step towards a truly one password experience. If you don't own 1Password yet, you should really get it, now. - -[^bitcoin]: I have a Coinbase account and probably around 0.01 BTC in my wallet, but I don't really use bitcoins. At the time I signed up for two-factor auth on Coinbase, Authy seemed to be only supported system; however, I just signed in again and it seems that Coinbase is now supporting Authenticator also. Whatever the case, Authy is practically dead for me. diff --git a/source/blog/2015-05-30-using-a-personal-helper-package-in-everyday-scripting.md b/source/blog/2015-05-30-using-a-personal-helper-package-in-everyday-scripting.md deleted file mode 100644 index ac69cc57..00000000 --- a/source/blog/2015-05-30-using-a-personal-helper-package-in-everyday-scripting.md +++ /dev/null @@ -1,28 +0,0 @@ ---- -title: "Using a personal helper package in everyday scripting" -date: 2015-05-30T22:48:57-07:00 -date_display: May 30, 2015 ---- - -Recently I've been scripting (mostly in Python) quite a bit, and noticed that some functionalities get copied over or reimplemented over and over again. Examples include reading configuration files (mostly JSON, INI, and YAML), printing progress information to tty in color, displaying progress bar, and so on. - -In light of this, I came up with the idea of keeping a pool of helper modules in a personal helper package. I'm unimaginative at naming things, so I just named my package `zmwangx`. It is [published on GitHub](https://github.com/zmwangx/pyzmwangx), and the API docs are published on [Read the Docs](https://pyzmwangx.readthedocs.org) for easy reference during scripting.[^doc] At the time of writing the following helper modules are available in the package: - -[^doc]: I'm pretty paranoid about documenting things. - -* `colorout -` colorized output to stdout and stderr, and much more. -* `config -` read and write config files of various common formats. -* `hash -` hash files in a memory-efficient manner. -* `humansize -` convert size in bytes to human readable string (IEC or SI). -* `humantime -` convert duration in seconds to human readable string. -* `infrastructure -` testing infrastructure. -* `pbar -` display progress bar for the progress of processing a file or stream. -* `urlgrep -` parse and match URLs from HTML documents. - -With a personalized helper package, scripting has never been more enjoyable. Here are just some of the benefits: - -* Stating the obvious: write once, use everywhere (without copy/paste); -* As always, factoring out small functional units make code more readable and easier to debug; and having a dedicated pool just for helper modules encourages one to think about factoring, *early*; -* Bug fixes and enhancements in the helper package are instantly effective accross the board. - -Of course, one cannot depend on such a package in a formally published package (say, one published to PyPI), so things like `tools.py` or whatever are still necessary from time to time. But for day-to-day scripting, having a personal helper package that is used accross the board is definitely a good idea. diff --git a/source/blog/2015-06-07-stackoverflow-review-system-is-completely-bs.md b/source/blog/2015-06-07-stackoverflow-review-system-is-completely-bs.md deleted file mode 100644 index 2ab4b18c..00000000 --- a/source/blog/2015-06-07-stackoverflow-review-system-is-completely-bs.md +++ /dev/null @@ -1,55 +0,0 @@ ---- -title: "StackOverflow review system is completely BS" -date: 2015-06-07T18:58:57-07:00 -date_display: June 7, 2015 ---- - -I just answered an interesting question about ZLE [on StackOverflow](http://stackoverflow.com/q/30699242/1944784), and in the process I also improved my own toolchain. For the record, the OP asked for tab completion to present working directory items (executable files and directories) on an empty command line, which led to the following widget: - -```zsh -# This widget inserts "./" to the buffer and list possible completions -# (executable files and directories in the present working directory) if the -# buffer is empty or only contains whitespace. -function complete_pwd_items_on_empty_buffer -{ - if [[ $BUFFER =~ ^[[:space:]]*$ ]]; then - BUFFER+="./" - CURSOR+=2 - zle list-choices - else - zle expand-or-complete - fi -} - -zle -N complete_pwd_items_on_empty_buffer -``` - -This is all good stuff. - -However, at some point a [security architect and mobile security engineer](https://stackoverflow.com/users/608639/jww) jumped in and made [the following comment](https://stackoverflow.com/questions/30699242/first-tab-completion-enhancement#comment49457640_30699242): - -> Stack Overflow is a site for programming and development questions. This question appears to be off-topic because it is not about programming or development. See [What topics can I ask about here](https://stackoverflow.com/help/on-topic) in the Help Center. Perhaps Super User or Unix & Linux Stack Exchange would be a better place to ask. Also see [Where do I post questions about Dev Ops](http://meta.stackexchange.com/q/134306)? - -Then the question was put on hold by several not-so-high-rep users as off-topic, and the reason given is - -> Questions about general computing hardware and software are off-topic for Stack Overflow unless they directly involve tools used primarily for programming. You may be able to get help on Super User. - -WTF. First, *programming ZLE widgets is programming.* Hell, I even gave chunks of Zsh code in the answer (and they saw that, because the stupid comment and its upvotes came after my answer was put up). If writing an interactive Android crapp in Java for your Samsung counts as programming, why is writing an interactive widget for my Z shell any inferior? Second, even if you want to follow what the Help Center says, this question clearly falls under - -> software tools commonly used by programmers. - -Maybe Zsh isn't used by those specific voters (I guess most of them are Windows lusers), but it has a very vibrant community, and it clearly rules. Maybe the specific voters don't realize that Zsh is a programming language; that alone shows how ignorant they are. - -However, these are just specific lusers. Why do I generalize and insist that "StackOverflow review system is completely BS"? Well, just look at the voters' stats; I searched for their involvement in the `zsh` tag, and here are the results: [1](https://stackoverflow.com/search?q=user:2422776+[zsh]), [2](https://stackoverflow.com/search?q=user:683218+[zsh]), [3](https://stackoverflow.com/search?q=user:608639+[zsh]), [4](https://stackoverflow.com/search?q=user:3836229+[zsh]), [5](https://stackoverflow.com/search?q=user:2772643+[zsh]). Unsurprisingly, nothing, except one guy has answered a question about ASCII art, which shouldn't be placed under `zsh` in the first place. While someone knowlegeable of Zsh doesn't necessarily need to ask or answer questions about Zsh on SO, this quick search does reveal that these voters, rather than following the `zsh` tag, just popped out of nowhere, probably from the review queues. In this case it's pretty obvious that they're going after a new user (the OP just registered). And that is one of the main problems with SO's review system that makes it highly questionable in many cases: - -**The review tasks are handed to people who have no knowledge of the topics,[^approved-edit] and these people just operate under assumptions (e.g., new users will ask off-topic questions.)[^new]** - -[^approved-edit]: This problem isn't limited to reviews; it also applies to, for instance, approved edits. My *tag edits* (with explanations) got rejected quite a few times because the reviewers clearly didn't understand the topic — e.g., some morons assume that command line problems equal Bash problems. - -[^new]: This is actually a good assumption, because this is the case at least 50% of the time from my limited experience. But one shouldn't operate under this assumption, especially if one doesn't understand the topic. - -The solution? I'm afraid *there's no solution as long as the system is in place*. Ideally one should skip questions from topics that they don't understand, but in reality people just do as they damned well please, whether because they are working toward a badge, or because they *think* they understand the topic but really don't, or because they are outright jerks. Also, there are tons of totally fucked-up questions lying in every corner of SO (like questions displaying such profound ignorance[^bad] that no one would answer due to embarrassment, or those despicable "I can has code" questions) that no one cares about cleaning up, but instead they chose to target this well-meaning question that generated a pretty useful answer. By the way, this is the kind of thing I see all the time. - -[^bad]: I think I asked quite a few stupid questions back in the days, and now I'm totally ashamed of them. Insterestingly, some of those questions are my highest voted ones and got me quite some reps (compared to my total rep — I'm by no means a high rep user). See [*Why I no longer contribute to StackOverflow*](http://michael.richter.name/blogs/why-i-no-longer-contribute-to-stackoverflow) for a thorough discussion of the broken rep system and its disastrous effects. - -I hope SO could abandon this questionable "review queue" practice altoghether. Let people who actually follow the tags do the reviewing and voting. Honestly, no one really cares about dangling low-quality questions anyway. diff --git a/source/blog/2015-06-08-apple-turns-its-homepage-into-a-wwdc-liveblog.md b/source/blog/2015-06-08-apple-turns-its-homepage-into-a-wwdc-liveblog.md deleted file mode 100644 index f881b027..00000000 --- a/source/blog/2015-06-08-apple-turns-its-homepage-into-a-wwdc-liveblog.md +++ /dev/null @@ -1,58 +0,0 @@ ---- -title: "Apple turns its homepage into a WWDC liveblog" -date: 2015-06-08T14:42:50-07:00 -date_display: June 8, 2015 ---- - - -WWDC is Apple's biggest event every year, and WWDC keynote always attracts tons of hype. Apple knows that. In the past years folks who can't (at work, in class, etc.) or don't want to watch the crappy live stream would follow the various WWDC liveblogs presented by tech sites like Gizmodo, TechCrunch, Ars Technica, etc. But this year the landscape has changed: Apple rolled its own card-based liveblog at [www.apple.com/live/2015-june-event](http://www.apple.com/live/2015-june-event/).[^stream] Not only that; during the keynote, Apple redirected its homepage to the liveblog page, so it effectively turned its homepage into a liveblog: - -[^stream]: The crappy live stream is still there, but thankfully you wouldn't see it if you're on a browser other than Safari. Just look the screenshot of the banner. - -```zsh -> curl -sSIL http://www.apple.com -HTTP/1.1 302 Moved Temporarily -Location: http://www.apple.com/live/ -Content-Length: 210 -Content-Type: text/html; charset=iso-8859-1 -Expires: Mon, 08 Jun 2015 19:16:41 GMT -Cache-Control: max-age=0, no-cache, no-store -Pragma: no-cache -Date: Mon, 08 Jun 2015 19:16:41 GMT -Connection: keep-alive -Server: Apache - -HTTP/1.1 301 Moved Permanently -Content-Length: 0 -Date: Mon, 08 Jun 2015 19:16:41 GMT -Connection: keep-alive -Server: Apache -Location: http://www.apple.com/live/2015-june-event/ - -HTTP/1.1 200 OK -Last-Modified: Mon, 08 Jun 2015 15:45:30 GMT -ETag: "0b7bcbfbd14c411e64e728ae4d644de7" -Content-Type: text/html -Cache-Control: max-age=298 -Date: Mon, 08 Jun 2015 19:16:41 GMT -Connection: keep-alive -Server: Apache -``` - -Of course, you miss a few jokes and random shots of Tim or Craig from the official liveblog, but hey, who don't like that official feel?[^official] - -[^official]: Yeah, I know some people don't; but those people are not likely to be Apple fans either. - -Here are a few screenshots of today's liveblog. Unfortunately I only know some entry level JS, so I wasn't able to capture the entire page, which uses dynamic DOM based on one's position in the page. - -![The banner on Chrome.](/img/20150608-wwdc-2015-banner.png) - -![Introducing OS X El Capitan, 960x981.](/img/20150608-wwdc-2015-liveblog-960x981.png) - -![A fuller experience: 1920x1080.](/img/20150608-wwdc-2015-liveblog-1920x1080.png) - -By the way, here are the full-page screenshots of [OS X 10.11 El Capitan](http://www.apple.com/osx/elcapitan-preview/) and [iOS 9](http://www.apple.com/ios/ios9-preview/) previews. `pageres` recently [cannot render web fonts](https://github.com/sindresorhus/pageres/issues/174), which is rather annoying, so I used [Full Page Screen Capture](https://github.com/mrcoles/full-page-screen-capture-chrome-extension) to capture the shots. I then resized to 50% to reduce filesizes a bit. - -![[OS X El Capitan](http://www.apple.com/osx/elcapitan-preview/)](/img/20150608-osx-el-capitan-preview-1920x1080-50%25.png) - -![[iOS 9](http://www.apple.com/ios/ios9-preview/)](/img/20150608-ios-9-preview-1920x1080-50%25.png) diff --git a/source/blog/2015-06-10-chrome-disappointment-the-shabby-and-boring-old-bookmark-system-from-stone-age-strikes-back.md b/source/blog/2015-06-10-chrome-disappointment-the-shabby-and-boring-old-bookmark-system-from-stone-age-strikes-back.md deleted file mode 100644 index f6cb4880..00000000 --- a/source/blog/2015-06-10-chrome-disappointment-the-shabby-and-boring-old-bookmark-system-from-stone-age-strikes-back.md +++ /dev/null @@ -1,55 +0,0 @@ ---- -title: "Chrome disappointment: the shabby and boring old bookmark system from Stone Age strikes back" -date: 2015-06-10T23:17:05-07:00 -date_display: June 10, 2015 ---- - -I just restarted my machine (in the process of planning a fresh OS re-install), and something in Chrome's UI immediately felt wrong. After a few moments I realized it was the star button (bookmark button) in the far right of the omnibox giving me the uneasy feeling — the old bookmark system is back. Broadcasting from stable channel, build 43.0.2357.124 on OS X. - -![What caught my immediate attention.](/img/20150610-omnibox-with-aged-star.png) - -![The heart sinking feeling when I saw this again.](/img/20150610-old-bookmark-manager.png) - -I went to flags and made sure "Enable the new bookmark app system" wasn't tempered with. It wasn't. Anyway, I changed it to "Enabled" and restarted Chrome. No go, still the old crap. So I Googled my way to [the announcement](https://productforums.google.com/forum/#!topic/chrome/mhIX5LB23As): - -> Hi Everyone, -> -> Our team is committed to improving Chrome’s bookmarks experience, but for the time being, we’ve decided to bring back the previous version. Our team will continue to explore other ways to improve the bookmarks experience. You’ll see the previous version of the bookmarks manager return to your Chrome browser shortly. -> -> For those of you who enjoyed using the new bookmarks manager, you can still keep the new experience by downloading the Bookmarks Manager extension from the Chrome Web Store. -> -> We appreciate hearing all of your thoughtful feedback. Feel free to leave us with any additional comments here in this thread. -> -> Best,<br> -> The Chrome team - -This is just very disappointing. My default browser changes a lot, but I've been tagging along with Opera for [almost the entirety of 2014](/blog/2014-12-14-the-google-chrome-comic-a-classic.html), so I've long been used to visual bookmarks. And honestly, it never felt weird or anything; I saw it as an improvement the first time I was introduced to the concept. - -I know, there's always a demographic that would fiercely resist any change; they would reject anything new at a glance (or after using for a second) and start moaning right away, disregarding all the new benefits here and there. There's also another demographic who not only have no taste in design at all, but would also actively seek to tear down any visual enhancement — 90s visual is enough for them for life, any more is unsolicited and insulting. When these two demographics meet[^overlap] and somehow make the developers retreat, the outcome is simple and sad: *we can never have nice things.* - -[^overlap]: There's actually a pretty big overlap between these two demographics. - -I'm not saying I'm 100% satisfied with Chrome's visual bookmarks. In fact far from that. For one thing, Google is really pretty bad at visual design.[^bar] Also, not being able to adjust tile size or toggle a list view is rather lame. However, whatever problems there are, the new system is at least 200% better than the old one (just look that the screenshots!).[^new] *The team should focus on making the new system better,* such as implementing the features I mentioned above, rather than throw it into the trash can and resurrect the old system from Stone Age. - -[^bar]: The giant blue search bar at the top is especially ridiculous. - -[^new]: I didn't bother to switch to an earlier build just to take a screenshot of the visual system, so unfortunately there's no comparison here. But anyone who's been there knows what I'm saying. - -I know, throwing things away is part of Google's philosophy. They usually toy with a wide range of ideas and discard the ones that people don't buy into. Not that I whole-heartedly agree with strategy, but to advance technology there has to be some Brownian motion out there, and Google usually listens to the market, which is fine. In this case, however, there's really nothing innovative about visual bookmarks, and I can't see how the new system could harm market share or anything either. In fact, it could only help, since except the anti-design demographic, who would choose the aged and boring layout from the old system?[^eyes] Moreover, people tend to ignore the fact that the new system is also functionally superior — it offers to - -* Learn and suggest folder for a new bookmark (which is often accurate); -* Create auto folders based on site or keyword; -* Allow arbitrary text data to be stored with each entry (e.g., a page-specific non-sensitive access code); -* One tap pop from assigned folder; - -and more. Those that resist everything new are simply blind. The team claim that they are listening to "thoughtful feedback"; well, can they tell "thoughtful feedback" from blind suspicion and denial about everything? And they do realize that feedback is heavily biased, as someone with positive experience (unless he is a hardcore fan) is unlikely to leave them a thank you message? I think it's pretty clear that the majority of users won't care either way[^grandma]; the majority of the rest was happy with the change; and the rest, comprising only a diminishingly small percentage, is what kept us from having nice things. - -[^eyes]: Unless one has hundreds of bookmarks in a single folder (which probably means some cleanup or refactoring is long overdue), the old layout is unlikely to be easier on the eyes or anything. - -[^grandma]: Well, grandmas have one more thing to learn, I guess... - -Even if one agrees with nothing from the last paragraph, one has to realize that randomly dropping a big change this way is just irresponsible.[^youtube] There were hurt feelings when the change was first introduced (not that I care about them), so don't change mind again three weeks later, hurting yet another camp. Whether it was a change for the good or the bad, admit it was done (admit you screwed up if you did) and focus on improving it. - -[^youtube]: In other news, Google dropped YouTube collections two weeks ago ([May 26, 2015](https://support.google.com/youtube/answer/6233832?hl=en)), causing another round of agony. Also, subscriptions were all over the place once more, just like Google's project landscape. - -End of rant, off to install the [Bookmark Manager extension](https://chrome.google.com/webstore/detail/bookmark-manager/gmlllbghnfkpflemihljekbapjopfjik). diff --git a/source/blog/2015-06-12-the-tip-of-the-iceberg.md b/source/blog/2015-06-12-the-tip-of-the-iceberg.md deleted file mode 100644 index c01e7cd1..00000000 --- a/source/blog/2015-06-12-the-tip-of-the-iceberg.md +++ /dev/null @@ -1,25 +0,0 @@ ---- -title: "The tip of the iceberg" -date: 2015-06-12T14:24:18-07:00 -date_display: June 12, 2015 ---- - -*__Disclaimer__: While this post might have been triggered by a [specific](https://twitter.com/search?q=%23distractinglysexy)[^not-shaming] campaign, I'm certainly not addressing any specific concern or siding with any party. I never bothered to learn enough about a specific campaign to form a judgement that I would stand by,[^judge] since I simply don't care. I'm writing this post because I'm just too tired to see them popping up in my feeds every once in a while.* - -*By the way, I'm not sure if I'm going to stand by this post when I wake up tomorrow morning. It will stay either way, though.* - ---- - -[^not-shaming]: In this case the campaign is too civilized to be called a shaming campaign. - -[^judge]: And I question if most shamers did. - -I have the impression that these days there's at least one public shaming campaign going on every week, justified by political correctness, and serving as a great outlet for school or workplace frustration accumulated during the week. And every now and then, a woman or man[^fem] is destroyed by such a campaign, although all she or he did was to make a somewhat flippant yet universally true,[^modernity] almost universally true, or at the very least, not-meant-to-be-offensive, remark. - -[^fem]: Note how I have to be distracted from writing to consider the wording that should have been subconscious, and eventually write in this style. - -[^modernity]: Sometimes a certain group of people seek to redefine certain concepts or terms so that truths stated with older concepts or terms in mind are no longer true. That's fine. But before you label someone as an asshole, you have to realize that while you are free to embrace *your* modernity, some (if not most) people are just not as radical or as concerned about your topic, and they are just holding on to the truths and values they were taught. - -On the face of it (e.g., retweet counts), you might be convinced that the world is seriously supportive of such campaigns. However, you have to realize that *the tens or even hundreds of thousands of campaigners are still just one tip of the iceberg called the society*. Behind every campaigner there are probably ten people holding opposite views, and one thousand who simply don't care either way[^i]. Since political correctness is involved, how many people would you expect to be outspoken about their true opinions? Most likely people are muted by the fear of being politically wrong and being pursued and destroyed, just like the poor guy at the center of the storm. Moreover, I'm afraid that some (if not most) campaigners are not really offended, but just joining what they see as a hilarious ride — they don't mind if a woman or man is destroyed along the way. You know, humans can be unintentionally cruel to people not worth being cruel to. This statement also applies to some of the shaming campaign targets, but *being unintentionally cruel doesn't automatically make them worth being cruel to*. - -[^i]: Yes, I'm among the one thousand. diff --git a/source/blog/2015-06-23-all-problems-solved.md b/source/blog/2015-06-23-all-problems-solved.md deleted file mode 100644 index e5df0eb4..00000000 --- a/source/blog/2015-06-23-all-problems-solved.md +++ /dev/null @@ -1,29 +0,0 @@ ---- -title: "All problems solved!?" -date: 2015-06-23T21:47:07-07:00 -date_display: June 23, 2015 ---- - -The project I've been working on intermittently over the past month, [`pyonedrive`](https://github.com/zmwangx/pyonedrive), a OneDrive API v1.0 API/CLI client, is now quite satisfactory in terms of its feature set[^1], so today I'm thinking about what I should work on next. Of course there's [a lot more I can do](https://github.com/zmwangx/pyonedrive/labels/enhancement), but what is done already encapsulates 95%+ of my daily usage; moreover, as everyone knows, refining an existing project is not as exciting as starting a new one and making something happen that is previously tedious or impossible. - -[^1]: In fact it already exceeded my original expectations — `pyonedrive` started out as a [bare bones batch uploader](https://github.com/zmwangx/pyonedrive/blob/4d21308545ec1462c3892b9ca25300042f1ccb81/README.rst). - -To my surprise, *I can't think of anything*. I now realized that I don't have many peculiar computing needs. I needed a storyboard generator which I couldn't find anywhere, [so I wrote one](https://github.com/zmwangx/storyboard), and got an [elegant FFprobe wrapper](https://storyboard.readthedocs.org/en/latest/metadata-cli.html) for free. I hated the crappy CLI shipped with [`python-onedrive`](https://github.com/mk-fg/python-onedrive)[^2] that constantly fails and dumps, so I [rolled my own](https://github.com/zmwangx/pyonedrive) around the new API. In the process of coding up these two things, I learned quite a bit of Python — the kind of things I would never learn by reading tutorials or references alone. Other than these two, I need to interact with a few Web services and scrape a few Web sites, which are easily taken care of in bash/zsh/python (node might better serve some, but they ain't broke, so why rewrite). I also need some other CLI tools but those have been solved by existing projects, probably started by people with similar needs. Some of them need some clean-up and feature boost, e.g., [`you-get`](https://github.com/soimort/you-get), but I'm not inclined to refactor or submit substantial PRs to other people's projects, so I usually just write my own wrappers to bypass their limitations.[^3] What else? Basically nothing. - -[^2]: I never bothered to look at the API. - -[^3]: E.g., for `you-get`, I wrote a wrapper with concurrency support and much more surrounding `you-get`'s `--url` option. (But honestly, for whatever reason, links provided by `flvcd.com` for Chinese video streaming sites are much better than those parsed by `you-get` in terms of download speed, so these days I almost use `flvcd.com`'s `BigRats` exclusively, except when it similarly can't pick up a reasonable speed, in which case I would grind with my `you-get` wrapper, which was designed exactly for grinding.) - -So I'm in a strange situation that I feel like writing software for fun and profit, but don't have anything exciting to lay my hands upon (other than improving existing things). Of course I could learn my next language, but language learning without real world usage is likely to be futile. For instance, I would like to learn some Go or Rust, but why do I need a compiled, C/C++ replacement these days, when scripting takes care of all my personal needs? Not clear. Maybe it's a good time to concentrate on the real important things in my career. - ---- - -Update: Whilst writing this post, I came up with a project after all. I always had the idea of keeping an encrypted journal — real encryption, not the fake "password protection" of DayOne.[^dayone] The journal should be decrypted — probably only into memory — upon entry (after securely typing in password), and each text/image object should be encrypted separately to ease syncing (so using an encrypted sparseimage won't work). - -In principle an Emacs package should be able to do this, but going forward Elisp is a pretty horrible choice of language for anything substantial (think of, for example, threading, which there is none). Therefore, I'm inclined to write this in ObjC/Swift with Cocoa. This will be my first attempt at Cocoa programming, and my first serious involvement with Xcode (other than CLT, of course) after quite a few years[^xcode]. Actually I've always been looking for an excuse to learn some Swift. - -Oops, am I falling into [prematurely announcing my plans](https://sivers.org/zipit)? Hopefully not. - -[^dayone]: And DayOne's Markdown engine sucks, among other limitations, like the ridiculous one-image-per-entry. - -[^xcode]: I used to use Xcode as a C++ IDE before I was introduced to the brave new world of command line wizardry. diff --git a/source/blog/2015-06-26-ios-9-searchable-settings.md b/source/blog/2015-06-26-ios-9-searchable-settings.md deleted file mode 100644 index 3a07e7d4..00000000 --- a/source/blog/2015-06-26-ios-9-searchable-settings.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -title: "iOS 9: searchable Settings" -date: 2015-06-26T23:59:28-07:00 -date_display: June 26, 2015 ---- - -Finally it's here. According to [MacRumors](http://www.macrumors.com/2015/06/26/hidden-features-in-ios-9-and-os-x-el-capitan/): - -> Apple's introduced a wide range of feature additions and minor tweaks in iOS 9 that make some very useful improvements to iOS. For example, there's now a Notification Center widget that displays the battery life of connected devices like the Apple Watch, and **there's a search bar in the Settings app that lets you find a specific setting very quickly.** - -Good to see [my wish](/blog/2015-05-06-searchable-settings-are-one-honking-great-idea-lets-do-more-of-those.html) granted. - -![A screenshot of iOS 9 Settings in action.](/img/20150627-macrumors-demo-ios9-searchable-settings.png) diff --git a/source/blog/2015-06-27-automatically-clean-up-previous-mobile-applications.md b/source/blog/2015-06-27-automatically-clean-up-previous-mobile-applications.md deleted file mode 100644 index e8e1dd14..00000000 --- a/source/blog/2015-06-27-automatically-clean-up-previous-mobile-applications.md +++ /dev/null @@ -1,123 +0,0 @@ ---- -title: 'Automatically clean up "Previous Mobile Applications"' -date: 2015-06-27T21:19:59-07:00 -date_display: June 27, 2015 ---- - -iTunes keeps a "Previous Mobile Applications" folder of questionable value, which always annoys me. It eats into disk space and wastes syncing/backup cycles and bandwidth; you can easily find horror stories online about [100GB+ PMA folders](http://forums.macrumors.com/threads/5-years-of-deleted-iphone-apps-accumulated-in-my-itunes-library.1781676/#post-19749496). The value? You might be able to roll back to an earlier version, or restore an app pulled from the App Store. Really? I never had that need in my life[^disclosure]; have you? Worst of all, there should be a periodic clean up option — just like how deleted mail are automatically purged after one month, but the option is missing. - -[^disclosure]: Full disclosure: unlike many people, I'm not very obsessed with my phone, and I only have about two dozen third-party apps. - -Therefore, I wrote a trivial Python script to do the periodic cleanup. Feel free to grab my script below (also available at <http://git.io/previous-mobile-applications>) to save a few minutes of hacking. It should be plugged into a daily or weekly or monthly cron job (or the equivalent), and it writes data to `~/.local/share/itunes/previous-mobile-applications.json` by default. To customize, just modify the global constants. - -```python -#!/usr/bin/env python3 - -"""Periodically clean up "Previous Mobile Applications" of iTunes.""" - -import arrow -import datetime -import json -import os -import sys - -OFFENDING_DIR = os.path.expanduser("~/Music/iTunes/iTunes Media/Mobile Applications/Previous Mobile Applications") -STORAGE_DIR = os.path.expanduser("~/.local/share/itunes") -STORAGE_FILE = os.path.join(STORAGE_DIR, "previous-mobile-applications.json") - -DELETE_AFTER = datetime.timedelta(days=7) - -def load_storage(): - """Load stored dictionary of seen apps from STORAGE_FILE. - - Returns - ------- - seen_app_dict : dict - Dictionary of (app_filename, first_seen_date) key-value pairs, - where app_filename is str, and last_seen_date is datetime.date. - - """ - os.makedirs(STORAGE_DIR, mode=0o700, exist_ok=True) - try: - with open(STORAGE_FILE, encoding="utf-8") as fp: - serializable_seen_app_dict = json.load(fp) - return {app_filename: arrow.get(serialized_first_seen_date).date() - for app_filename, serialized_first_seen_date in serializable_seen_app_dict.items()} - except OSError: - return {} - -def write_storage(seen_app_dict): - """Write the dictionary of seen apps to STORAGE_FILE. - - Parameters - ---------- - seen_app_dict : dict - See the return format of load_storage(). - - Returns - ------- - 0 or 1 - Return code indicating success or failure. - - """ - # convert datetime.time to str (ISO 8601) - serializable_seen_app_dict = {app_filename: first_seen_date.isoformat() - for app_filename, first_seen_date in seen_app_dict.items()} - os.makedirs(STORAGE_DIR, mode=0o700, exist_ok=True) - try: - with open(STORAGE_FILE, mode="w", encoding="utf-8") as fp: - json.dump(serializable_seen_app_dict, fp, indent=2, sort_keys=True) - return 0 - except OSError as err: - sys.stderr.write("error: failed to write to '%s': %s" % (STORAGE_FILE, str(err))) - return 1 - -def main(): - """Main. - - Returns - ------- - 0 or 1 - Return code indicating success or failure. - - """ - if not os.path.isdir(OFFENDING_DIR): - # good, you don't have that junk - return 0 - - today = datetime.date.today() - seen_app_dict = load_storage() - current_app_list = os.listdir(OFFENDING_DIR) - - # boot already disappeared apps - for app in [app for app in seen_app_dict if app not in current_app_list]: - seen_app_dict.pop(app) - - # add newly appeared apps - for app in [app for app in current_app_list if app not in seen_app_dict]: - seen_app_dict[app] = today - - # delete expired apps - returncode = 0 - newly_deleted_apps = [] - for app in seen_app_dict: - if today >= seen_app_dict[app] + DELETE_AFTER: - app_path = os.path.join(OFFENDING_DIR, app) - try: - os.remove(app_path) - newly_deleted_apps.append(app) - except OSError as err: - sys.stderr.write("error: failed to remove '%s': %s" % (app_path, str(err))) - returncode = 1 - - for app in newly_deleted_apps: - seen_app_dict.pop(app) - - # write data to disk - returncode |= write_storage(seen_app_dict) - - return returncode - -if __name__ == "__main__": - exit(main()) -``` diff --git a/source/blog/2015-06-29-dl-cmplnts-in-apple-news.md b/source/blog/2015-06-29-dl-cmplnts-in-apple-news.md deleted file mode 100644 index 0e2111da..00000000 --- a/source/blog/2015-06-29-dl-cmplnts-in-apple-news.md +++ /dev/null @@ -1,27 +0,0 @@ ---- -title: "dl? cmplnts? in Apple News" -date: 2015-06-29T23:14:42-07:00 -date_display: June 29, 2015 ---- - -I submitted this blog to Apple via [News Publisher](https://developer.apple.com/news-publisher/) a few days after the WWDC keynote, just to get a feel for the submission process. It was easy; basically I just needed to provide an [Atom 1.0](/atom.xml) or [RSS 2.0](/rss.xml) feed, both of which I already have anyway.[^care] I was told at the end of the submission process that my submission would be reviewed. - -[^care]: Of course my content isn't really optimized for the Apple News format, but why would I care. - -Just now, quite surprisingly, I got the acceptance email from News Publisher: - -![Acceptance email from News Publisher.](/img/20150629-news-publisher-acceptance-email.png) - -The link to my channel appears to be - -> <https://news.apple.com/TdEf82WUNSQeNOsvYyyu48Q> - -But at the time of writing, trying to open this page just turns up a "sorry, this item isn't available in Apple News". Not sure if the page hasn't been updated, or if I really need an iOS 9 device to access. My current guess is the former — there's no reason Apple won't provide a channel preview in good ol' HTML.[^guess] I don't have an iOS 9 device yet, so I don't know how well my content, especially preformatted code blocks, will fare in News. Either way I won't adjust my content, but it would be fun to see the capabilities of Apple's official "RSS reader". - -[^guess]: Or maybe they will only open up regular browser traffic after iOS 9 stable is released. - ---- - -*June 30, 2015 update:* The page has been updated, and now the message makes much more sense: - -![Apple News is coming soon. This channel or topic is only available in Apple News.](/img/20150630-dl-cmplnts-on-apple-news.png) diff --git a/source/blog/2015-07-15-zsh-save-stdout-stderr-and-return-value-of-command-to-different-variables-without-temp-file.md b/source/blog/2015-07-15-zsh-save-stdout-stderr-and-return-value-of-command-to-different-variables-without-temp-file.md deleted file mode 100644 index dbaae443..00000000 --- a/source/blog/2015-07-15-zsh-save-stdout-stderr-and-return-value-of-command-to-different-variables-without-temp-file.md +++ /dev/null @@ -1,34 +0,0 @@ ---- -title: "Zsh: save stdout, stderr, and return value of command to different variables (without temp file)" -date: 2015-07-15T09:21:47-07:00 -date_display: July 15, 2015 ---- - -This is something worth sharing. The idea was based on [this SO answer](http://stackoverflow.com/a/18086548/1944784), and I cooked up this particular implementation to remove potential race conditions, with input from Mathias Fredriksson[^1]. See [mafredri/zsh-async#1](https://github.com/mafredri/zsh-async/issues/1), and in particular [this comment](https://github.com/mafredri/zsh-async/issues/1#issuecomment-121468958) for explanation. - -```zsh -# The following construct evaluates "$@" and saves output on stdout in the -# parameter stdout, output on stderr in the parameter stderr, and return value -# in the parameter return. -# -# The idea was based on http://stackoverflow.com/a/18086548/1944784, but this -# implementation is completely race-condition-free. The implementation was -# refined during my exchange with Mathias Fredriksson @mafredri, in -# https://github.com/mafredri/zsh-async/issues/1. See mainly -# https://github.com/mafredri/zsh-async/issues/1#issuecomment-121468958, where -# the advantage of this implementation is explained. - -unset stdout stderr ret -eval " -$( - { - stdout=$(eval "$@") - ret=$? - typeset -p stdout ret - } 2> >(stderr=$(cat); typeset -p stderr) -)" -``` - -Also available as [a gist](https://gist.github.com/zmwangx/efababea6258cedea07a). - -[^1]: Mathias ([\@mafredri](https://github.com/mafredri)) is the author of the lovely [zsh-async](https://github.com/mafredri/zsh-async) library, and a maintainer of [sindresorhus/pure](https://github.com/sindresorhus/pure). He forever revolutionalized [my prompt](https://github.com/zmwangx/prezto/blob/master/modules/prompt/functions/prompt_zmwangx_setup). diff --git a/source/blog/2015-07-19-github-experimental-attachment-formats-pdf-docx-and-pptx.md b/source/blog/2015-07-19-github-experimental-attachment-formats-pdf-docx-and-pptx.md deleted file mode 100644 index 315c478c..00000000 --- a/source/blog/2015-07-19-github-experimental-attachment-formats-pdf-docx-and-pptx.md +++ /dev/null @@ -1,87 +0,0 @@ ---- -title: "GitHub experimental attachment formats: PDF, DOCX and PPTX!?!" -date: 2015-07-19T21:58:01-07:00 -date_display: July 19, 2015 ---- - -I was browsing [github/hub](https://github.com/github/hub), and noticed something funny in the issue tracker: - -> Attach more than just images: Now you can attach PDF, **Word**, and **PowerPoint** files to your comments on Issues and Pull Requests. This experimental feature is only available to some repositories.[^bold] - -[^bold]: Bold by me. - -!["Attach more than just images: Now you can attach PDF, Word, and PowerPoint files to your comments on Issues and Pull Requests." WOW, JUST WOW.](/img/20150719-github-attachment-new-formats.png) - -For a moment I wondered if today's April Fools', but apparently it isn't. Which makes me wonder: is GitHub expanding its customer base to grandparents? Or is this a heavily demanded feature on GitHub Enterprise by nontechnical managers and sales personnel? Attaching PDF to issues and PRs is already laughable enough; I just can't imagine any developer asking for Microsoft Office support. I mean, what should we do with those? Download those crap, wait ten minutes for Microsoft applications to launch, just to read a few pages of text? I know GitHub is expanding to designers by rolling out features like PSD diffing[^psd] and Large File Storage ([`git-lfs`](https://git-lfs.github.com/)) for assets, so is this feature also targeting nontechnical designers? Not sure. **At any rate, this "feature" is simply ridiculous.** - -[^psd]: That's not even new; PSD viewing and diffing support has been around [for a year](https://github.com/blog/1845-psd-viewing-diffing). - -GitHub has long been lacking good attachment support. Granted, one can dump files to gists and then link to them from issues, but that's a pain for most people (and not all people are aware of that). The lack of attachment support (other than images) is keeping some projects from hosting their issue trackers on GitHub, whose issue tracking system is otherwise extraodinary.[^compare] One notable example that I care about is [iTerm2](https://gitlab.com/gnachman/iterm2/issues), which asks users to attach the user preference plist and a gzipped debug log when opening a new bug. **Therefore, GitHub should improve their attachment support by accepting plain text files[^text], small gzips, common binary config file formats like binary Plist XML and so on that developers care about. But instead, they are working on... Microsoft Office???** - -[^compare]: At least compared to Bugzilla, Trac, (the user-facing part of) Jira and FogBugz, SourceForge, Google Code (now closed), BitBucket, Savannah, GitLab, etc. - -[^text]: Whether a file is plain text or binary is usually easy to check. Just look for the `NUL` character (`\000`). - -My attitude towards Microsoft Office (mostly Word) is best described in a gist/tutorial that I wrote more than a year ago: [*Markdown, LaTeX, etc.*](https://gist.github.com/zmwangx/9987772). The ["Tips for Microsoft Office users"](https://gist.github.com/zmwangx/9987772#tips-for-microsoft-office-users) section is quoted out in full at the end of this post. My feelings toward Microsoft, and by extension, Office, has softened quite a bit since I wrote that tutorial (in particular, unlimited OneDrive storage for Office 365 subscribers was a pretty good bribe), but every word in that section still applies to Microsoft Word. **It is just sad that so many people all around the globe are still stuck in this Microsoft hell, not knowing that they have been liberated, and that they could have been free all along. And this move by GitHub is definitely not helping.** - ---- - -**Appendix.** From my tutorial [*Markdown, LaTeX, etc.*](https://gist.github.com/zmwangx/9987772): - -> Tips for Microsoft Office users -> ------------------------------- -> 1. Stop using Microsoft Office, **RIGHT NOW**; -> 2. Do 1; -> 3. Do 2; -> 4. ...... -> -> <h3>Why I hate Microsoft Office</h3> -> 1. Microsoft Office is non-free, free both as in "free speech" and "free beer." -> -> 2. Microsoft Office is not only non-free, but also expensive. -> -> 3. `.docx` is proprietary format. Microsoft has full control over it (correct me if I'm wrong). Hopefully they at least released it as a standard, so vendor lock-in won't happen. However, Microsoft could change mind any time. -> -> 4. Most Microsoft Word documents are text documents. But they are not readable and editable at all with text editors (in principle you could read and edit XML, but seriously, who would bother to do that). **So why Microsoft Office when plain text is nice, elegant, efficient, fast, and free?** Even when you need some formatting, there are Markdown and other plain text, human readble, and open source formats. I really hate it when people send me docx or ask me to send docx. Why assume I have the crap proprietary software installed? You could at least save as PDF before sending to me. -> -> (PDF is another story. It started as proprietary, but was released free of charge a long time ago, and has since been made an open standard. There are a good number of great open source PDF generators, PDFLaTeX being one notable example. And after all, PDF and PostScript are intended for printers — they are not so easily made human readable without an interpreter, so using a proprietary format in this setting is reasonable.) -> -> You might argue that docx can be edited with LibreOffice, OpenOffice, etc. However, first of all, documents created by Microsoft Office are not always (always not) rendered the same in these Offices; 100% compatibility has never been achieved. If you choose to work with Microsoft Office documents, you either be cheap and worry about lock-out/lock-in/damage/permanent damage (people who love Microsoft Office are often not competent enough to do back-up right), or throw your money at Microsoft. And point is: **plain text is both free and reliable in the first place.** -> -> 5. Microsoft could change their pricing model at any time, just as Adobe did to their Creative Suite. They've already been exploring the subscription model via Office 365 for a while, which is $99.99 a year (home). In the future, Office might turn to subscription only, meaning that you would never have a full copy of your (already crappy) software that is guaranteed to work regardless of time, and that they could raise the subcription price at any time and drive you nuts instantly. (Microsoft recently released Office on iPad, which is already subscription only. Watch out for the trend.) -> -> 6. Forgot to highlight one major annoyance. As you already know, I hate Microsoft Office; however, as mentioned in 4, I'm forced to keep the crap installed and occasionally launch it (which takes something around ten minutes just to launch) thanks to other people who insist on Microsoft Office. Every single launch deepens the hatred. -> -> 7. (*05/04/2014* update) Apart from storage, transmission, and distribution, Microsoft Office — and word processors in general — are also bad for *writing*. To quote the [AsciiDoc official introduction](http://asciidoctor.org/docs/what-is-asciidoc/), the "Word processors, the real writer’s block" section, -> -> > When you are in the writing (i.e., [typing](http://blog.stoyanstefanov.com/writing-vs-typing/)) phase, you want the words to flow onto the screen with minimal distractions and interruptions. Flow, not just time, is essential. -> > -> > Most word processor excel at distracting you from writing. The result: *you write less* (ironic, huh?). -> > -> > In a word processor, before you can type the first word on a blank screen, you're forced to think about what font family you want, what font size you want, what lines spacing you want and so on. Once you do get going, auto-correct, spelling and grammar suggestions entice you to backtrack and lose your next thought. "Smart" quotes and auto-linking messes with the text as fast as you can enter it. If you paste text, it likely gets added to the document with a different font family, size and even color. -> > -> > **Undo. Undo. Undo!** -> > -> > Let's not even talk about inserting source code. The designers of word processors clearly did not. -> > -> > **Format. Format. Format!** -> > -> > After burning time fighting with its interface, you rightfully conclude that the word processor is trying to *sabotage* your writing process. -> > -> > **We *need* an easier way to write!** -> > -> > But how? -> -> It's kind of ironic to quote AsciiDoc in a document promoting Markdown, but at the very least, we are all against Word. This section is so well written that I can't resist the temptation to quote it out in full. Moreover, I actually typed it in myself to enjoy it to the fullest. -> -> 8. (*05/04/2014* update) By the way, there is more to quote against docx (and XML in general), this time from Linus Torvalds, in a [Google+ comment](https://plus.google.com/+LinusTorvalds/posts/X2XVf9Q7MfV): -> -> > no [sic], XML isn't even good for document markup. -> > -> > Use 'asciidoc' for document markup. Really. It's actually **readable** by humans, and easier to parse and way more flexible than XML. -> > -> > XML is crap. Really. There are no excuses. XML is nasty to parse for humans, and it's a disaster to parse even for computers. There's just no reason for that horrible crap to exist. -> -> If you don't believe in me, you certainly believe in Linus don't you, who is much better at this art than you and me. If you don't even believe in Linus, you are not my reader in mind anyway. -> -> 9. There are infinitely many other reasons to hate Microsoft Office, **which grabs money from the most basic workflow — text editing**. The reasons to hate Microsoft Office occur infinitely often in the decimal expansion of π. diff --git a/source/blog/2015-07-25-dl-cmplntss-web-doesnt-suck.md b/source/blog/2015-07-25-dl-cmplntss-web-doesnt-suck.md deleted file mode 100644 index 472aa67f..00000000 --- a/source/blog/2015-07-25-dl-cmplntss-web-doesnt-suck.md +++ /dev/null @@ -1,17 +0,0 @@ ---- -title: "dl? cmplnts?'s web doesn't suck" -date: 2015-07-25T11:31:54-07:00 -date_display: July 25, 2015 ---- - -I was reading [Les Orchard's *The Verge's web sucks*](http://blog.lmorchard.com/2015/07/22/the-verge-web-sucks/) just now, and inspired by his dignostics of his various daily reads, I also ran the performance meter on my very own blog. Fortunately, it doesn't suck[^firefox]: - -> 13 requests, 77.88 KB, 0.84s. - -Moreover, apart from a Google Analytics snippet and the occasional embedding with a `<script>` tag, this site is entirely static. - -[^firefox]: Diagnostics generated on Firefox Developer Edition 41.0a2. - -![HTTP requests upon visiting <https://zmwangx.github.io/> (commit [3af1eaf](https://github.com/zmwangx/zmwangx.github.io/tree/3af1eafde5afa9fbb4255135191d6d232cf81cee)).](/img/20150725-performance-of-my-blog-requests.png) - -![The breakdown.](/img/20150725-performance-of-my-blog-breakdown.png) diff --git a/source/blog/2015-07-30-the-sad-state-of-finder-on-el-capitan.md b/source/blog/2015-07-30-the-sad-state-of-finder-on-el-capitan.md deleted file mode 100644 index 4c5e4dec..00000000 --- a/source/blog/2015-07-30-the-sad-state-of-finder-on-el-capitan.md +++ /dev/null @@ -1,46 +0,0 @@ ---- -title: "The sad state of Finder on El Capitan" -date: 2015-07-30T23:59:09-07:00 -date_display: July 30, 2015 ---- - -I was listening to [Accidental Tech Podcast E128](http://atp.fm/episodes/128) today, which discussed the implications of Rootless (i.e. System Integrity Protection) at quite some length.[^1] Which stirred up my old worries about the Finder — I was briefly concerned about TotalFinder immediately after Rootless was announced in WWDC, but was quickly reassured and forgot that concern after learning that Homebrew (i.e. `/usr/local`) isn't affected, which attracted more of my attention. - -[^1]: It's interesting to listen to John Siracusa's take on the issue, by the way. I completely agree with him. - -Unfortunately, the concern is real. TotalFinder is dead on El Capitan: it has been monkey patching Finder.app all along, and that strategy apparently is killed by Rootless. BinaryAge has [announced](http://blog.binaryage.com/el-capitan-update/) that TotalFinder won't be ported to El Capitan. It's a done deal. - -This is actually not the first time I felt threatened as a TotalFinder fan[^2]. Back in 2013, when Finder tabs was announced for Mavericks, there were [hints from BinaryAge](http://discuss.binaryage.com/t/call-for-ideas-what-should-be-the-next-binaryage-product/243) that TotalFinder might be discontinued one day, because apparently Finder tabs is a "serious hit for our [BinaryAge's] business". However, it still survived all the way up till Yosemite. I had the hope that TotalFinder could die a peaceful, glorious death when Apple finally improved the stock Finder to a certain point; I didn't quite expect TotalFinder to die an abrupt death like this. - -[^2]: Well this time we're not really threatened; TotalFinder is just plain dead. Those "I run Snow Leopard and I won't upgrade" dudes are delusional, as I've pointed out more than once. - -Now that I think about it, my expectations for Finder isn't very high. Just provide the following and I'll be pretty happy: - -1. Auto-resize each column (one can already "Right Size All Columns Individually" through the right-click context menu from the column dividers — is it that hard or unreasonable to make that automatic?); -2. A way to quickly show and hide hidden files without leaving Finder; -3. Folders on top (when not sorting by kind) is a nice addition, but not a must; -4. Chrome-styled tab (instead of Safari-styled) would be a plus. - -Pretty simple, aren't they (except point 4, which won't happen in stock Finder for the forseeable future)? Especially point 1, which should be desirable for all users, power users and dummies alike. If TotalFinder (and the free alternative XtraFinder, for that matter) can do these just by monkey patching, then Apple with all the control and infinite resources definitely could do these. - -Anyway, complaints aren't going to get me anywhere. What's next? - -TotalFinder is dead. - -XtraFinder[^3] similarly monkey patches Finder, so it also won't work with Rootless enabled. The developer has no plan to drop its support though, and I've confirmed that so far the lastest version works well on El Capitan PB3 without Rootless, save for the auto-resize columns feature, which somehow has no effect. Hopefully it will be fixed. - -[^3]: [XtraFinder](http://www.trankynam.com/xtrafinder/) is free, and it comes from the developer of [aText](https://www.trankynam.com/atext/), so I have good feelings about it. However, its annoucements and discussions take place on [Facebook](https://www.facebook.com/XtraFinder), which makes it awfully unprofessional... - -The only other well-known Finder alternative is probably Path Finder, but being a standalone program[^4] priced at $39.95, it seems both too full-blown and too expensive. Also, the "Path Finder 7" and "Upgrade — $19.95" on [the project's home page](http://www.cocoatech.com/pathfinder/) aren't reassuring; it's probably a $20 per year program.[^5] Moreover, even if I end up paying the money, I'm not even sure if it is going to be able to fully replace the experience around Finder. For instance, does the `open` command open directories in PathFinder? I highly doubt that. Not to mention my AppleScripts surrounding Finder. Heck, I just want a nicer Finder; why am I forced to a full (and probably not fully integrated) replacement. - -[^4]: From what I've heard. - -[^5]: Mind you, TotalFinder charges nothing except the initial $18 investment, despite a lot of rewrite for each major version of OS X. - -Besides, Path Finder's roadmap is pretty ridiculous. A guy asked "[Will Path Finder work with El Capitan?](http://support.cocoatech.com/discussions/problems/33611-will-path-finder-work-with-el-capitan)" on the support forum, and the reply was - -> Unfortunately, I cannot provide you with any information regarding this at the moment. We will let you know once there will be an official release of Mac OS X El Capitan. - -Seriously? That sounds so last decade. Which developer is so tight-lipped today? And who waits for the final OS release only to announce the support schedule? If they can't keep up with the schedule (or haven't evaluated the situation yet), at least they can communicate honestly with customers. This kind of uncertainty will only drive people away. Hard to believe this is the support you get for $40 plus upgrade fees. - -I don't know what I'll do in the end. Path Finder is probably not what I'm looking for, but maybe I'll give it a spin if they release an El Capitan ready version in time. Most likely though, I'll stick to stock Finder for a while, and if it turns out too painful, I'll just disable Rootless and sport a copy of XtraFinder. I don't think Rootless will be that useful for me anyway; I still believe it's game over once malware sneaks into my system, whatever privilege it claims. Whether Apple will further lock down the system in a future version is another story. diff --git a/source/blog/2015-08-02-sync-chrome-bookmarks-with-safari-on-os-x.md b/source/blog/2015-08-02-sync-chrome-bookmarks-with-safari-on-os-x.md deleted file mode 100644 index 5f00b3e2..00000000 --- a/source/blog/2015-08-02-sync-chrome-bookmarks-with-safari-on-os-x.md +++ /dev/null @@ -1,69 +0,0 @@ ---- -title: "Sync Chrome bookmarks with Safari on OS X" -date: 2015-08-02T22:11:56-07:00 -date_display: August 2, 2015 ---- - -**08/11/2015 Update:** I have taken down the project from GitHub since it's way too flaky. Guess I'll stick with manually clicking around then... - ---- - -**TL;DR**: [zmwangx/safari-sync-chrome-bookmarks](https://github.com/zmwangx/safari-sync-chrome-bookmarks) (now defunct; see update above). - ---- - -I've been reading quite a bit of stuff on my iPhone 6 Plus these days, especially since I got my Apple Watch (not quite sure why these two things are correlated, but they are). I used to read subscribed content in Feedly, but abandoned that a while ago since Feedly does an unbearably bad job at updating my one-subscriber feeds,^[I can understand that to reduce server load, they can't refresh the one-subscriber feeds at a rate, say, once per minute, but not being able to manually update, especially when you have a so-called "refresh" feature? Not cool. (What the manual "refresh" seems to do is to fetch Feedly's cached content.) Anyway, it's a freemium service with me running the free tier, so I can't really blame them.] e.g., Ars Premier feed, GitHub release feeds, etc. Ever since then, I've been rocking a local Leaf engine on my Mac but lost access on my phone,^[Which RSS reader/service I'll use next on iOS is a question; I haven't got time to compare the various options yet. So many readers, so many aggregation services!] and had to rely on bookmarks. - -However, as a Chrome user on the desktop and only on the desktop (iOS Chrome sucks), I have trouble getting my Chrome bookmarks into mobile Safari. Apple developed an [iCloud Bookmarks](https://chrome.google.com/webstore/detail/icloud-bookmarks/fkepacicchenbjecpbpbclokcabebhah?hl=en) extension for Chrome that allegedly syncs your bookmarks to iCloud^[And also one for Firefox, it seems], but upon installing the extension for Mac Chrome, an error message pops up: - -> The extension you are trying to install is designed to run on Windows 7 or 8. If you are using a Mac, your Safari bookmarks will automatically sync with your iPhone, iPad, and Mac when you sign in to iCloud on all your devices. - -The message is pretty clear: you have access to our browser, so you either use our browser or go fuck yourself. - -So, what's next? Fortunately, recent versions of Safari (I'm currently running 8.0.7) has an import feature that comes in handy and does a pretty good job: "File -> Import From -> Google Chrome..." which lets you import either history or bookmarks or both. Once they are imported into desktop Safari, iCloud is pretty good at pushing it to mobile. I have no problem importing both, but the idea that I'll have to launch Safari and click click click click just to sync my bookmarks is beyond horrible. - -Okay, remember we have another nightmare called AppleScript? And remember we have another nightmare within nightmare called GUI scripting? Yes, here's what we could do: - -```applescript -#!/usr/bin/osascript -tell application "Safari" to activate -delay 1 -tell application "System Events" - tell process "Safari" - tell menu bar 1 - tell menu bar item "File" - tell menu "File" - tell menu item "Import From" - tell menu "Import From" - click menu item "Google Chrome…" - delay 1 - keystroke return - end tell - end tell - end tell - end tell - end tell - end tell -end tell -delay 1 -tell application "Safari" to quit -``` - -Holy crap, look at that cascade.^[There's another annoyance: `"Google Chrome…"` cannot be replaced with `"Google Chrome..."`, or you won't ever find that menu item.] Anyway, in principle, this piece of crap works. In reality, well, it *sometimes* works. Because you know the nightmare called "assistive access", among other unreliabilities of poking around with system events: - -![Familiar?](/img/20150802-assistive-access-nightmare.png) - -On Yosemite at least, the pane to grant assistive access in System Preferences is three levels deep ("Security & Privacy -> Privacy -> Accessibility"), behind an admin password, and most unfortunately, there's no way to grant access to individual executables through that pane, unless you are explicitly prompted about one, which may not happen when it should.^[There might be a way round through poking with the system accessibility database as root; see [jacobsalmela/tccutil](https://github.com/jacobsalmela/tccutil). However, until I have time to carefully evaluate the code, I'll have to stay with System Preferences.] ^[Yes, I can understand the security concerns, but having to jump through so many hoops just to get some damned GUI scripting to work is awfully frustrating — and that's when you assume that the damned thing would just work after you jump through the hoops.] There's nothing I could do apart from granting access to both Terminal.app and iTerm.app and hope for the best. Not so surprisingly, just as demonstrated in my past encounters with GUI scripting, with access granted to the terminals, whether I'll get an "assitive access" error when running the script is completely hit-or-miss. This time it works, the next time it just stalls, and yet another time it emits the error... Oh god. - -In order to raise the rate of success, there's one other trick we could try: package the script into an Automator app. This way we can grant access to the standalone app, and that helps a bit. That's what I did in [zmwangx/safari-sync-chrome-bookmarks](https://github.com/zmwangx/safari-sync-chrome-bookmarks). It still occasionally get stuck, probably because I have a freaking slow spinning HDD and Safari would sometimes take forever to launch; but the accessibility problem does seem to go away (provided that you re-grant access every time you make the tiniest modification to the app). - -Now I can throw that into my crontab (launching Safari beforehand to avoid freezing up): - -```crontab -55 04 * * * open -g -a safari && sleep 30 && open -g -a safari-sync-chrome-bookmarks -``` - -or invoke on demand. - -Horrible solution, yes. Anything better? I would love to hear about it, but I highly doubt there's any, unless we directly work with `~/Library/Application Support/Google/Chrome/Default/Bookmarks` and `~/Library/Safari/Bookmarks.plist`. Probably a good problem -to tackle though, provided that someone would sit down and understand the formats of the two files. diff --git a/source/blog/2015-08-05-should-apple-split-up-itunes-on-os-x.md b/source/blog/2015-08-05-should-apple-split-up-itunes-on-os-x.md deleted file mode 100644 index d76413d0..00000000 --- a/source/blog/2015-08-05-should-apple-split-up-itunes-on-os-x.md +++ /dev/null @@ -1,23 +0,0 @@ ---- -title: "Should Apple split up iTunes on OS X?" -date: 2015-08-05T14:09:51-07:00 -date_display: August 5, 2015 ---- - -These days everyone seems to be talking about how complicated iTunes is and how Apple should give it a clean-sheet rewrite. This is not new, but the argument has certainly intensified ever since the introduction of iCloud Photo Library and Apple Music. For one recent example, see [Don't order the fish](http://www.marco.org/2015/07/26/dont-order-the-fish) by Marco Arment. I was listening to John Gruber's [The Talk Show episode 127](https://daringfireball.net/thetalkshow/2015/07/29/ep-127) earlier today (a little bit late to the game, yeah), and the complexity argument was brought up yet again. - -I just can't buy that argument. (Disclaimer: in this post I'm talking about UI/UX, not the backend.) Granted, there are many tabs in iTunes. There's one for music, one for movies, one for TV shows, one for podcasts, one for iOS apps, one for each iOS device currently connected via USB, and so on. You can hide some of them if you don't use them. And for each of these tabs there are probably subtabs, and occasionally a sidebar. This might sound rather intimidating to the faint-hearted, but if you really dive into iTunes, you'll find that 99% of the functionalities you'll ever need to find or organize your stuff are under four clicks away^[Just a rough estimate off the top of my head; please don't challenge me or hold me responsible.], and editing metadata (including batch editing) is pretty easy too. All in all, iTunes as it currently stands is both powerful (too many things on the plate, in some people's words) and not badly complicated, in the sense that you can certainly find your way around if you try. Some would argue that some of iTunes' features get shuffled into different places from version to version; yeah that's annoying, but in reality it usually takes less than five minutes to find all I need in a new version. - -For people who just buy their content from iTunes Store^[I'm actually increasingly inclined to this approach. Having lossless music shipped on CDs (sometimes with extra goodies) is nice, but having age-old CDs and goodies lying around, taking up space and gathering dust is less enjoyable.] and never organize again, there are probably too many unnecessary subtabs and sidebars, but hey, do they need to touch these controls at all? There's a search bar that works reasonably well accross the entire content library^["Reasonably well" at least on my not-so-large content library.]. For people who do organize their stuff, or do routinely import music and videos from outside, or do sync their devices via USB, most of those controls are great and necessary. - -One disclaimer, by the way: maybe Apple Music made things more confusing. I don't know because I didn't even sign up for the free trial. - -Now think about splitting up iTunes. As on iOS, you get a Music app, a Videos app, a Podcast app, an iTunes U app, and a separate iTunes Store app. Probably yet another one for managing your iOS devices, since that belongs to none of the above. So, what do you save by having all those apps? You save one click when you switch focus to another area? Well, not even that at times: now you need to switch apps. Moreover, what if I use several of those routinely (I do)? Do I have to keep all of them on my dock? Even if I don't keep them in Dock, as long as they're open they'll show up anyway, and that would be beyond horrible for people who care about their docks. This is my current dock: - -![My current Dock. Note that I have the old red iTunes icon from 12.1, because I really can't stand the white one from 12.2. I know that's the future in El Capitan and iOS 9 (it looks reasonable on iOS 9 by the way, I've been using public betas since day one), but I'll just be stubborn this time, without much real cost.](/img/20150805-my-current-dock.png) - -iTunes, where I playback music and manage my entire content library^[I should probably say "my entire content library visible to iOS" instead, since my non-ITMS, DRM-free videos are mostly not in iTunes. It certainly can't keep my Matroska videos anyway.], nicely takes up only one slot, which is the most reasonable thing to have. On iOS where apps can't have too many tabs or subtabs, it certainly makes sense to split the functionalities; on OS X where you do have space to host those tabs or subtabs, I fail to see how complexity warrants refactoring, especially when refactoring would introduce other problems.^[For instance, where should music videos live?] ^[By the way, Microsoft seems to have a split experience in Windows 10. Do people like it? The answer seems to be no.] - -Speaking of complexity, iTunes isn't even remotely as complex as, say, Microsoft Word or Adobe Photoshop. Those are of course nightmares to most people, but the point is that iTunes isn't a nightmare — it's pretty manageable, especially to power users and developers, who are the ones complaining most loudly. Also, nothing can beat the complexity of the web browser. We browse all kinds of web pages and use all kinds of web apps everyday, all inside the browser, which can hold arbitrarily many tabs with completely different UIs. We don't complain about the browser. Then why do we complain about iTunes, which is a consistent mix of essential functionalities across different areas of our multimedia experience? - -It's true that everyone has their iTunes pet peeves. For instance, I hate the stupid new icon and the useless Apple Music related tabs that I can't turn off in 12.2. The biggest gripe I have with 12.2 is probably the small, hardly noticeable rotating circle at the far upper-right corner of the window,^[Previously what would appear in that corner is the downloads icon, but anyone who has experienced both versions would tell you that the downloads icon is at least much more visible than the new rotating circle. The downloads icon was a dark gray blob, whereas the new thing is a few thin arcs.] which now hosts the progress indicators of certain IO operations such as downloads and copying files to devices. To me it's a step backwards. Previously downloads was in a separate popup window and file copying had a place in the central area, visible whichever app you are in, but now I have to look for the visual indicator and all of a sudden remember that oh, it has been moved to that remote corner; even then I have to keep focus on iTunes, or the progress indicator dropdown would disappear. It seems all random that the progress of device syncing (and any copy operations initiated as part of the sync) should be front and center, while manually copying files to apps should retreat to the corner. Nevertheless, these minor or not-so-minor annoyances (honestly annoyances exist in almost every app) doesn't justify an iOS-like approach, which has its own drawbacks. I would be really mad if one day I need to run multiple apps just to manage the stuff on my phone. diff --git a/source/blog/2015-08-05-switching-to-capitalized-commit-messages.md b/source/blog/2015-08-05-switching-to-capitalized-commit-messages.md deleted file mode 100644 index 5c4c75b5..00000000 --- a/source/blog/2015-08-05-switching-to-capitalized-commit-messages.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -title: "Switching to capitalized commit messages" -date: 2015-08-05T19:38:37-07:00 -date_display: August 5, 2015 ---- - -This post is a note to self. - -As a long time git user, I've always used lowercase commit messages (in the subject line). I never quite liked the idea of capitalized commit messages, which are seldom complete sentences (and they are never period-terminated). Similarly, I avoid capilatization like hell in comments, unless when I write complete sentences. By the way, there's a technical advantage of writing lowercase commit messages: I can easily tell my human-made commits from auto commits like merge and revert commits, because they always begin with a capitalized "Merge", "Revert", etc. - -However, most of the projects I've contributed to seem to prefer capitalized commit messages, and by following my own habit, quite often I would go through the "oh crap I messed up the contribution guidelines" realization and had to amend my commits after the fact. Also, when I open a single-commit pull request on GitHub, the subject line of the commit message automatically becomes the subject line of the pull request, and I want my pull requests to have capitalized subject lines. Perhaps I come off as self-contradictory here: lowercase commit message, but capitalized PR subject? I don't know. Maybe a PR subject is more like a real "title". Also, I blame the font: lowercase subject lines don't look remotely as good in, say, Helvetica (which GitHub currently uses for PR and commit message subject lines), as in a good fixed width font, which is what I get when I run any `git-log` variant in a terminal. - -Anyway, lowercase commit messages isn't a particularly strong preference of mine, so I'm happy to change my habit from this day onward. Anyone can feel free to tease me if they see me write a lowercase commit message again (unless its in the format `component: changes`). In light of this, I've already [changed the message format](https://github.com/zmwangx/zmwangx.github.io/commit/297225f2ab8a6db4fe75643f511f52499b052aa7) of `pyblog`'s auto commits, which is how I generate this blog. - -P.S. To be fair to me, *Pro Git*, the official git tutorial, [uses lowercase commit messages](https://github.com/progit/progit2/blob/6d9867ff2394cb8a08fa3e013b082a7ae547b8af/book/02-git-basics/sections/viewing-history.asc#viewing-the-commit-history) (I guess that's just the personal preference of Scott Chacon — not mandated by anyone). To be fair to the other side, [`git.git` mostly uses capitalized commit messages](https://github.com/git/git/commit/e83c5163316f89bfbde7d9ab23ca2e25604af290). diff --git a/source/blog/2015-08-13-other-peoples-___.md b/source/blog/2015-08-13-other-peoples-___.md deleted file mode 100644 index 8b848bdc..00000000 --- a/source/blog/2015-08-13-other-peoples-___.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -title: "Other people's ___" -date: 2015-08-13T02:00:24-07:00 -date_display: August 13, 2015 ---- - -Often enough we look at other people's ___ (fill in the blank here) and say wow, but more often than not when we actually get to lay our hands on it, we find it less than impressive or even super annoying, and end up having nothing to say but meh. For Zsh geeks, examples include other people's Zsh prompts<a href="https://github.com/chauncey-garrett/zsh-prompt-garrett" style="text-decoration: none">,</a> zsh-syntax-highlighting, and zsh-autosuggestions. diff --git a/source/blog/2015-08-14-laymen.md b/source/blog/2015-08-14-laymen.md deleted file mode 100644 index a8c4a6e8..00000000 --- a/source/blog/2015-08-14-laymen.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -title: "Laymen" -date: 2015-08-14T18:32:13-07:00 -date_display: August 14, 2015 ---- - -I always cringe when I see laymen discussing physics in comments sections of news websites. A typical situation: one commentator put together a sentence with all physics-sounding (kind of) terms he's ever heard of; the next commentator "agrees" with the previous one, adding something that sounds more reasonable (to folks who've never taken high school physics) but unfortunately violates the first law of thermodynamics; then yet another guy comes along and corrects both of the above in a pedagogic tone, with an argument that violates the second law of thermodymics... - -I cringe even more when laymen discuss mathematics, but that's much rarer compared to physics. - -Granted, mathematics (theoretical computer science included) and theoretical physics are probably the most abstract knowledge known to human beings, but I'm beginning to wonder if there are other professionals who would also cringe when I myself is discussing something outside my domain of expertise. Or when a better mathematician or physicist listens in on my baby talks with someone on the roughly same level. diff --git a/source/blog/2015-08-20-i-installed-blockparty-and-the-only-thing-i-can-say-is-wow.md b/source/blog/2015-08-20-i-installed-blockparty-and-the-only-thing-i-can-say-is-wow.md deleted file mode 100644 index e6c32e9c..00000000 --- a/source/blog/2015-08-20-i-installed-blockparty-and-the-only-thing-i-can-say-is-wow.md +++ /dev/null @@ -1,25 +0,0 @@ ---- -title: "I installed BlockParty, and the only thing I can say is WOW" -date: 2015-08-20T20:58:55-07:00 -date_display: August 20, 2015 ---- - -**09/18/2015 update.** Okay, [Peace has been pulled](http://www.marco.org/2015/09/18/just-doesnt-feel-good). Guess I'll keep using it for a while, though. - ---- - -**09/17/2015 update.** I'm now running [Marco Arment's](http://www.marco.org/2015/09/16/peace-content-blocker) [Peace](https://itunes.apple.com/us/app/peace-block-ads-trackers-powered/id1031035630?mt=8), powered by Ghostery. - ---- - -I just let out [a load of complaints about iOS 9 beta](/blog/2015-08-20-ios-9-turn-off-wi-fi-assist.html) last night, but apparently forgot about one nice thing: [Safari content blocking](https://developer.apple.com/videos/wwdc/2015/?id=511). - -In this day and age, not being iOS/OS X developers ourselves won't stop the rest of us from obtaining ObjC/Swift source code.[^1] I simply typed "Safari content blocker" into GitHub's search box, and there it popped, the most starred repo relevant to my search, [krishkumar/BlockParty](https://github.com/krishkumar/BlockParty). Thanks to Apple's new sideloading policy in Xcode 7, I was able to immediately test it out on my phone. - -[^1]: Actually developing a Safari content blocker extension is as easy as writing a JSON blocker list, but I'm not sure if you need an app with a UI to support the extension. Anyway, there are professional iOS developers out there ready to share the code, so I'll just happily join for a ride. - -The effect is just amazing. In my few minutes of browsing, I did not seem to encounter a single ad (on various consistently ad-laden news sites). You should definitely give it a shot. What's even more amazing is that BlockParty's [`blockList.json`](https://github.com/krishkumar/BlockParty/blob/master/RediffBlock/blockerList.json), at the time of writing, is only 1578 lines long — a JSON array with 197 objects. **Only 197 rules, blocking 197 domains.** Compare that to [EasyList](https://easylist-downloads.adblockplus.org/easylist.txt), which at the moment is a **48820 line monster**. Of course, EasyList is much more fine-grained ([as are AdBlockPlus's filtering mechanisms](https://adblockplus.org/blog/content-blocking-in-safari-9-and-ios-9-good-news-or-the-death-knell-of-ad-blocking-on-safari)); with BlockParty I can actually see some blank boxes that used to host ads. But still, very impressive. Many thanks to [\@krishkumar](https://github.com/krishkumar) for publishing BlockParty, and to [Justin Searls](https://medium.com/@searls/installing-a-content-blocker-on-ios-9-public-beta-a25b2b83848f) for publishing a detailed tutorial.[^2] - -[^2]: Without which I would have been scratching my head, not knowing that I had to go to Settings->General->Profiles to trust my personal profile. - -197 domains made our online lives so miserable. Hmm. diff --git a/source/blog/2015-08-20-ios-9-turn-off-wi-fi-assist.md b/source/blog/2015-08-20-ios-9-turn-off-wi-fi-assist.md deleted file mode 100644 index f317c53b..00000000 --- a/source/blog/2015-08-20-ios-9-turn-off-wi-fi-assist.md +++ /dev/null @@ -1,39 +0,0 @@ ---- -title: "iOS 9: turn off Wi-Fi Assist!" -date: 2015-08-20T01:01:57-07:00 -date_display: August 20, 2015 ---- - -Seriously. Go to Settings->Cellular, and scroll all the way down to reveal the "Wi-Fi Assist" switch. See screenshot at the end of the post. You'll see a description: - -> Automatically use cellular data when Wi-Fi connectivity is poor. - -Switch that off, if you occasionally have shitty Wi-Fi (that kinda works anyway) and at all care about your cellular data usage. - -I'll tell my horror story now. Background info: I have unlimited voice and text plus 300 MB data per month, since I've got Wi-Fi almost everywhere I go. Granted, school Wi-Fi (especially dorm) is shitty and drops all the time, but I'm not a streaming-music-on-mobile person, so the Wi-Fi is mostly fine for checking emails, browsing the Web (yes, even [iMore](http://murphyapps.co/blog/2015/6/24/an-hour-with-safari-content-blocker-in-ios-9) or [The Verge](http://blog.lmorchard.com/2015/07/22/the-verge-web-sucks/) kind of Web), getting push notifications, or even downloading a few podcasts on the go. I usually end up using less than 200 MB of cellular data per month. - -However, at the beginning of August (on iOS 9 Public Beta 2 at that time), I somehow managed to burn through 200 MB in four or five days, with consistent daily stats, *while I did nothing special, at least not actively*. The timing overlaps with when I got my Apple Watch; I don't know if that's a coincidence. Anyway, more than 90% of that usage was under System Services->Documents & Sync, which I could do nothing about. I had to turn off cellular data until almost the end of my billing cycle, when I stumbled upon the "Wi-Fi Assist" setting. Since then, I only used 4.8 MB — with 1.5 MB for System Services — in four days. Hardly a coincidence, I'd say. - -In fact, I was pretty delighted when I heard about the ability to auto fallback to LTE when one's on the fringe of Wi-Fi in [WWDC '15 Session 719](https://developer.apple.com/videos/wwdc/2015/?id=719) ("Your App and the Next Generation Networks"). However, without another likely suspect, I guess what happened in reality was that when I was sitting in the center of a shitty Wi-Fi, with the system trying to do some background job involving a network connection, it just kept trying to connect via LTE, which probably beat the shitty Wi-Fi consistently. It would be nice if one day our phones would be aware of our data plans (realize that not every one is on a $100/mo 15 GB plan) and throttle its usage wisely. - -Anyway, I simply can't understand why the "Wi-Fi Assist" switch, a general system-wide option, appears at the end of Cellular settings, after all the per-app nickel-and-dime settings and statistics. It's nearly impossible to find. Generic settings should be at the top, period. - -By the way, I have a lot of gripes about iOS 9 Beta. Maybe I shouldn't whine about beta software — I never used another iOS beta before so maybe they were even worse — but I can't help it because this was supposed to be a stability release. Several things immediately jumped to my mind (all present in the latest Public Beta 3), without even trying: - -* [Searchable settings](/blog/2015-06-26-ios-9-searchable-settings.html) is a scam. Many items can't be found. For instance, good luck searching for "Wi-Fi Assist". I wonder if the search index is hand-crafted. Also, you can't pull down to search from any screen; you have to go back, back, back, back to the main settings screen, and even then it begins with your last search, even if you're done with it. Ewww. - -* Scrolling and switching screens feels janky (system-wide) even on iPhone 6 Plus, supposedly a powerhouse. - -* The Music app is indeed totally screwed up (this actually dates back to iOS 8.4). It's so much harder than previous versions. - - Dude, give me my old UI with selectable categories on the bottom bar if I've turned off Apple Music, okay? Do I have to put up with the Radio and Connect tabs, completely useless for me? Switching categories — by which I mean artists, albums, songs genres, etc. — is infinitely harder now, because you have to scroll all the way up to the top of a category in order to reveal the category selector, which has a dropdown arrow outside but isn't really a dropdown. - - And may I go straight to the artwork and playback control screen when I tap to play a song? Damn, when I select and play a song of course I want see the song front and center; don't treat me like an indecisive guy. - - And may I kindly request that the artwork does not protrude to the status bar — you do realize some artworks have white or light backgrounds, rendering the status bar unreadable? - - Recently I also noticed that all my old iTunes purchases are showing up and screwing my library. There used to be a switch in System Preferences, the right place for this kind of settings on iOS, but it's since be removed in favor of Apple Music stuff (not sure why they are mutually exclusive), and strangely put in the category switcher. Hell, this abomination is even documented in ["Using the new Music app"](https://support.apple.com/en-us/HT204951); here's [Apple's official screenshot](https://i.imgur.com/RJKLqPo.jpg) showing off the stupid category switcher. For me without Apple Music, the switch says "Show iTunes Purchases" instead of "Show Music Available Offline". Pretty clear, huh, not bad. But don't bother, it does absolutely nothing for me. - -I could go on and on and on, but I don't want to waste more time on this crap. The gist is that I'm not impressed by iOS 9 at all at the moment (oh, one thing positive: San Francisco is nice). Hopefully the final release would be in much better shape; but I don't see any hope for the Music mess — it's not likely to be cleaned up any time soon. I mourn for the old Music app, which is likely gone forever. - -![The "Wi-Fi Assist" switch, hidden below per-app settings.](/img/20150819-ios9-wifi-assist.png) diff --git a/source/blog/2015-08-25-automated-os-x-provisioning.md b/source/blog/2015-08-25-automated-os-x-provisioning.md deleted file mode 100644 index 51a93a63..00000000 --- a/source/blog/2015-08-25-automated-os-x-provisioning.md +++ /dev/null @@ -1,21 +0,0 @@ ---- -title: "Automated OS X provisioning" -date: 2015-08-25T08:16:44-07:00 -date_display: August 25, 2015 ---- - -After quite a bit of work, I finally have a decent OS X provisioning system, capable of provisioning a blank OS X install (with Xcode and CLT) for development and everyday life. - -Here it is: [`zmwangx/dotfiles/provision`](https://github.com/zmwangx/dotfiles/blob/master/provision). In case the path changes in the future and invalidates the aforementioned URL, [here](https://github.com/zmwangx/dotfiles/blob/d8e20b731583d69b380d422c8788f61cd4a4e211/provision) is the archived provisioning script at the current master. Of course the provisioning system is not a single script; it reads and executes modules from a [`provision.d`](https://github.com/zmwangx/dotfiles/tree/master/provision.d) directory, which in turn links into other specialized parts of the system. - -Selling points: - -* Highly modular due to the `provision.d` structure. New provisioning scripts for specialized tools can be added at any time without complicating the rest of the system. - -* Graceful failure and easy error recovery. For most failures, running the provision once more fixes the issues. This is especially helpful when GitHub get DDoS'ed and loads of downloads fail, e.g., [last night](https://web.archive.org/web/20150825150044/https://status.github.com/messages), when I was sleeping with the provisioning system hard at work. - -* Very nice, colored console messages. Of course you'd expect that when half of the code is devoted to messaging... - -Thus far tested on OS X 10.10 and 10.11. Works pretty well. Of course OS X provisioning (with so many impossible-to-automate tasks) is still a hell lot harder than Linux provisioning, but hopefully this system will safe me a considerable amount of time and trouble during my at-least-twice-a-year clean OS installation and beta testing in VMs. - -![`provision` at work. Provisioning a blank machine is probably the only time I need Terminal.app.](/img/20150825-osx-provisioning-system.png) diff --git a/source/blog/2015-08-31-after-all-these-years-10pt-non-anti-aliased-monaco-is-still-the-best.md b/source/blog/2015-08-31-after-all-these-years-10pt-non-anti-aliased-monaco-is-still-the-best.md deleted file mode 100644 index 2d5a74f9..00000000 --- a/source/blog/2015-08-31-after-all-these-years-10pt-non-anti-aliased-monaco-is-still-the-best.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -title: "After all these years, 10pt non-anti-aliased Monaco is still the best" -date: 2015-08-31T06:31:03+08:00 -date_display: August 31, 2015 ---- - -Ars Technica [just ran a piece](http://arstechnica.com/information-technology/2015/08/open-source-typeface-hack-brings-design-to-source-code/) on the open source programming font [Hack](https://github.com/chrissimpkins/Hack). Now I don't really know why this is news-worthy (open source programming fonts aren't a new thing), but I thought I'd give it a try. - -The result is unsurprising. I've loved my 10pt non-anti-aliased Monaco for years, beginning with the Pro profile of Terminal.app. In fact, I initially refused to use iTerm2 precisely because I can't reproduce my beloved typeface in it, until I found out the non anti-aliasing trick. This time again, Hack simply can't compete with my favorite font; see the screenshots below. Among other things, it is way too thick for my liking — the same problem that haunts a whole range of programming fonts. Note that Hack is [supposed to](https://github.com/chrissimpkins/Hack#about) look good at 8px–12px according to its README, but I tested it at 9pt–12pt in iTerm2 (I know, pt is supposed to be larger than px, but I seriously doubt that anyone would want 8px or 6pt as their daily font size — and for that matter iTerm2 doesn't even allow me to go below 9pt, a pretty reasonable restriction, I'd say). - -By the way, it is worth pointing out that the very same Monaco looks horrible at 9pt or 11pt, anti-aliased or not (same goes for 10pt anti-aliased). 10pt non-anti-aliased Monaco is simply a miracle. - -**09/01/2015 update:** Looks like I was quite confused about pt and px, and they are to be used interchangeably in the current context. I suggest that anyone interested in this subject also read John Gruber's two very informative pieces from 2003, [*Anti-Aliasing*](http://daringfireball.net/2003/03/antialiasing.html) and [*Anti-Anti-Aliasing*](https://daringfireball.net/2003/03/anti-anti-aliasing). - -![Pro profile in Apple's Terminal.app, with 10pt non-anti-aliased Monaco. That says something about the font's quality, especially on a dark background.](/img/20150831-terminal-app-pro-profile.png) - -![10pt non-anti-aliased Monaco is life.](/img/20150831-monaco-10pt-non-antialiased.png) - -![Hack, anti-aliased, at 9pt, 10pt, 11pt and 12pt, respectively. Click to enlarge.](/img/20150831-hack-8,9,10,11pt-antialiased-combined.png) diff --git a/source/blog/2015-09-21-zsh-51-and-bracketed-paste.md b/source/blog/2015-09-21-zsh-51-and-bracketed-paste.md deleted file mode 100644 index 29180b20..00000000 --- a/source/blog/2015-09-21-zsh-51-and-bracketed-paste.md +++ /dev/null @@ -1,68 +0,0 @@ ---- -title: "Zsh 5.1 and bracketed paste" -date: 2015-09-21T14:40:36-07:00 -date_display: September 21, 2015 ---- - -**TL;DR.** Jump to [code](#code). - ---- - -In short, Zsh 5.1 introduced bracketed paste mode[^1] and turned it on by default (as it seems to me[^update]). It is nice in certain ways — I appreciate the change, yet I was bitten nevertheless. In at least two ways: - -1. Most annoyingly, `url-quote-magic` doesn't work anymore when pasting URLs, so for example if I paste - - https://www.google.com/search?q=zsh - - without typing in a single or double quote first, the `?` and `=` won't be backslash-quoted by default, which causes an error when passed unnoticed (out of habit). - -2. The Emacs shell[^2] is littered with `^[[?2004h` and `^[[?2004l` around every prompt. - -The solution? Zsh now also ships with [`bracketed-paste-magic`](https://github.com/zsh-users/zsh/blob/master/Functions/Zle/bracketed-paste-magic) that resolves exactly breakage #1 (and a bit more); to quote comments from the linked source file: - -> Starting with zsh-5.1, ZLE began to recognize the "bracketed paste" -capability of terminal emulators, that is, the sequences `$'\e[200~'` to -start a paste and `$'\e[201~'` to indicate the end of the pasted text. -Pastes are handled by the bracketed-paste widget and insert literally -into the editor buffer rather than being interpreted as keystrokes. -> -> This disables some common usages where the self-insert widget has been -replaced in order to accomplish some extra processing. An example is -the contributed url-quote-magic widget. The bracketed-paste-magic -widget replaces bracketed-paste with a wrapper that re-enables these -self-insert actions, and other actions as selected by the zstyles -described below. - -And to resolve breakage #2, just disable bracketed paste altogether for dumb terms. - -<p id="code">Putting it together:</p> - -```zsh -# turn off ZLE bracketed paste in dumb term -# otherwise turn on ZLE bracketed-paste-magic -if [[ $TERM == dumb ]]; then - unset zle_bracketed_paste -else - autoload -Uz bracketed-paste-magic - zle -N bracketed-paste bracketed-paste-magic -fi -``` - ---- - -<span id="update">**09/22/2015 update.**</span> I only read `NEWS` and not `README`, so I missed out on a very clear announcement of the [bracketed paste incompatibitilies (between 5.0.8 and 5.1)](https://github.com/zsh-users/zsh/blob/68405f31a043bdd5bf338eb06688ed3e1f740937/README#L38-L45): - -> The default behaviour when text is pasted into an X Windows terminal has -changed significantly (unless you are using a very old terminal emulator -that doesn't support this mode). Now, the new "bracketed paste mode" -treats all the pasted text as literal characters. This means, in -particular, that a newline is simply inserted as a visible newline; you -need to hit Return on the keyboard to execute the pasted text in one go. -See the description of `zle_bracketed_paste` in the `zshparams` manual for -more. "`unset zle_bracketed_paste`" restores the previous behaviour. - -[^1]: Bracketed paste mode is a safeguard against inadvertent interpretation of pasted text, e.g., newline being treated at `accept-line` in Zsh. You may read more about it [in this blog post](https://cirw.in/blog/bracketed-paste), which is somewhat outdated yet still informational. - -[^2]: I seldom use this dumb (literally) thing, but when I do I expect it to work ungarbled, naturally. - -[^update]: Indeed it is. See [update](#update) with more accurate info from official source. diff --git a/source/blog/2015-09-24-apple-watch-digital-crown-tightness-issue.md b/source/blog/2015-09-24-apple-watch-digital-crown-tightness-issue.md deleted file mode 100644 index 1dcf87da..00000000 --- a/source/blog/2015-09-24-apple-watch-digital-crown-tightness-issue.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -title: "Apple Watch: Digital Crown tightness issue" -date: 2015-09-24T10:55:38-07:00 -date_display: September 24, 2015 ---- - -Quick tip: if the Digital Crown on your Apple Watch *all of a sudden*[^sudden] feels too tight and doesn't turn smoothly, probably it was somehow over-turned (and probably because you played with watchOS 2 Time Travel, as I did). I don't know how that happened because it's clearly not supposed to happen, but turning it in the easy-to-turn direction for a few rounds fixed the tightness issue for me. - -There's also an [Apple Support document](https://support.apple.com/en-us/HT204639) on troubleshooting and cleaning the Digital Crown, if the above doesn't help. - -[^sudden]: Especially after upgrading to watchOS 2. Why in the hell could upgrading the software screw up the hardware? You'll see a possible cause if you read on. diff --git a/source/blog/2015-09-25-removing-google-analytics-from-this-blog.md b/source/blog/2015-09-25-removing-google-analytics-from-this-blog.md deleted file mode 100644 index bed5cf0e..00000000 --- a/source/blog/2015-09-25-removing-google-analytics-from-this-blog.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -title: "Removing Google Analytics from this blog" -date: 2015-09-25T12:30:25-07:00 -date_display: September 25, 2015 ---- - -There was a lengthy discussion about Peace and ad-blocking in [Accidental Tech Podcast Episode 136](http://atp.fm/episodes/136). There were many lessons to learn from the story; as a side effect, it also made me reconsider Google Analytics on this blog. - -I've been a user of ad-blocking for years and have little to no moral burden.[^1][^2] I do hate being tracked online, even by Google (to whom I entrust so much of my personal information), although it's certainly better (I believe) than the host of shadier ad networks out there. Given this, why should I force something even I hate down my visitors' throats? Google Analytics is nice at telling me how many page views I got and where they came from, and I don't earn any money from it so I shouldn't feel guilty, but (1) it does install a tracker, and (2) I care very little about traffic anyway. - -At this point the decision is pretty clear. I'm simply removing Google Analytics from this blog. This makes the blog entirely cookie-free and JS-free (except for the very occasional JS embed). - -[^1]: I do try to support websites I frequent, e.g., through [Ars Premier](https://arstechnica.com/subscriptions/). - -[^2]: Although it's easy to be a user of ad-blocking, I fully understand the moral (or even legal) burden of being the developer of an ad-blocker, let alone being the "face" of the ad-blocking industry; therefore, I understand and respect Marco's decision of pulling Peace. diff --git a/source/blog/2015-10-01-auto-hidden-menu-bar-dock-maximized-window-is-the-new-full-screen-mode.md b/source/blog/2015-10-01-auto-hidden-menu-bar-dock-maximized-window-is-the-new-full-screen-mode.md deleted file mode 100644 index e188ee5b..00000000 --- a/source/blog/2015-10-01-auto-hidden-menu-bar-dock-maximized-window-is-the-new-full-screen-mode.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -title: "Auto hidden menu bar & dock + maximized window is the new full screen mode" -date: 2015-10-01T15:48:59-07:00 -date_display: October 1, 2015 ---- - -One nice feature of OS X El Capitan is that the menu bar can be auto hidden. Combined an auto hidden dock, we can now emulate the full screen experience with a maximized window while still enjoying overlayed windows, e.g., transparent terminal windows or "Picture in Picture" style small floating player. To see how closely a full screen experience is emulated this way, see the side-by-side screenshots below. - -![Maximized and full screen windows of Google Chrome side by side. Can you tell any difference apart from the color of the title bar and a bit of black bottom margin on the left?](/img/20151001-maximized-window-vs-full-screen.png) - -I've always liked maximized windows much better than full screen windows. (Maybe this is part of the legacy from my early Windows days? Anyway, to Microsoft's credit, Windows *is* better in certain aspects, e.g., File Explorer. You see, I'm still fighting Finder to this day. Window maximization is also something that Windows does better, although I do like OS X's universal menu bar and hate the Windows menus that could appear in all kinds of surprising places.) There are legit reasons to perfer maximized windows over full screen. One obvious advantage is persistent window stacking, which has already been mentioned. Moreover, sometimes I need to temporarily bring up another app for a quick task, which is to say I need something like iOS 9's Slide Over — but on the desktop slide-over already comes for free with window overlay. In full screen mode, however, the second app will be opened in another desktop space with lavish animation of switching, and when I'm done I need to swipe back to the original space, again with lavish animation, instead of just ⌘H to hide. Do it several times in quick succession and it's a pretty nauseous experience (of course I'm exaggerating, but it's certainly neither comfortable nor productive). - -In short, maximized windows have always been great, and now they are getting even better. - -P.S. I personally don't have many informational moving parts in the menu bar. There's date time down to seconds, but I have an Apple Watch on my wrist, and I don't mind raising my wrist for a few seconds when I need the time. There's a battery icon which I certainly won't look at constantly — my MBP is plugged in most of the time. There's a Dropbox icon that would animate when it is syncing, which I don't care. Other than that, all icons are still. Therefore, I can totally do away with the menu bar until I really need it. diff --git a/source/blog/2015-10-01-upgrading-to-el-capitan.md b/source/blog/2015-10-01-upgrading-to-el-capitan.md deleted file mode 100644 index b1344c1a..00000000 --- a/source/blog/2015-10-01-upgrading-to-el-capitan.md +++ /dev/null @@ -1,31 +0,0 @@ ---- -title: "Upgrading to El Capitan" -date: 2015-10-01T11:46:44-07:00 -date_display: October 1, 2015 ---- - -I upgraded to El Capitan last night, and the experience is pretty painless. To be accurate, I'm not really upgrading in place — I always perform a clean install for each major OS upgrade to avoid subtle breakage later on. Therefore, what I did instead was to `rsync` out all my valuable data and state information[^state] to an external drive, wipe the internal drive clean, install new OS from scratch, then `rsync` everything back in. `rsync` is really good at this stuff (I affectionately alias `rsync -avP` to `r` during transfers in and out), and it is simply amazing at dropping the right stuff at the right place, including data deep down `~/Library/Containers`, without interfering with the existing structures[^existing]. With data and state info ready, reinstalling programs is also easy, thanks to my recently finished [automated provisioning system](/blog/2015-08-25-automated-os-x-provisioning.html). It was the first time I used it outside a VM to provision an OS from almost scratch, and I'm really happy with it. - -Thus far, most of my programs and applications seem to work just fine on El Capitan. I needed to `brew reinstall pyenv --HEAD` because an OpenSSL fix for El Capitan hasn't made into a release yet. Some of XtraFinder's features[^rootless], including my most needed auto resizing columns, don't seem to work on El Capitan yet, and I'll have to contact the developer soon. The only distratrous incompatibility I've seen lies with Mathematica 9; `codesign -vvvv Mathematica.app` on the v9.0.1 app bundle says `resource envelope is obsolete (version 1 signature)`, and OS X downright refused to open the app, offering me no option other than trashing the app, even when I temporarily set Gatekeeper to "Any". Anyway, I quickly paid to upgrade to v10.2.0 (cost of free OS upgrade, geez), and it ran happily afterwards. Those were basically all I had to deal with. I haven't set up my mail accounts[^mail] and printer yet, but hopefully they will work, and just hopefully Apple Mail finally got it right this time™ and won't ask me to reauthenticate with Gmail all the time. - -Overall it was pretty good experience. Nevertheless, I was caught by surprise at least twice, due to subtle user-facing changes in the OS. Actually these surprises motivated me to write this post. - -First, <u>the OS seems to default to using the iCloud password (i.e., the Apple ID password) as the local account password now.</u> Maybe I missed a checkbox during setup (unlikely), and maybe it was nothing new (I don't think so), but I only realized this when I needed to `sudo` on the new OS for the first time. I typed my usual local password thrice, no luck. Did I accidentally gave my 1Password master password? Thrice, no luck. Did I accidentally used Vagrant's default password (i.e., `vagrant`, however unlikely)? This one is short enough and I didn't need to type it thrice to realize it was wrong — I knew that all along anyway. Did I... No, I couldn't have used anything else (literally ten minutes ago) without remembering it. I was completely horror-struck at that point, but speaking of remembering, I didn't even remember giving a password hint! So could it be... Yes, I typed in my 32 character long iCloud password, and this time it was right. I quickly realized after the fact that this setting could be toggled in the standard System Preferences -> Users & Groups -> Change Password... (see screenshot below), so if you are in this situation, don't panic. I don't like this move though. Hopefully Apple won't degrade to Microsoft's level at some future point, where you either sign in with a Microsoft account (and have to type your Microsoft password to log in) or miss out on cloud features with a local account. - -![Screenshot taken after I've changed to a local password. After initial setup, it would be the reverse.](/img/20151001-osx-el-capitan-icloud-password-to-log-in.png) - -Secondly, <u>three finger drag, a multitouch gesture that I use all the time to move windows on screen, is now mysteriously gone from System Preferences -> Trackpad</u> (it used to be in "Touch & Click"): - -![Where's my beloved three finger drag? By the way, since it is shown in this screenshot, I'll officially declare here that I'm a tap-to-click wizard.](/img/20151001-osx-el-capitan-wheres-my-three-finger-drag.png) - -Maybe Apple found it somewhat confusing with the three finger tap/click, which is clearly a different gesture. I found the solution in an Apple Support document, [Turn on "three finger drag" for your Force Touch trackpad](https://support.apple.com/en-us/HT204609), while my trackpad is clearly not Force Touch (the document was written for Yosemite, so clearly the reorganized settings started out on the MacBook One and newer Retina MacBook Pros in Yosemite and spreaded to all Macs in El Capitan). Anyway, the gesture could be turned on in System Preferences -> Accessibility -> Mouse & Trackpad Options... -> Enable dragging. That was godawful, no one could possibly find it, but hopefully it's hidden there because of the confusion rather than Apple intentionally phasing it out. - -![Oh, there it is!](/img/20151001-osx-el-capitan-three-finger-drag-there-it-is.png) - -[^state]: State information includes `~/.config` and `~/.local`, Google Chrome and Firefox profiles, Messages archive, Mathematica customizations, Unclutter notes, VMware Fusion inventory, various important plists, and so on and so forth. - -[^existing]: Unless you are stupid enough to specify the `--delete` flag when you transfer in. - -[^rootless]: As mentioned in [The sad state of Finder on El Capitan](/blog/2015-07-30-the-sad-state-of-finder-on-el-capitan.html), I've disabled SIP and am running XtraFinder. I simply can't live with the stock Finder, that is, without code injection. - -[^mail]: Setting up mail accounts is the most painful thing in the world, especially if you have a dozen of them for different tasks. diff --git a/source/blog/2015-10-03-we-need-an-os-x-security-white-paper.md b/source/blog/2015-10-03-we-need-an-os-x-security-white-paper.md deleted file mode 100644 index f9060440..00000000 --- a/source/blog/2015-10-03-we-need-an-os-x-security-white-paper.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -title: "We need an OS X security white paper" -date: 2015-10-03T03:34:24-07:00 -date_display: October 3, 2015 ---- - -Apple has been offering an excellent [iOS Security White Paper](https://www.apple.com/privacy/docs/iOS_Security_Guide.pdf) since at least 2012, and it's very informative. I highly encourage everyone to read it. It even explains some annoyances of iOS; for instance, [this week's Upgrade episode](http://www.relay.fm/upgrade/56) discussed, [in Gruber's words](https://daringfireball.net/linked/2015/10/01/upgrade-56), "the lousy, painstaking, and at times downright confusing experience of migrating to a new iOS device", and once you read the white paper you'll realize that many things just can't be migrated due to iOS's hardware security model — basically, certain classes of data are encrypted with crypto keys baked into the silicon (see the section "Hardware security features"). I'm not saying the migration experience should be this painful (I would love to see it fixed or improved), but at least there's an explanation.[^migration] - -But I digress. This post is about OS X. I've been hunting for an OS X equivalent for a while now, but I don't think it exists. And recently people are talking about Apple's [updated Privacy website](https://www.apple.com/privacy/)[^site], so I went there with a glimmer of hope. End result: no luck. In fact, Apple links to its iOS Security White Paper at the bottom of "[Our Approach to Privacy](https://www.apple.com/privacy/approach-to-privacy)": - -![iOS Security White Paper linked, but no OS X.](/img/20151003-ios-security-white-paper-but-no-osx.png) - -But there's little to no mention of OS X (the words "Mac" and "OS X" each appears only once on the page). This is not surprising; OS X as the second class citizen is nothing new, and iPhones and Apple Watches are arguably more intimate, and hence more private devices — at least for most people. It is somewhat disappointing though. - -I forgot to mention why I would like to see an OS X security white paper. The reason is simple: a lot of security features are under-explained. For instance, I might want to learn more about FileVault: why am I given the choice of decrypting my drive with iCloud — I believe it's not the case on iOS? How does iCloud handle my disk encryption key, if I allow it access (I don't)? Or I might want to learn more about System Integrity Protection: does it auto revert (or repair, in their eyes) some permissions (e.g., that of `/usr/local`), as I heard people talking about? Or maybe more about code signing and the inner workings of Gatekeeper: there's [recent news](http://arstechnica.com/security/2015/09/drop-dead-simple-exploit-completely-bypasses-macs-malware-gatekeeper/) of Gatekeeper workarounds. I guess some of these stuff can be found in Apple's support documents or developer documentation if you look hard enough, but it would be nice if the major security features and their implementations are presented coherently in a single document. Maybe the OS X security model is too complex and diverse to fit into a single document? I don't know. Anyway, I'll keep waiting. - -[^migration]: Loss of certain classes of protected data (due to hardward crypto keys) during migration should in principle only apply to migration by "restoration". What about providing a direct phone-to-phone migration, where data could be decrypted and transferred on the fly? But that would at least require a lightning male to lightning male cable (or you would have to entrust your most sensitive data, which shouldn't even leave the phone under normal conditions, to your Wi-Fi, something Apple probably wouldn't do), and having to use a different, and actually unheard-of cable isn't very realistic, so it won't be happening any time soon. - -[^site]: I haven't read through everything, but the idea of a [non-law-practicing-human readable privacy policy](https://www.apple.com/privacy/privacy-policy/) is great. diff --git a/source/blog/2015-10-10-printing-long-80-character-per-line-plain-text-document-in-two-columns.md b/source/blog/2015-10-10-printing-long-80-character-per-line-plain-text-document-in-two-columns.md deleted file mode 100644 index 1b71478a..00000000 --- a/source/blog/2015-10-10-printing-long-80-character-per-line-plain-text-document-in-two-columns.md +++ /dev/null @@ -1,30 +0,0 @@ ---- -title: "Printing long, 80-character-per-line plain text document in two columns" -date: 2015-10-10T22:35:15-07:00 -date_display: October 10, 2015 ---- - -**TL; DR**. Jump to [code](#code). - ---- - -Printing is hard. Everyone who has ever tried to set up a printer (especially a multifunction unit) will probably agree with me. There are also a million ways to be sabotaged by your printer, e.g., connection failure (over Wi-Fi), toner running low, manual duplex eating two sheets at once when printing the second side. (Do you believe I encountered all three tonight?) Anyway, let's just assume that you have a perfectly connected, perfectly functional printer, and talk about something even harder. - -We nerds read 80-character-per-line (or 72, but it's safer to assume longer) plain text documents all the time, or at least occasionally if we exclude source code. A plain text document is extremely versatile; it looks awesome in a text editor or in a browser window — with monospace typeface of your choice and infinite scrolling or arbitrary pagination. However, the problem is, sometimes we want to put things into print for easier reference, and we do *not* have infinite scrolling or arbitrary pagination in print. We want to divide things up into pieces that fit nicely onto 8.5'' by 11'' sheets, without ruining the original formatting of the plain text document. Therefore, some program has to decide the page layout and translate the plain text document into something a printer understands, e.g., PostScript. But since plain text is so versatile, there are a million ways to lay it out on paper. - -You would assume that this is a solved problem, since the digital publishing industry has been around for 40 years; and you would assume that this should be easy on a Mac because it is a great platform for "creative professionals". And indeed it's not hard if you just want to print one column of 80 characters. You can even do that in TextEdit, where you pick a plain text font and font size so that lines don't wrap, and there you go. If you are using a more capable GUI text editor like TextWrangler (I use Emacs all the time but I don't know about printing from Emacs), you are given more customization options like header and line numbers. However, 80 character lines look awful on a 8.5'' wide page. Characters are HUGE (to me anyway). Note that monospaced fonts usually look better when they are smaller (I'm a [10pt bitmap Monaco fan](/blog/2015-08-31-after-all-these-years-10pt-non-anti-aliased-monaco-is-still-the-best.html)), and do keep in mind that we are usually farther away from a computer screen than a piece of paper held in hand, so even "10pt" could look pretty big in print. Moreover, you most likely get the outlined version of your font in print rather than the bitmap version, which depending on your font of choice might not be a good thing, and the difference is amplified when characters are big. And above all, you waste a lot of paper this way, and create stapling problems for yourself when the document is long. In short, I don't find it a good solution. - -It would be much nicer if we could print in two columns. The characters will be pretty small so it's probably not very good for older people (or they could try two columns in landscape), but I'm still pretty young and have fairly good eyesight, so I like this idea. But turns out this is nontrivial with existing GUI programs, at least the ones that I know of. You could emulate the two-column layout by having four pages on one sheet, but it's really awkward because you get a page divider in each single column (waste of space), and page numbering would be all messed up. Other than that there's little you could do. I guess there's just not enough market for this particular need. Luckily we have a large selection of modular command line utilities that we can stitch together for great results. I'll cut the bullshit here and just show you the <span id="code">code</span> (for US letter): - -```bash -curl https://www.gnu.org/software/bash/manual/bash.txt \ - | pr --columns=2 --width=168 --length=120 --form-feed --date-format=%Y-%m-%d --header="Bash Reference Manual" - \ - | enscript --media=Letter --header= --font=Courier5.5 --margins=18:18:0:18 --output - \ - | ps2pdf - bash-print.pdf -``` - -Here, as an example, I'm printing the ASCII text version of the Bash Reference Manual. `pr` ships with `coreutils` (OS X also ships with the BSD version of `pr`, but geez, I'm a `coreutils` fan), so if you just `brew install coreutils` then you should use `gpr` instead. `enscript` here is [GNU Enscript](https://www.gnu.org/software/enscript/), which could be installed with `brew install enscript` (credit to [Ask Ubuntu](https://askubuntu.com/questions/27097/) for pointing me to this utility). `ps2pdf` ships with GhostScript, so you could do `brew install gs`, but you should already have it if you've got the MacTeX or TeXLive distribution installed. The options I'm using should be pretty self-explanatory and tweakable, but in case you don't understand something, just RTFM (that way you could also find more options). Anyway, a page of `bash-print.pdf` from the above looks like this (this one happen to be a 72-char-per-line document, whereas my numbers are tailored for 80; the image is at 300 ppi): - -![Sample page from `bash-print.pdf` generated above. I drew a black, one-pixel border so you could tell the page from the background.](/img/20151010-bash-print-sample-page.png) - -P.S. Preview.app on El Capitan just caught me by surprise. If memory serves, exporting PDF to PNG in Preview.app used to produce only one image for the current page, but now apparently you get a single, gigantic [APNG](https://en.wikipedia.org/wiki/APNG) with each page in a frame. It's not very useful at 10 fps, though. Also, exporting to JPEG doesn't give you an MJPEG. diff --git a/source/blog/2015-10-12-the-importance-of-dated-detailed-release-notes.md b/source/blog/2015-10-12-the-importance-of-dated-detailed-release-notes.md deleted file mode 100644 index 74322d8b..00000000 --- a/source/blog/2015-10-12-the-importance-of-dated-detailed-release-notes.md +++ /dev/null @@ -1,27 +0,0 @@ ---- -title: "The importance of dated, detailed release notes" -date: 2015-10-12T14:29:42-07:00 -date_display: October 12, 2015 ---- - -I can't stress how much I value release notes, especially for closed source, commercial software. None of us want to invest on a piece of abandonware (unless it is ageless, which is quite unlikely for anything with a GUI), or a piece of software that is not completely abandoned, but takes a full year to adapt to the latest OS, campatibility-wise or UI-wise; and release notes, especially with dates, serve as almost the single metric for gauging developer commitment. In fact, whenever I try to learn about a piece of software that I heard about, one of the first things I do, usually after browsing through features and screenshots and before I even download the software to try out, is to look for its release notes and skim through it if available, and the outcome largely determines whether I'll even bother to download the installer.[^cask] A prominent, dedicated page with dated, detailed release notes immediately leaves a good impression on me. - -Unfortunately, many developers or publishers don't value release notes as much as I do. Several problems, in ascending order of seriousness: - -* Most release notes are not linked to from the home page or at least the download page, which kind of makes sense when the audience is generally non-technical, but there's little excuse when the software's targeted audience are pro-level or power users. This is not a big problem now because Google is very good at turning up release notes as long as they exist. - -* Quite some release notes are not dated, which I can't understand — it's so easy to date each entry, and it adds so much context, especially for gauging commitment (I guess developers who are less commited might not want to insert dates precisely for this reason). - -* For some software, releases notes are downright nonexistent, at least not on the web. Interestingly, occasionally they are available from an in-app menu or distributed document; the publishers just don't bother to put it on a web page. Not surprisingly, I might as well not bother to download this kind of software.[^download] - -If I were ever to publish closed source software, I'll definitely have dated, detailed release notes, linked to from the home page. - ---- - -P.S. Speaking of release notes, it's hard not to complain about MAS, as if there are not enough complaints about this horrible platform. You can only view the most recent release with its release notes (and some publishers stack "bug fixes" notes of minor/patch releases on top of the real notes of the last major release, making it ever more confusing), whereas in the iOS App Store you have the "Version History" page that shows you a dated list of releases with release notes — what I would expect from everywhere. Basically, Apple has all this data and they can show it to you in a satisfactory way it they want to, but they blew it by not bothering to implement it. Note that I'm much more likely to care about the release notes of an OS X application than an iOS app, and I daresay most power users will agree with me. - -Of course there are much more serious problems with MAS like the lack of trials, so the release notes problem is nothing but an insult over injury. In short, MAS is not a good distribution channel; it's only a lazy one, a compromise for small publishers. - -[^cask]: Nowadays, with homebrew-cask, I'm much more likely to give things a spin, but still, I take an especially defensive stance against anything that doesn't have release notes. - -[^download]: Yes, I won't deny that downloaded some of them nevertheless — that's how I found out. diff --git a/source/blog/2015-10-14-follow-up-the-sad-state-of-finder-on-el-capitan.md b/source/blog/2015-10-14-follow-up-the-sad-state-of-finder-on-el-capitan.md deleted file mode 100644 index 12697e08..00000000 --- a/source/blog/2015-10-14-follow-up-the-sad-state-of-finder-on-el-capitan.md +++ /dev/null @@ -1,42 +0,0 @@ ---- -title: "Follow-up: The sad state of Finder on El Capitan" -date: 2015-10-14T12:30:32-07:00 -date_display: October 14, 2015 ---- - -**10/14/2015 update** (updated even before I published the article). Just as I was finishing this post, an update to TotalFinder came. [1.7.8](http://totalfinder.binaryage.com/beta-changes). And holy cow, it fixed automatic column resizing! The fix isn't perfect — there's actually a visible delay before resizing, but I'm happy again. Long live TotalFinder! - ---- - -As expected, it's hard to get Finder to work the way I want it to on El Capitan. The unexpected part is that even after disabling the Debugging Restrictions part of SIP (`csrutil enable --without debug`), XtraFinder and TotalFinder[^update] both can't auto resize columns. Seems that a hole they are both utilizing has been closed. Just like `QLEnableTextSelection` in `com.apple.finder`, I guess. Apple gives, Apple takes. XtraFinder has additional problems like folder-on-top not working, window config occasionally forgotten, and the long-standing issue of shitty Chrome-style tab implementation (basically stacking a separate layer on top of each window) that shows a visible white divider, so I'm running TotalFinder right now, not sure about whether it would be abandoned completely next year. Anyway, even after running TotalFinder, it's still that damn old stupid Finder, the columns of which I have to manually resize all the time; just a little bit nicer. - -So I went out to look for full Finder replacements. I tried everything listed in the [TotalFinder alternatives](http://discuss.binaryage.com/t/totalfinder-alternatives/4124) post on TotalFinder forums. None worked for me. Here's a very brief (batch) review. - -* [Disk Order](http://likemac.ru/english/), [Commander ](http://mac.eltima.com/file-manager.html)[One](http://mac.eltima.com/totalfinder-promo.html), [DCommander](http://www.devstorm-apps.com/dc/), and [CRAX Commander](http://crax.soft4u2.com/): No column view. All of them are dual-pane though. What's the advantage of being dual-pane? I can't fathom. Easier to copy/cut and paste? What a joke — how often do you do that to justify having two panes in your face at all times? Might as well spend the time to do a column view. Column view enables fast navigation and provides a full picture of a directory tree, which is one of the two reasons I use Finder (i.e., a file manager), the other being Quick Look. If I just want to stay in a single directory, and painstakingly navigate in and out, I'll just do everything in the terminal, thank you. By the way, Command One and DCommander are suprisingly similar, both appearance-wise and functionality-wise. Not sure if one rips off the other (looks like DCommander is older). Also, why do most of them call themselves commanders? Another thing that I can't fathom.[^commander] - -* [ForkLift](http://www.binarynights.com/forklift/): Again, dual-pane, and doesn't seem to offer a single-pane mode, but you can drag the pane divider all the way to the right to hide the second one (including the divider). It has a column view, but doesn't seem to offer column auto resizing. Also, it doesn't hide items with the `hidden` flag, which is kind of insane. Even more shockingly, it offers no option to show file extensions! Tell me again that this is a power user tool. (Yeah, I know its myriad power user features, but I need the basic ones, and I don't see them. More discussions about "features" at the end.) - -* [Path Finder](http://www.cocoatech.com/pathfinder/). It actually kind of works. It offers column auto resizing, hidden in the view options of the column view (accessible via ⌘J). Even "`open ~`" could open in Path Finder, if you let it be the default file manager; that was a nice surprise, and I'm not sure about the mechanism (maybe [this](https://apple.stackexchange.com/questions/73529/how-to-change-the-default-file-manager-for-osx)? Doesn't sound right though). However, it has a horrible default appearance, and even after substantial customizations, it still looks kind of crappy. Also, the auto resizing implementation is incomplete, in that it doesn't offer min and max column size settings, so when auto resizing is enabled, many columns look awfully narrow. I'm also suspicious about its tech support. When I was investigating some issues about it on Google, I found some relevant tickets on its [support site](http://support.cocoatech.com/), but *none* of the tickets have any replies. I didn't bother to look around, but that was definitely a bad impression. - - By the way, I mentioned concerns about Path Finder's pricing in the [sad state](/blog/2015-07-30-the-sad-state-of-finder-on-el-capitan.html) post. At $40 it's definitely not cheap, but judging from the [release history](http://support.cocoatech.com/kb/installation-and-compatibility/path-finder-version-history), it's more like pay-to-upgrade every other year, rather than every year. - - Conclusion: not impressed. - -Finally, a few words about "pro features". Many of these file managers offer a huge bundle of pro features, but quite of a few of them are completely useless. Useless features include builtin text editor, hex editor, terminal, archiver and unarchiver, blah blah blah. Why would anyone use those watered-down builtins? I use the right tool, the dedicated tool, for the right job. (To give one example, Commander One includes a command line that you can type commands to execute — without command or filename completion, naturally; and it also ships with a builtin terminal accessible via ⌃O. Apart from horrendous typography, the builtin terminal is also barely better than a dumb term, incapable of handling my prompt theme. Meanwhile, iTerm2 is accessible via a system-wide shortcut ⌥Space to me — extremely convenient.) Support for other filesystems, including remote filesystems and in-place archive browsing, could be welcome though, although I seldom need them. - ---- - -P.S. Here are the version numbers, at the time of writing, of the mentioned software packages (apparently, things might change in later versions): - -* TotalFinder 1.7.6 (beta); -* XtraFinder 0.25.5; -* Disk Order 3.2.5; -* Commander One 1.1.1346; -* DCommander 2.7.2; -* CRAX Commander 1.10.4 (demo); -* ForkLift 2.6.6; -* Path Finder 7.2. - -[^update]: TotalFinder 1.7.8+ now supports column auto resizing on El Cap. See update at the top. - -[^commander]: If you Google ["file manager commander"](https://www.google.com/search?q=file+manager+commander), you'll find a hell lot of "commanders". Reminds me of C&C... Oh well. diff --git a/source/blog/2015-10-14-sip-for-the-greater-good.md b/source/blog/2015-10-14-sip-for-the-greater-good.md deleted file mode 100644 index cca4dd17..00000000 --- a/source/blog/2015-10-14-sip-for-the-greater-good.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -title: "SIP — For the Greater Good" -date: 2015-10-14T17:07:24-07:00 -date_display: October 14, 2015 ---- - -In recent months I wrote a few thousand words lamenting Finder and [SIP](https://en.wikipedia.org/wiki/System_Integrity_Protection) on El Capitan. See [The sad state of Finder on El Capitan](/blog/2015-07-30-the-sad-state-of-finder-on-el-capitan.html) and [its follow-up](/blog/2015-10-14-follow-up-the-sad-state-of-finder-on-el-capitan.html). - -For the record, I'm not blaming SIP. It does deal a serious blow to people who in-memory patch stock applications (and there's a good discussion about the creativity aspect on [ATP episode 128](http://atp.fm/episodes/128)), but the general public — at least more than 95% of users — should not be negatively affected, at least not in the short term. And I can understand why SIP protection comes at this time. Macs used to be safe, but in recent years we are seeing real world exploits increasingly more often. History has shown that technically-challenged users simply can't be entrusted with admin accounts, they are too willing to give their passwords to shady software downloaded from shady corners of the web (and sometimes even renowned corners get hacked). But they are given admin accounts anyway (there has to be someone knowing the admin password), so Apple has to come up with ways to protect them. SIP is a pretty good response. - -SIP is also good for new tinkerers. When I first started to tinker with the command line, I wasn't aware of package managers and I wasn't messing inside virtual machines, so I would download packages from official websites, then manually compile and install them to my daily system. Some packages didn't respect the `/usr/local/bin` (and `include`, `lib`, `libexec`, `share`, etc.) convention and insisted on `/usr/bin`; some others used funny locations like a standalone subdirectory of `/usr/local`; and when things don't work (e.g., can't find libraries when building — at that time I'm not familiar with `CFLAGS=-I` yet), I would explictly change `PREFIX` (probably to `/usr`) and try again. That way, over a period of a few months, I ended up with a genuinely messed up `/usr`, with all kinds of stuff everywhere. I probably overwrote quite some binaries shipped with the system. The configuration kind of worked but was pretty fragile. In the end I reinstalled the system, and started to (loosely) follow FHS ([Filesystem Hierarchy Standard](http://www.pathname.com/fhs/)) and use package managers (first MacPorts, then Homebrew). Good times. If I were to start tinkering today, I would certainly meet some barriers early on, but I would probably also learn the good practices earlier. - -SIP is clearly the future, and I don't blame it. I just hope we don't see a vulnerability in the implementation soon. diff --git a/source/blog/2015-10-26-att-to-pure-talkusa-one-month-later.md b/source/blog/2015-10-26-att-to-pure-talkusa-one-month-later.md deleted file mode 100644 index ae3e4482..00000000 --- a/source/blog/2015-10-26-att-to-pure-talkusa-one-month-later.md +++ /dev/null @@ -1,66 +0,0 @@ ---- -title: "AT&T to Pure TalkUSA, one month later" -date: 2015-10-26T00:00:30-07:00 -date_display: October 26, 2015 ---- - -**TL;DR**: If you have questions about Pure TalkUSA unanswered by the [official FAQ](https://www.puretalkusa.com/cell-phones-sim-cards.php), I have some information for you starting from the section "[migration experience](#migration-experience)". - ---- - -I became an AT&T customer days after arriving in the U.S., and stayed one for three years. The service was okay (I'm not a picky customer), but the pricing was ridiculous. I was paying somewhere between $50 and $60 per month for an AT&T Next plan, with unlimited talk and text and a mere 300 MB of data, phone installments *not* included (which I was paying the full price anyway). That's actually below average; see [average phone plan in the U.S. costs ten time as much as that in the U.K.](https://zmwangx.github.io/blog/2014-11-10-average-phone-plan-in-the-u-dot-s-costs-ten-time-as-much-as-that-in-the-u-dot-k.html). I could save a bit by joining a family plan (or more precisely, "data share plan"), but then I would lose control over my line and account, which have proven to be very annoying when I needed to upgrade, or otherwise be serviced. - -The biggest concern was that I didn't really need unlimited talk and text, so I wasn't using what I was paying for. These days we have too many channels of communications, most of them free. My monthly talk usage was usually around a hundred minutes or less, so I was basically paying a few *dimes* per minute. Which was like being robbed. - -Then I heard about [Pure TalkUSA](https://www.puretalkusa.com/) — an AT&T [MVNO](https://en.wikipedia.org/wiki/Mobile_virtual_network_operator) — from one of my friends. Pure Talk offers [cheap limited plans](https://www.puretalkusa.com/cell-plans.php)[^unlimited] that looked appealing to me. It uses AT&T's network, so for me, the only thing I would lose by switching was part of my monthly expenses, to which I wouldn't object. So I switched last month. Now that I've been on Pure Talk's network for a month, I'll try to talk about the good and bad, as well as some migration caveats, since information is sparse on the Internet. Note: I'm not comparing Pure TalkUSA to other AT&T MVNOs, since I know nothing about any of them. - -*Disclaimer before I start: I can't guarantee that information provided here is accurate (I only speak from the experience of a single customer, that is myself, although I'll try not to make unfounded claims), and I didn't consult Pure TalkUSA before publishing this post, so please don't hold me accountable for anything.* - -<h2 id="migration-experience">Migration experience</h2> - -A few tips about migration from AT&T: - -* About unlocking: After allegedly unlocking your AT&T phone, naturally you would want to make sure it is actually unlocked before ordering a Pure Talk SIM. And you'll find a lot of guides when you google "check if iPhone is unlocked". I'll just tell you this: don't trust those guides. iOS is constantly changing, and the only guaranteed check is to plug in your new SIM. To this day my General->About->Carrier shows AT&T, although I'm happily using Pure Talk's network. - -* Pure Talk ships your SIM card using USPS (they don't have physical stores), which is slow and expensive. However, I got my SIM much earlier than the estimated delivery date. Not sure if it's a coincidence. Probably location-dependent. - -* Porting number: You can choose to port your number during activation, whether you're calling or doing it online (filling out a few webforms). Beware that you must not have cancelled your AT&T service at the time of porting. The porting system was actually down for two days (customer support was very polite and kept apologizing although I said it didn't matter), and on the third day I used the webform but got an error in the end due to the wrong AT&T account number (there's an account number associated to each account — different from the phone number — that I've never heard of or used, and I had to call AT&T to extract that info). After acquiring the account number, I called Pure again and the porting process finished almost in an instant. I swapped in the new SIM card (the phone has been unlocked) and was able to make calls after a few seconds. - -* About AT&T cancellation: Porting the number will automatically cancel your service with AT&T, so you don't need to call them for cancellation. - - An anecdote here: I initially feared the usual customer retention bullshit when I tried to cancel my AT&T service through online chat (I didn't know about automatic cancellation at that time), but there was none. Representative was very polite, and I only got a "sorry to see you go" at the end. So kudos to them. - -<h2 id="pros-and-cons">Pros and cons</h2> - -Here is a short list of pros and cons of Pure Talk compared to AT&T, in my opinion: - -Good: - -* Cheap. Obviously. I am currently paying $22.90 ($12.95 + $9.95) for 500 minutes and 400 MB of data, and I'm switching to 250 minutes next month, which would make it $19.95. Note that as advertised, there are no taxes and hidden fees. I always hated the before-tax price tags in the U.S. Just tell me how much I need to pay! - -* Network quality (both talk and LTE) is good. Switching from AT&T, I didn't notice a difference. I don't know if this is true nationwide (I live in the Bay Area), but they say it's true on their FAQ. - - By the way, shortly after activating the service, I got a text message pointing me to download a profile to my phone in order to use LTE. It's titled "PureLTE" by "Giesecke and Devrient AB Nordic", and I verified with customer support that it is legit. - -* You may change your plan at any time with a few clicks, and only need to make up for the price difference. Note that downgrading doesn't grant you a refund. - -* Customer service (U.S. based) is mostly very polite and helpful (I did encounter a guy who sounded very tired with his job though), and wait time is generally very short. - - Tip: For customer support, *call 611 from a Pure Talk line* (instead of the usual ten digit customer service number listed on their website) to avoid being charged. - -Bad: - -* There's no visual voicemail, only old-schooled voicemail which you need to dial a number to listen to, in the order they were received; moreover, dialing and listening to voicemail counts toward your minute balance. I hardly missed that. I never grew accustomed to voicemail anyway; now I have an excuse to forget about it completely. - -* All incoming phone calls and text messages count towards your minute balance (I don't know about what's most common in the U.S., but as far as I know this is rarely the case in China — you usually only pay for active usage, although you do need an active service to receive calls and messages). Calling toll free numbers counts, too, so now you'll be even more angry when you're put on hold for an hour. - -* For iPhone users, or Android users who otherwise bring in their own phones: since they don't sell you your iPhone, they also don't offer insurance plans. So be extra careful with your phone! Paying $100 for a replacement (from AT&T's insurance program) is no more. - -That's basically all I want to say. Hope this post helps someone who's researching Pure Talk. - - -[^unlimited]: Pure Talk also offers an unlimited talk & text plan for $24, excluding data. According to [the "unlimited plus plan" page](https://www.puretalkusa.com/mobile-unlimited-plan.php): - - > Compare our Unlimited Plus plans to similar unlimited cell phone plans on the market and you'll see the savings you can receive! While others may pad their higher priced plans with "free" international minutes, we're focused on giving you the best rate for unlimited talk and text, plus data used within the United States. - - I honestly don't know which competitions they are referring to here. If it's AT&T, I'll share an anecdote about international roaming: I went back to China, and got a text message from AT&T saying that I could use data for TWENTY DOLLARS PER MEGABYTE. I would have had to pay $200 to visit The Verge once on 4G. diff --git a/source/blog/2015-11-06-microsoft-drops-unlimited-onedrive-storage-after-people-use-it-for-unlimited-storage.md b/source/blog/2015-11-06-microsoft-drops-unlimited-onedrive-storage-after-people-use-it-for-unlimited-storage.md deleted file mode 100644 index 1e9dffed..00000000 --- a/source/blog/2015-11-06-microsoft-drops-unlimited-onedrive-storage-after-people-use-it-for-unlimited-storage.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -title: "Microsoft drops unlimited OneDrive storage after people use it for unlimited storage" -date: 2015-11-06T10:49:51-08:00 -date_display: November 6, 2015 ---- - -[Story on Ars Technica](http://arstechnica.com/information-technology/2015/11/microsoft-drops-unlimited-onedrive-storage-after-people-use-it-for-unlimited-storage/). [Official announcement](https://blog.onedrive.com/onedrive_changes/). I was playing catch up on this week's RSS when this one punched in my face. - -I currently have 5 TB of data in OneDrive. I was once worried about lock-in when I eventually have 20 or 100 TB there, but now that they have shown their true colors, the worries are all gone. They are not even offering anything past 1 TB. We have seen this too many times — shit happens when people actually use unlimited for unlimited. Usually unlimited quickly becomes qualified, but in this case, unlimited simply becomes limited. What irony when one looks back at their announcement from [a year ago](/blog/2014-10-27-onedrive-goes-unlimited.html): - -> Today, storage limits just became a thing of the past with Office 365. - -Why even promise when they can't keep it for more than a year. - -Okay, Microsoft just reclaimed the top spot of my most-hated-companies list, and my [ongoing efforts on making a usable OneDrive CLI](https://github.com/zmwangx/pyonedrive) have been wasted. I just pushed the final commit and closed all issues. Maybe it's a blessing that I'll no longer need to deal with that slow and glitchy API; I'll see after experimenting with APIs of other cloud storage providers. - -Guess my next stop is either Amazon Cloud Drive or S3, probably the former so that I don't need to calculate.[^calculate] And a quick search yields an actively-maintained CLI client [yadavada/acd_cli](https://github.com/yadayada/acd_cli), so I may not need to roll my own this time (it depends on usability). - -[^calculate]: Yeah I'm a mathematician, but I hate most calculations that involve $$. 😂 diff --git a/source/blog/2015-11-15-we-need-a-programming-keyboard-on-ios.md b/source/blog/2015-11-15-we-need-a-programming-keyboard-on-ios.md deleted file mode 100644 index a27530a5..00000000 --- a/source/blog/2015-11-15-we-need-a-programming-keyboard-on-ios.md +++ /dev/null @@ -1,17 +0,0 @@ ---- -title: "We need a programming keyboard on iOS" -date: 2015-11-15T02:17:05-08:00 -date_display: November 15, 2015 ---- - -We do. If you ever tried to say something on GitHub (web) or StackOverflow (web or app) on iOS, you'll probably agree with me. The stock keyboard (or any third party keyboard that I've heard of) is simply awful at this. Typing on iOS software keyboard is unpleasant enough to begin with, but behold: - -* Auto"correct" messes up everything as fast as you can type, which isn't really fast anyway; might as well call it autorot. -* The backtick is a click plus a loooong click (on the single quote key) plus another click away. Good luck typing code in Markdown,[^bbcode] especially if you use GFM fenced code block like all of us do. -* Brackets, curly braces, the underscore, the pound, etc. are all three clicks away. - -The solution is pretty obvious actually. I don't know about smaller phones, but the software keyboard on a landscape iPhone 6 Plus has four rows, which takes up about 40% of vertical screen estate, and it has fourteen keys in the top row. With a little bit of effort it can be made into a five-row, full-sized keyboard (without arrow keys perhaps) without taking up a ridiculous amount of space. Since the horizontal 6 Plus could handle it, any iPad should be able to handle it too; definitely shouldn't be an iPad Pro-only luxury. Turn off autocorrect on top of that, and you get a decent programming (or better put, programmer-oriented) keyboard. - -This is merely a rant, but it would awesome if anyone sets out to make one. - -[^bbcode]: To be fair, typing BBCode is even worse. Unfortunately that's what Ars Technica use, and I've given up on commenting there. diff --git a/source/blog/2015-11-25-bash-function-exporting-fiasco.md b/source/blog/2015-11-25-bash-function-exporting-fiasco.md deleted file mode 100644 index e2bd5528..00000000 --- a/source/blog/2015-11-25-bash-function-exporting-fiasco.md +++ /dev/null @@ -1,43 +0,0 @@ ---- -title: "Bash function exporting fiasco" -date: 2015-11-25T15:38:13-08:00 -date_display: November 25, 2015 ---- - -Bash is the only major shell (and the only shell that I know of) that implements function exporting. By now everyone should have heard of this feature, I suppose, after the publicity of Shellshock last year. I was personally introduced to it while writing parallel processing scripts [with GNU Parallel](https://www.gnu.org/software/parallel/parallel_tutorial.html#Transfer-environment-variables-and-functions) (long before Shellshock), and it seemed useful and clever at that time. Back then I often wondered why it didn't make its way into Z shell. However, now that I'm much more seasoned in shell scripting, I can see why and how this feature is troubled and of debatable value. - -Two problems lie at the heart of function exporting: - -1. As always, everything clever comes at a cost; -2. Code execution from untrusted source. - -Regarding the first problem, the cost of function exporting is to mess with the environment, in a very hackish way. The environment was designed to hold data, not code, and we're not in the utopia of Lisp; but bash forced its way through. Pre-shellshock, exported `func` was stored as `func=() {...` in env; post-shellshock, it was first `BASH_FUNC_func()=() {...` (which didn't entirely fix the issue), and then `BASH_FUNC_func%%=() {...`. - -The second problem doesn't need much explanation — *shellshock it was*. It has been extensively documented elsewhere, so I'll just succinctly comment that to load exported functions into a subshell, function definitions have to be retrieved from the environment and executed (again because we're not in the utopia of Lisp[^lisp]), and loading is done passively from the subshell user's point of view, hence the code execution bug(s). The bug(s) has(have) allegedly been fixed, but code execution (presumably with the appropriate safeguards now) still can't be avoided altogether, so just like a sanitized `eval`, it would still wake you up at night. - -Well, if that's all I have to say, I wouldn't have started this post today. The thing that's bugging me is another issue I've found recently that's entirely avoidable, yet upon which we'll probably never see light ever after due to a combination of factors. - -It started with [this question on SO](http://stackoverflow.com/q/33819243/19447840). While troubleshooting I quickly noticed that a Bash-emulated `sh` imports those `BASH_FUNC`s from the environment: - - > bash -c 'func () { echo "exported function loaded"; } && export -f func && ln -sf /bin/bash sh && ./sh -c func' - exported function loaded - -It gets worse when the function isn't Bourne shell compatible (e.g., when it uses process substitution): - - > bash -c 'func () { cat <(echo hello); } && export -f func && ln -sf /bin/bash sh && ./sh -c func' - cat: <(echo hello): No such file or directory - -That's surprising but not scary enough, because if you're not a fool you won't call `func` in `sh` anyway. However, if you're unfortunate enough to be dealing with `/bin/sh` on OS X (bash 3.2 under the hood, modified by Apple or not I'm not sure), then all hell break loose: - - > bash -c 'func () { cat <(echo hello); } && export -f func && /bin/sh -c :' # OS X only - /bin/sh: func: line 0: syntax error near unexpected token `(' - /bin/sh: func: line 0: `func () { cat <(echo hello)' - /bin/sh: error importing function definition for `func' - -Note that we're actively doing nothing in `sh`, yet we get all these syntax errors from loading `func`. This happens to every invocation of `sh`, and as you might expect, there are no shortage of programs that are either `sh` scripts (e.g., fasd) or have internal `sh` calls (e.g., GNU Parallel[^parallel]). A single export of a Bourn shell incompatible function will haunt you through the entire session. Oops. - -As I said, I don't know if the displayed error messages are due to Apple's modifications (anyone willing to look at the [source code](https://opensource.apple.com/source/bash/bash-97/)?), since a symlink named `sh` to `/bin/bash` doesn't print error messages, but instead load the wrong function, which is almost as bad but less annoying to innocent users. At any rate, it's not even worth reporting, either to GNU or Apple, because we're stuck with bash 3.2 for `/bin/sh` forever (thank you GPLv3), and it takes a hell of a vulnerability like shellshock to get a small update out of Apple's hands. We can install newer shells to `/usr/local` as much as we'd like to, but `/bin/sh` is simply the final word for many tasks involving the shell. Yet it's stained by this troubled bash-specific feature, and it's not going anywhere. So sad. - -[^lisp]: I'm not commenting on the security of Lisp. - -[^parallel]: **04/14/2015 Update.** GNU Parallel is no longer haunted by this issue since [`3d919c6`](http://git.savannah.gnu.org/cgit/parallel.git/commit/?id=3d919c6cd427e9615f56f260eb959a44d5d32c18). diff --git a/source/blog/2015-12-08-safeguarding-git-repos-against-accidental-rm.md b/source/blog/2015-12-08-safeguarding-git-repos-against-accidental-rm.md deleted file mode 100644 index 9710c211..00000000 --- a/source/blog/2015-12-08-safeguarding-git-repos-against-accidental-rm.md +++ /dev/null @@ -1,43 +0,0 @@ ---- -title: "Safeguarding git repos against accidental rm" -date: 2015-12-08T00:17:39-08:00 -date_display: December 8, 2015 ---- - -Everyone who has spent a sizable portion of their life in terminals has experienced that "oh shit" moment: you realize what you've done immediately after you've hit enter, but it's already too late. And needlessly to say, many of those are associated to accidental `rm`s. - -I just had one of those moments. I was going to delete a subdirectory of `~/.config`, but hit return prematurely, and the command line ended up being `rm -r ~/.config`. Imagine the horror one second later. Fortunately I was saved by the read-only objects in `.git`, which triggered prompts; however, damage was already done, to some extent. I had to reinit the repo and do a hard reset, and a corrupted submodule was in my way (it blocked my attempt of `git reset --hard`) which I eventually had to completely remove and re-add. In the end everything was recovered (hopefully) and back to normal, but this episode was definitely not great for heart health, which led me to rethink `rm`. - -I've tried several safer `rm` solutions before. The first and obvious is to alias `rm` to `rm -i`, but having to answer dozens of prompts a day (or more) is agonizing and unproductive. I've also tried trashing, but a nonempty trash can makes me sick, so not for me either. I also used `safe-rm` for a couple of months, but without supplying my own blacklist (I have none to be blacklisted), I've never hit the default blacklist; apparently I'm not stupid enough to mess in system locations, so this won't really help much. Fortunately though, this time I might have found a very good solution for myself. - -The idea is to protect all git repos. Git repos[^repo] are among the most valuable assets of programmers, and they have the nice property of not being completely removable without `-f` or `--force` (the work tree of a submodule, where `.git` is a regular file containing the relative path of the git dir, can be removed without `--force`, but we don't want to damage submodules anyway, so let's not single them out). It's unlikely that we would intend to remove a repo directory without specifying `-f` or `--force`, so let's just reject all such `rm` calls. - -The wrapper is very easy to write. Here's one implementation for Zsh with support for both GNU coreutils and BSD `rm`. - -[^repo]: In this article, "repo" stands for the work tree of a repo, unless otherwise noted; the actual repo with git objects is referred to as "git dir". - -```zsh -rm () { - setopt localoptions noshwordsplit noksharrays - local args_backup force node - set -A args_backup $@ - while :; do - case $1 in - --force|-*f*) force=1 && shift;; - --) shift && break;; - -*) shift;; - *) break;; - esac - done - for node; do - # -f, --force hasn't been specified && node is a git repo - [[ -z $force && -e $node/.git ]] && { - printf "\e[31m'%s' is a git repo -- won't remove without the -f or --force option\e[0m\n" $node - return 1 - } - done - command rm $args_backup -} -``` - -Personally, I stick it into a [Prezto module](https://github.com/zmwangx/prezto/tree/master/modules/rm_guard) available from my fork. Hopefully it will serve me well this time round. diff --git a/source/blog/2015-12-16-spoiled-by-retina-in-less-than-a-day.md b/source/blog/2015-12-16-spoiled-by-retina-in-less-than-a-day.md deleted file mode 100644 index c4ca0dcd..00000000 --- a/source/blog/2015-12-16-spoiled-by-retina-in-less-than-a-day.md +++ /dev/null @@ -1,27 +0,0 @@ ---- -title: "Spoiled by Retina, in less than a day" -date: 2015-12-16T21:10:08-08:00 -date_display: December 16, 2015 ---- - -I finally got a 15'' Retina MacBook Pro this morning to replace my 13'' mid-2012 non-Retina MacBook Pro, whose spinning disk has been getting increasingly slower (or so I felt).[^replace] Apparently this is a pretty significant landmark in my personal computing history, since I'm saying goodbye to both spinning disk and non-Retina display on my primary computing device. - -The transition was initially smooth except for a few things. First, as a tap-to-click wizard I immediately turned on tap-to-click, but I had a hard time dragging things because it was too easy to trigger a force touch instead on the medium setting, and under the firm setting I could hardly force touch at all; in the end I just turned off force touch altogether, and haven't had any problem since. By the way, I was initially worried about the keyboard too but it worked surprisingly well for me, so no complaints there. Secondly, [10pt non-anti-aliased Monaco](/blog/2015-08-31-after-all-these-years-10pt-non-anti-aliased-monaco-is-still-the-best.html) looks weird on Retina since it's no longer the beloved bitmap version. I turned on antialiasing and now it's no longer weird, but it felt totally different and I'm not sure if I like it (definitely not as much as the 10pt bitmap Monaco anyway). It's okay right now but I'll probably need to spend some time trying out different fonts. Obviously there are [like-minded folks](https://news.ycombinator.com/item?id=10140728) out there. Sad story. - -So much for first impressions. Apart from Monaco, everything felt great, until I returned home (I was doing setup away from home to get a less shitty connection) and connected my 27'' external monitor. Holy crap, I couldn't believe my eyes. The dock icons — the first things I saw before launching anything — looked *so blurry I couldn't stare at them for more than a few seconds*. That was after staring at the Retina display for less than five hours. Not to mention PDFs; they look ultra crisp on the Retina display and ultra crappy on non-Retina — especially in Preview, which is a problem I've been aware of since Yosemite.[^pdfs] Moreover, the terminal font is more problematic than initially estimated — *now I have a retina display and a non-retina one side-by-side, yet I can only set one font for my default profile, which will never satisfy both*![^provided] This is so awkward I can't think of a solution. One obvious approach is to ditch the blurry 27'' and only work from the Retina 15'', but should I really let the large canvas sit idle? No idea. Or should I get a 4K external display? First, a 4K display at 27'' still can't rival the pixel density of 2880x1800 at 15.4'' (Apple ships 5K at 27'' for a reason). Secondly and more importantly, I don't have the budget for such a thing after throwing money at an expensive 15'' rMBP (with 512 GB SSD)... - -Transition periods are always awkward, I guess. - ---- - -**12/17/2015 Update.** After more than a full day's use, I actually quite love 10pt Monaco on a Retina display. I tried various fonts, including Menlo, Consolas and so on, but none of them has that whimsical feeling of Monaco. Hopefully the font is stuck now. - ---- - -**12/28/2015 Update.** A dozen days later, I can hardly look at 10pt Monaco on a non-Retina screen anymore, antialiased or not, especially not in bold. Mind blown. - -[^replace]: I haven't got the nerve to replace the hard drive myself, since it looks so much more complicated than upgrading the memory. - -[^pdfs]: PDFs looked so horrible in Preview (and TeXShop, my LaTeX previewer, which only serves a niche) that I often viewed them in browsers (!!), where text at least looks reasonable (on par with slightly blurry text elsewhere). PDF Expert came along and kind of made the situation better for non-Retina. - -[^provided]: Provided that I'll religiously stick to 10pt non-anti-aliased Monaco on non-Retina. diff --git a/source/blog/2015-12-20-regex-flavor-hell.md b/source/blog/2015-12-20-regex-flavor-hell.md deleted file mode 100644 index 97ff56a7..00000000 --- a/source/blog/2015-12-20-regex-flavor-hell.md +++ /dev/null @@ -1,17 +0,0 @@ ---- -title: "Regex flavor hell" -date: 2015-12-20T16:03:03-08:00 -date_display: December 20, 2015 ---- - -I write a lot of shell scripts, which means dealing with common *ix utilities a lot. I typically want my scripts to work on both OS X and Linux (or OS X + GNU utilities, which is my personal setup), which means writing commands that are understood in both GNU/Linux and BSD worlds. Unfortunately that's not so simple, because to do that I usually have to give up readily available functionalities (especially the vast collection of useful options typical of GNU utilities) and am constantly thrown back to the stone age that is POSIX, or a little bit more than POSIX. - -Working with regular expressions is especially painful. Almost every implementation of every utility (with regex support) has its own flavor of regex. Most notably the big three: `grep`, `sed` and `awk`. GNU utilities of course come with GNU extensions, but they are nothing when aiming for compatibility. Ignoring GNU extensions, there's a way to turn on standard POSIX extensions (ERE) on `sed`, but unfortunately GNU and BSD use different flags: `-r` for GNU sed and `-E` for BSD sed. The two implementations of `grep` thankfully use the same flag `-E` to turn on ERE, but GNU grep, being a GNU utility and having to distinguish itself from its mundane counterpart, further implements `-P,--perl-regexp` — regexers' dream. It's there but I can't use it, except in an interactive shell. `awk` has more than two implementations and will be left out of this discussion. - -Anyway, despite all these flavor issues, I can usually get away with BRE, although it's verbose and unreadable as hell (quantifiers in particular) and doesn't support alternation. I would be thankful if BRE is the end of the story, but it is not. There are more tools lurking around trying to sabotage scripters. `find` is a perfect example. BSD `find`, unsurprisingly, uses BRE by default with `-regex` and `-iregex`, and ERE may be turned on with the `-E` flag. GNU findutils `find`, however, tries to be helpful and future-proof by having a `-regextype` option: - -> Changes the regular expression syntax understood by `-regex` and `-iregex` tests which occur later on the command line. Currently-implemented types are `emacs` (this is the default), `posix-awk`, `posix-basic`, `posix-egrep` and `posix-extended`. - -The Emacs flavor? You mean Elisp regexp? Okay fine, [BRE](http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap09.html) — with few features other than grouping (`\(...\)`), quantifiers (`*` or `\{n,m\}`), bracket expressions and character classes — should still be pretty much compatible with Elisp regexp. However, the "Emacs flavor" isn't even the Elisp flavor. It's a [stripped version](https://www.gnu.org/software/findutils/manual/html_node/find_html/emacs-regular-expression-syntax.html) specifically for findutils. In particular, there are `*`, `+` and `?` but no curly braces quantifiers, so gone is the dream of writing even just mildly complex regexps that are compatible with both BSD `find` and GNU findutils `find`. By the way, in case you wonder, the [POSIX `find`](http://pubs.opengroup.org/onlinepubs/9699919799/utilities/find.html) doesn't even have a `-regex` primary/operator... - -What a cruelly realistic world we live in. diff --git a/source/blog/2015-12-26-autoenv-with-auto-cleanup.md b/source/blog/2015-12-26-autoenv-with-auto-cleanup.md deleted file mode 100644 index dd973a40..00000000 --- a/source/blog/2015-12-26-autoenv-with-auto-cleanup.md +++ /dev/null @@ -1,33 +0,0 @@ ---- -title: "autoenv with auto cleanup" -date: 2015-12-26T00:15:48-08:00 -date_display: December 26, 2015 ---- - -I heard about [kennethreitz/autoenv](https://github.com/kennethreitz/autoenv) a long time ago. The idea of autoloading project-specific environment modifications is nice, but no auto cleanup after leaving a project was a showstopper for me. - -Today, I took matters into my own hands and wrote a fresh Zsh implementation[^re] with auto cleanup support. Check it out: <https://github.com/zmwangx/prezto/tree/master/modules/autoenv>. - -[^re]: This is not a re-implementation in the common sense. My little Zsh module is inspired by kennethreitz/autoenv and reminiscent of that older project, but I took nothing from there (in fact I didn't even read their source code). I also don't claim to support their entire feature set. For instance, kennethreitz/autoenv claims to be Foreman compatible, which includes turning on `ALL_EXPORT`. However, I don't think `ALL_EXPORT` by default is a good idea, so with my `autoenv`, if you want `ALL_EXPORT` you have to set it explicitly. - -As a quick promotion, let me show you two common examples. - -First, inserting some local bin directory into the search path. This is easily done by a one-line `.env`, say, - -```zsh -autoenv-insert-paths bin libexec -``` - -This way `$PWD/bin` and `$PWD/libexec` are inserted to the beginning of the search path, which will persist until you leave the directory tree. That is to say, the inserted paths will still be available when you descend into subdirectories (and more specific `.env`'s can even be stacked as you descend), but they will be purged as soon as you leave the tree. Clever, isn't it? - -Secondly, exporting project-specific environment variables. The `.env` would look like - -```zsh -export HOMEBREW_DEVELOPER=not-for-the-faint-hearted - -autoenv-purge () unset HOMEBREW_DEVELOPER -``` - -where the body of `autoenv-purge` will be executed when you leave the directory tree. No more junk floating around. - -Again, for more info, including detailed usage and customization instructions, please visit [`modules/autoenv`](https://github.com/zmwangx/prezto/tree/master/modules/autoenv) in zmwangx/prezto. diff --git a/source/blog/2015-12-27-lesson-on-magic-method-access-of-python-new-style-classes-from-my-failed-python3-port-of-tomorrow.md b/source/blog/2015-12-27-lesson-on-magic-method-access-of-python-new-style-classes-from-my-failed-python3-port-of-tomorrow.md deleted file mode 100644 index daae70a6..00000000 --- a/source/blog/2015-12-27-lesson-on-magic-method-access-of-python-new-style-classes-from-my-failed-python3-port-of-tomorrow.md +++ /dev/null @@ -1,103 +0,0 @@ ---- -title: "Lesson on magic method access of Python new-style classes (from my failed Python3 port of Tomorrow)" -date: 2015-12-27T16:47:05-08:00 -date_display: December 27, 2015 ---- - -I know the title is formidably long, but I can't find something more accurate (and my homegrown mini CMS doesn't support subtitle), so please bear with me. - -So, I have [madisonmay/Tomorrow](https://github.com/madisonmay/Tomorrow) — "magic decorator syntax for asynchronous code in Python 2.7" — bookmarked for a long time[^long] without ever trying it, because I simply don't write Python 2 code any more (except when I try to maintain compatibililty). I felt kind of strange that a ~50-line project with ~1000 stars on GitHub hasn't been ported to Python 3 already, so I gave it a shot just now. - -I thought it would be easy: - -1. Modernize the old-style class `Tomorrow`; -2. Replace `__getattr__` with `__getattribute__` for unconditional attribute routing, then make a few exceptions to prevent infinite recursion; -3. `2to3` test cases; -4. Make meta changes, like removing the `futures` dependency. - -However, after doing 1–3, I ran the tests, and out of the five test cases, three failed and one errored. I tried to isolate the problem, and ended up with the following piece of proof-of-concept: - -```python -class PassThrough(object): - - def __init__(self, obj): - self._obj = obj - - def __getattribute__(self, name): - if name == "_obj": - return object.__getattribute__(self, name) - print("Accessing '%s'" % name) - return self._obj.__getattribute__(name) -``` - -This snippet is valid in both Python 2.7 and Python 3, but here's the surprise: - -```python ->>> g = PassThrough(0) ->>> print(g) -<__main__.PassThrough object at 0x10c662e48> ->>> str(g) -'<__main__.PassThrough object at 0x10c662e48>' ->>> hasattr(g, '__str__') -Accessing '__str__' -True ->>> g.__str__() -Accessing '__str__' -'0' -``` - -In addition, here's what happens if you try to "pass through" a function: - -```python ->>> def f(): return True ->>> g = PassThrough(f) ->>> g() -Accessing '__class__' -Accessing '__class__' -Traceback (most recent call last): - File "<ipython-input-6-d65ffd94a45c>", line 1, in <module> - g() -TypeError: 'PassThrough' object is not callable - ->>> callable(g) -False ->>> hasattr(g, '__call__') -Accessing '__call__' -True ->>> g.__call__() -Accessing '__call__' -True -``` - -As you can tell, although `__str__` or `__call__` may have been implemented through `__getattribute__`, and `hasattr` (which in turn depends on `getattr`) has no trouble finding them, they are not picked up by `str` or function call `(...)`. At this point, one would suspect that this is due to `str` or function call only looking at the class instance's `__dict__`. Compare this to the behavior of an old-style class: - -```python -class PassThrough(): - - def __init__(self, obj): - self._obj = obj - - def __getattr__(self, name): - print("Acessing '%s'" % name) - return self._obj.__getattribute__(name) -``` - -Now: - -```python ->>> g = PassThrough(0) ->>> print(g) -Acessing '__str__' -0 ->>> def f(): return True ->>> g = PassThrough(f) ->>> g() -Acessing '__call__' -True -``` - -Note that magic method access is always routed through `__getattr__`. - -After some digging, my suspicion was confirmed: indeed, for new-style classes, rather than invoking `__getattribute__`, the Python interpreter only looks for magic methods in `__dict__`. But is there a workaround for implementing something like the `PassThrough` class above? There's a [nice answer](http://stackoverflow.com/a/9059858/) on StackOverflow that uses a metaclass to "automatically add proxies for magic methods at the time of class creation", to quote the author. However, the thing about Tomorrow is that *we don't have the result and don't know whatever magic methods it might have at class creation* — after all, Python isn't a statically typed language. It is possible for programmers to offer hints, but then Tomorrow won't be as elegant and magical anymore. Therefore, unfortunately enough, Tomorrow isn't portable to Python 3 — at least not without a substantial hack that's beyond my knowledge, or a complete overhaul of its logic (haven't thought about that). - -[^long]: Pretty much since the beginning, I believe (the [initial commit](https://github.com/madisonmay/Tomorrow/commit/22a53dfbcf9b516ecd1770eeca9fcf1720271240) was from July 24 of this year). I don't remember how I came accross it though. diff --git a/source/blog/2015-12-28-why-i-want-lossless-music-on-itunes-music-store.md b/source/blog/2015-12-28-why-i-want-lossless-music-on-itunes-music-store.md deleted file mode 100644 index 56bc3738..00000000 --- a/source/blog/2015-12-28-why-i-want-lossless-music-on-itunes-music-store.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -title: "Why I want lossless music on iTunes Music Store" -date: 2015-12-28T03:15:45-08:00 -date_display: December 28, 2015 ---- - -This is an impulse post after reading ["Apple again rumored to be working on high-resolution audio"](https://marco.org/2015/12/27/apple-hd-audio-again).[^macrumors] - -To be clear, I'm no audiophile. I can't tell the difference between 256kbps AAC and lossless (maybe not even the difference between 128k and 256k), and my midrange to lower midrange equipments probably won't let me tell anyway. I'm certainly not a consumer of snake oil. - -However, I still prefer to get everything in lossless, simply because **"good enough" today is almost never good enough tomorrow**. Fifty years later I'm most likely still wandering this planet, I and my music collection. I would be extremely regretful if I didn't archive the highest quality versions of my favorite tracks today, only to find them inferior-sounding fifty years later, which is a pretty realistic possibility given how fast technology advances.[^hearing] Even today's lossless could be inferior-sounding in the future, but there would be no regret. - -To be extra clear, I'm talking about lossless for archival purposes, so what I want to see is a lossless download option in ITMS.[^other] Streaming can be done in whatever good enough® sampling frequency and bitrate that's currently in use, since it's a one-off thing with no effects on tomorrow (and I don't give a shit about streaming and subscription anyway). Offering lossless downloads likely won't put much burden on Apple's infrastructure, since they already deliver much more bandwidth-demanding movies on the same channel. Moreover, albums on ITMS aren't much cheaper than physical CDs, while the cost is apparently lower than CD production, the audience apparently wider, and the chances of impulse purchases (especially of single tracks) much higher, so I would suppose such a move (delivering lossless on ITMS) won't considerably hurt record labels' profits either. After all, if they don't make it easy for consumers, many consumers will just pirate — it's way too easy to pirate music. - -[^macrumors]: And I did see the [MacRumors article](http://www.macrumors.com/2015/12/20/apple-high-resolution-audio/) a week ago. I even registered a MacRumors account, which I never bothered to do, just to comment on that article... It just didn't occur to me to write a blog post at that time. - -[^hearing]: You might be skeptical of my hearing when I'm in my seventies... But I could well be showing my favorites to someone with perfect hearing, say my grandchildren. - -[^other]: I know there are many online music stores that sell lossless music, but ITMS has the largest catalog in the world, and for many titles I care about, ITMS is still the only place in this country where I can make legal digital purchases. diff --git a/source/blog/2015-12-29-catches-when-installing-windows-7-with-boot-camp.md b/source/blog/2015-12-29-catches-when-installing-windows-7-with-boot-camp.md deleted file mode 100644 index 2e8f1b96..00000000 --- a/source/blog/2015-12-29-catches-when-installing-windows-7-with-boot-camp.md +++ /dev/null @@ -1,27 +0,0 @@ ---- -title: "Catches when installing Windows 7 with Boot Camp" -date: 2015-12-29T15:09:16-08:00 -date_display: December 29, 2015 ---- - -I was looking for a use for my retired Mid-2012 Non-Retina MacBook Pro 13''^[2.9 GHz i7 + Intel HD Graphics 4000 + 16 GB RAM + frigging slow 750 GB 5400-rpm spinning disk I've yet to replace.], and unsurprisingly I figured that I would turn it into a OS X-Windows dual boot for some occasional gaming. I'm a CnC fan (not hardcore, but still), mainly for RA2/YR and TW/KW, and playing these inside Fusion is really a subsubpar experience. Due to the age of these games and their compatibility problems on Windows 8 and higher^[RA2/YR used to have problems even on Windows 7, at least inside Fusion, so I used to play them in XP SP3 VMs; I've yet to try them with Windows 7 running on bare metal.], I chose to shoot for a Windows 7 install. - -Apple has a pretty thorough walkthrough in the support article [Install Windows 7 and earlier on your Mac using Boot Camp](https://support.apple.com/en-us/HT205016). There are, however, some catches that I would like to collect and share in this post. - -1. Win 7 ISO isn't available for download in the appropriate language (given your product key). This one sounds incredibly stupid... But it is a real problem at least for me and several others (just Google). I have a valid Win 7 Ultimate license from my institution, so I went to <https://www.microsoft.com/en-us/software-download/windows7> to grab my ISO (just for fun; I already have the image). However, after verifying my product key, here's the list of languages that I'm asked to choose from, where English is apparently missing (!!!): - - ![|394| da !@#$?](/img/20151229-win7-iso-language-choice.png) - - I don't know the solution to this problem. In my case I've archived English Win 7 Ultimate SP1 images (both x86 and x64) before, so I just proceeded with my old image. - -2. FileVault. It is my belief that FileVault needs to turned off before partitioning the drive with Boot Camp.^[I'm not completely sure that this is necessary. I was greeted with partitioning errors initially which I thought was due to FileVault, so I switched it off (the actual process is much longer than "switching it off", since the whole disk has to be decrypted and rewritten), but as you'll see later, the partitioning errors were at least partly due to a slightly corrupt filesystem.] - -3. *An error occured while partitioning the disk.* That's the unhelpful message from Boot Camp. If you try to manually partition the drive with Disk Utility, you'll probably get a much more helpful message like *Partition failed with the error: couldn't modify partition map because file system verification failed*. Now the problem is obvious, and the solution is simple. Boot to single user mode and repair the filesystem with `/sbin/fsck -fy`, or safer, `/sbin/fsck -f` which might require interaction. - -4. During Windows installation you'll obviously be prompted to choose a system partition at some point, and due to Boot Camp only formatting to FAT32, you'll get the message *Windows cannot be installed to this hard disk space. Windows must be installed to a partition formatted as NTFS.* This one is easy, just click "Drive options (advanced)" then "Format", which automatically formats the partition to NTFS. This is actually documented in Apple's walkthrough, but mortals do panic in face of error messages, so let's also note it here. - -5. Even after formatting the Boot Camp partition, it is still possible to get the error *Setup was unable to create a new system partition or locate an existing system partition*. It this happens, check if you have any USB drives (other than the installation media) plugged in. In my case my Time Capsule was plugged in, and rebooting with it unplugged fixed the problem. The exact cause of the problem is unclear to me. Some say it's due to Master Boot Record limiting the number of partitions to four, but why the heck is my external drive counted towards that limitation? I'd go for Win 7 installer is just confused. Anyway, just unplug anything that's not needed during Windows installation. - -Hopefully you're good after solving the aforementioned problems. If you followed Apple's walkthrough correctly, Boot Camp's setup.exe will be invoked automatically immediately after Windows finishes installation, and after a certain number of reboots your drivers will be up and running. Now you're ready to take control of your Windows. Install Chrome^[You can't even browse Microsoft's own websites with stock IE8. And IE11 is locked behind a hell lot of Windows Updates (even then it is crap). Doing Windows Update is like building up a tech tree.] and Microsoft Security Essentials immediately, then hop right into the Windows Update hell to patch your four-year-old system. Of course, Windows Update being Windows Update won't be smooth — servers will be crowded as ever and just checking for updates will likely take forever, let alone downloads. After a semi-infinite amount of time you'll get your estimates (I got 212 updates). Click update and let Windows Update grind for hours. And wish yourself a good luck (that no update errors will occur — luckily I didn't get any). - -By the way, the otherwise great Apple trackpad is almost unusable on Boot Camp Windows under any setting. I'm forced to use a mouse. diff --git a/source/blog/2016-01-01-virtualenvs-for-everyone.md b/source/blog/2016-01-01-virtualenvs-for-everyone.md deleted file mode 100644 index bf7b9b7a..00000000 --- a/source/blog/2016-01-01-virtualenvs-for-everyone.md +++ /dev/null @@ -1,74 +0,0 @@ ---- -title: "Virtualenvs for everyone" -date: 2016-01-01T22:21:14-08:00 -date_display: January 1, 2016 ---- - -Python distutils for the most part is rather pleasant to work with. That is, pleasant until you've accumulated so many packages that you eventually run into a clash of namespace, or a dependency conflict (or dependency hell as most would affectionately call it).[^trouble] In contrast, npm's approach to dependencies shuts out dependency hell completely, but it is so paranoid and costs so much duplication that I find it hard to appreciate unless necessary. Somewhere in between there's the virtualenv approach which I find most appealing for smallish projects — keep a single copy of each package in the dependency tree in a contained environment specific to the project at hand. This is how we debug Python projects, and it certainly also should be *the* way we run command line tools written in Python. - -There's another reason I like virtualenvs. There are tons of problems associated with choosing between Python 2 and 3 — some projects are Python 2 only, some are instead Python 3, some claim to be compatible with both but actually present subtle problems when you use one instead of the other. However, without virtualenvs, there's only one `bin` — `/usr/local/bin` — and everything's competing for it. Most programs (especially ones with a typical `setup.py`) don't install a soft/hardlink with a helpful `2` or `3` suffix when installing executables, let alone detailed suffixes like `2.7` or `3.5`, so without probing into the shebangs you're never sure which version of Python you're running your program with, and as a result Python 2/3 (or even a point release)-specific bugs occur randomly. Virtualenvs solve the problem by allowing you to have as many bins (and includes, and libs) as you like. - -Hence the title "virtualenvs for everyone". I would like to install each command line program written in Python into a separate virtualenv. The only issue is that apparently I don't want too many bins in my `$PATH`; to solve this issue, the executable bits of each project should be linked to a central place, for which I choose `$HOME/bin`. There could be as many symlinks as we like, so now we can have multiple links with increasing detailed version suffixes, e.g., `3`, `3.5`, `3.5.1`. Very nice. - -This task could clearly be automated; the only slightly tricky bit is to programmatically figure out which scripts a project installs to `bin`. Luckily, for projects using `setuptools.setup`, we can simply spoof that function. Here's my `setuptools/__init__.py`: - -```python -#!/usr/bin/env python3 - -"""setuptools stubs. - -Here we only stubbed the symbols in setuptools.__all__. Hopefully that's -enough (actually I can't remember seeing any setup.py using more than -setup and find_packages). - -setup has been spoofed to print the names of scripts, console_scripts -and gui_scripts defined in the arguments to setup. Some user-friendly -messages are also printed to stderr. - -""" - -from __future__ import print_function - -import re -import sys -import os - -__all__ = [ - 'setup', 'Distribution', 'Feature', 'Command', 'Extension', 'Require', - 'find_packages' -] - -def setup(**kwargs): - scripts = [os.path.basename(script_path) - for script_path in kwargs.pop('scripts', [])] - if scripts: - print('scripts:\n - %s' % '\n - '.join(scripts), file=sys.stderr) - entry_points = kwargs.pop('entry_points', {}) - for entry_point in ['console_scripts', 'gui_scripts']: - extra_scripts = [re.split('(\s|=)', spec.strip())[0] - for spec in entry_points.pop(entry_point, [])] - if extra_scripts: - print('%s:\n - %s' % (entry_point, '\n - '.join(extra_scripts)), - file=sys.stderr) - scripts.extend(extra_scripts) - print('\n'.join(sorted(scripts))) - -class Distribution(object): pass -class Feature(object): pass -class Command(object): pass -class Extension(object): pass -class Require(object): pass -def find_packages(**kwargs): pass -``` - -Now, let `$HERE` be the directory containing our fake `setuptools/`, and `$PROJECT_ROOT` be the project root directory containing `setup.py`. Run - -```zsh -PYTHONPATH=$HERE:$PYTHONPATH python $PROJECT_ROOT/setup.py -``` - -and bam! We get the names of all scripts on stdout. - -My full automation scripts, including the Zsh main function `virtual-install`, can be found in [`modules/python/functions` in zmwangx/prezto](https://github.com/zmwangx/prezto/tree/master/modules/python/functions). I'm not including it here because it uses some custom helper, and it's just too long (200+ lines, but not very sophisticated). Happy virtualenving! - -[^trouble]: In rare cases, even installing a single package could land you in trouble. The classical example is installing the `readme` package on a case-insensitive filesystem (e.g., the default mode of HFS+). "Unfortunately" [this](https://bugs.python.org/issue24633) has been fixed. diff --git a/source/blog/2016-01-14-the-dirtiest-mistakes-of-os-x.md b/source/blog/2016-01-14-the-dirtiest-mistakes-of-os-x.md deleted file mode 100644 index 48eb8c86..00000000 --- a/source/blog/2016-01-14-the-dirtiest-mistakes-of-os-x.md +++ /dev/null @@ -1,30 +0,0 @@ ---- -title: "The dirtiest mistakes of OS X" -date: 2016-01-14T01:02:52-08:00 -date_display: January 14, 2016 ---- - -I must have written about this elsewhere, but here are my top three: - -1. `.DS_Store`. Finder litters faster than one could clean up. - -2. HFS+ NFD*.[^nfd] Heard of the cursed encoding `UTF8-MAC`? Pure Evil. Culprit of - tons of garbled text issues (especially cross platform ones) and probably - most length miscalculation issues. Even Apple's Terminal.app can't do NFD - right. I wonder how Korean users navigate their filesystems in terminal. - -3. Plist XML. It's XML, but even worse. - -[^nfd]: NFD with an asterisk, i.e., not even NFD. According to Apple in - [an old Technical Q&A](https://developer.apple.com/library/mac/qa/qa1173/_index.html), - - > The terms used in this Q&A, precomposed and decomposed, roughly - > correspond to Unicode Normal Forms C and D, respectively. However, most - > volume formats do not follow the exact specification for these normal - > forms. For example, HFS Plus (Mac OS Extended) uses a variant of Normal - > Form D in which U+2000 through U+2FFF, U+F900 through U+FAFF, and U+2F800 - > through U+2FAFF are not decomposed (this avoids problems with round trip - > conversions from old Mac text encodings). It's likely that your volume - > format has similar oddities. - - They are conscious enough to call these oddities. diff --git a/source/blog/2016-01-18-me-too-comments-on-github.md b/source/blog/2016-01-18-me-too-comments-on-github.md deleted file mode 100644 index 3eb6220d..00000000 --- a/source/blog/2016-01-18-me-too-comments-on-github.md +++ /dev/null @@ -1,21 +0,0 @@ ---- -title: "Me-too comments on GitHub" -date: 2016-01-18T16:36:40-08:00 -date_display: January 18, 2016 ---- - -I frequently subscribe to issues on GitHub, be it bugs I want to see fixed or features I would like to see implemented. Then every once in a short while I get an email notification about one of those obnoxious "me too" or "+1" comments, by which I mean terse comments with little to no content other than "me too" or "+1" or some other variant bearing the same meaning. - -Me-too comments under bug reports are the most untolerable. If you have more details regarding the issue (e.g., a more reliable reproducer) or insights into what's really going on, then by any means post them. On the other hand, if you can't provide anything helpful, then just keep your mouth shut, and quietly press "subscribe" if you would like to be kept posted. Posting a me-too comment adds nothing to the discussion, does not expedite the resolution a tiny bit, and only serves to annoy all parties involved.^[There are exceptional cases.] As always, submit a patch if you're dissatisfied with the progress. Keep in mind that no one is obligated to fix bugs for you in FOSS.^[Here we're talking about the subset of FOSS that is also free as in beer.] - -Me-too comments under feature requests are more understandable, though I genuinely doubt that two or three people requesting a feature instead of one would make a big difference. After all, the issue tracker is not a feature voting platform; most folks understand this and behave themselves, so "me-too demand" isn't even remotely accurate at reflecting demand. - -Me-too folks: please stop being childish. If you have nothing to add, don't add anything (unless otherwise requested). - ---- - -**01/20/2015 Update.** I came accross [dear-githuub/dear-github](https://github.com/dear-github/dear-github) just now, which was started a mere six days ago, and the [open letter](https://github.com/dear-github/dear-github/blob/bc7a4f6bc78445905751061bf96f731edda14c25/README.md) of which also places +1 comments on its list of biggest problems on GitHub. - ---- - -**03/10/2015 Update.** GitHub is finally reacting. See [Add Reactions to Pull Requests, Issues, and Comments](https://github.com/blog/2119-add-reactions-to-pull-requests-issues-and-comments). diff --git a/source/blog/2016-01-24-antivirus-app-on-mas-top-chart.md b/source/blog/2016-01-24-antivirus-app-on-mas-top-chart.md deleted file mode 100644 index c7fcfc85..00000000 --- a/source/blog/2016-01-24-antivirus-app-on-mas-top-chart.md +++ /dev/null @@ -1,53 +0,0 @@ ---- -title: "Antivirus app on MAS top chart?" -date: 2016-01-24T18:43:28-08:00 -date_display: January 24, 2016 ---- - -Today for whatever reason I clicked on MAS's "Top Charts" page, and was immediately in for a surprise. Next to our great friend 1Password is an app called "AntiVirus Sentinel Pro", which sells for $9.99: - -![AntiVirus Sentinel "Pro". These days many people like to end their apps' names with "Pro", even when there's nothing pro about them. This "Pro" app, for instance, comes from a developer whose three out of four apps matches the regex `^([A-Z](a-z)+ )+Pro$`, and despite their names they are definitely geared towards uninformed newbies.](/img/20160124-mas-top-paid.png) - -The first rule of using MAS (or any kind of app store, for that matter) is that you research MAS apps outside the MAS. So let's Google "AntiVirus Sentinel Pro"... First result: [Apple Support forum thread](https://discussions.apple.com/thread/6749331) from late 2014, "Is AntiVirus Sentinel Pro legit? If not, how can I delete it?" Good question about any AV product. However, you'll immediately find it hilarious when you read on: - -> I have purchased and downloaded AntiVirus Sentinel Pro for Macintosh with Yosemite OS. I have a bad feeling this application is useless and maybe even harmful. Anyone knows if it is safe to use it? - -Okay, so why did you purchase it in the first place? I guess clueless users like this one are in every MAS developer's wet dreams. - -Let's continue with the Google search results. Second one is the iTunes preview link. Third one is a [YouTube video](http://www.securityfocus.eu/www/sentinel-pro.html) (also linked from MAS) which seems to be the only online documentation this app's got. Judging from the video the interface seems to be done in Java or something... Never mind that. Fourth result is a [rather recent thread](http://www.mac-forums.com/os-x-operating-system/327356-antivirus-sentinel-pro.html) (August 2015) from Mac Forums. Not this again: - -> I am a new Mac user. Can somebody answer these questions? Somehow it appears I have installed AntiVirus Sentinel Pro. What is this? Is it a real software? Should I keep it or try to uninstall it? - -The fifth and sixth results are general OS X AV product reviews that don't even mention this app. The next three results are from MAS aggregation sites. The last result on the first page is the app's product page on MacUpdate (now apparently abandoned), with a shiny 0.5/5 stars (note the zero point) badge. - -Now that we've finished the first page (and the results are not a bit reassuring), the question comes: where the heck is this app's home page? It's also not on the second page, actually. There's something interesting on the third (still no home page), that is [this tweet](https://twitter.com/claud_xiao/status/681981763938197504): - -> $10 "AntiVirus Sentinel Pro" got top2 in US Mac App Store and top1 in 48 countries--but it's just ClamAV+AdwareMedic signs+3 bullshit signs. - -Hmm. You might want to read Thomas Reed's (known for The Safe Mac) responses from that thread. - -Anyway, we were sidetracked. Back to the home page, actually this app does have one, but it's just [a single page](http://www.securityfocus.eu/www/sentinel-pro.html), which simply states some marketing bullshit and directs to MAS (where the same bullshit is repeated). Seriously? That's the best you can do for your "pro" app, especially a security-related one? - -Back to MAS, the reviews are kind of jokes, too: - -![Stupid reviews for stupid app.](/img/20160124-antivirus-sentinel-pro-reviews.png) - -The first one begins with - -> Just switched to Apple from Windows ... and researched anti-virus software. - -Don't really need to read further. - -Second one, speaking of customer service: - -> ... it only took one email to him explaining my problem... had a patch up and ready on the app store to download within hours. - -This review is from October 2015. Since when was MAS so efficient? Why do I (and everyone else keeping tabs on Apple stuff) keep hearing stories like [bug fix updates waiting for review after 59 days](http://mjtsai.com/blog/2015/12/01/sketch-leaving-the-mac-app-store/)? - -The pattern goes on. By the way, how does this app keep track of all disk and network activity when itself is running in a sandbox? No idea (maybe I'm misunderstanding sandboxing). - -In summary, even as an AV product, this one seems untrustworthy. Not to mention AV products on the Mac are generally superfluous if not harmful.[^1] What people really need to learn is to practice safe browsing habits and to properly use content blockers, which AV product vendors and (intrusive-)ad-supported websites (that is most, commercial websites today) won't tell you because they would go out of business if they do. - -And how this app got onto the top charts, that is a real mystery. - -[^1]: Disclaimer: I personally have used ClamXav and AdwareMedic (which has since been bought by Malwarebytes) before to help my social-engineered friend (tech support scam, in case you ask). Just to scan their documents though. It is my belief that once you're pwned (even slightly), clean system reinstall is the only way to go, despite what AV products might tell you. In addition, I don't use AV products myself (except Microsoft Security Essentials on Windows); as a programmer I've had enough bad experience with AV blocking *my* programs back in the Windows days. diff --git a/source/blog/2016-01-26-dropbox-noteworthy-and-damned-skeuomorphism.md b/source/blog/2016-01-26-dropbox-noteworthy-and-damned-skeuomorphism.md deleted file mode 100644 index b56d8cda..00000000 --- a/source/blog/2016-01-26-dropbox-noteworthy-and-damned-skeuomorphism.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -title: "Dropbox, Noteworthy, and damned skeuomorphism" -date: 2016-01-26T12:18:36-08:00 -date_display: January 26, 2016 ---- - -I just opened a note in a PDF within Dropbox's iOS app (never done that before), and instead of readable text what I saw was basically spaghetti: - -![|300| A PDF note in Dropbox iOS. Noteworthy (scream). I know there's a typo, by the way.](/img/20160126-dropbox-noteworthy.png) - -That font is unmistakably Noteworthy, the default font in Apple's Notes app in Mountain Lion, when Apple was still practicing the damned skeuomorphism. (In case you can't recall how it looked like, let me point you to [the John Siracusa review](http://arstechnica.com/apple/2012/07/os-x-10-8/7/#notes) for screenshots.) Just like your coworker's average handwritten notes, it is hardly legible and takes tremendous effort just to decode, especially when clustered in a paragraph rather than a short one-liner. Compare that to the same note, legibly rendered in Helvetica in PDF Expert: - -![|258| The same note (typo corrected) in PDF Expert Mac.](/img/20160126-pdf-expert-note.png) - -This is an example of sacrificing usability for design aesthetics (an old-fashioned one for that matter, and an abonimable one if you ask for my opinion). Hard to believe we can still see it in 2016, from an otherwise great developer that is Dropbox. diff --git a/source/blog/2016-03-06-google-chrome-keeps-getting-uglier.md b/source/blog/2016-03-06-google-chrome-keeps-getting-uglier.md deleted file mode 100644 index 19759284..00000000 --- a/source/blog/2016-03-06-google-chrome-keeps-getting-uglier.md +++ /dev/null @@ -1,60 +0,0 @@ ---- -title: "Google Chrome keeps getting uglier" -date: 2016-03-06T14:59:45-08:00 -date_display: March 6, 2016 ---- - -I hate to say this, but the Google Chrome team keeps making poor design decisions to make it more and more ugly. I still remember the sad day when the kind of cool wrench button gave way to the utterly boring hamburger one. I also remember the sad day when the omnibox dropdown [pointlessly went full width](https://bugs.chromium.org/p/chromium/issues/detail?id=276746) (after more than two years, I still fail to see how it makes any sense, although my eyes have long grown used to it).[^wontfix] And I'm sure there are other stupid changes that I can't name at the moment. - -Unfortunately, they just won't stop. [Four days ago](http://googlechromereleases.blogspot.com/2016/03/stable-channel-update.html) stable 49.0.2623.75 came out with a flurry of horrible visual changes. - -1. The icon. For whatever reason I have the impression that I might have seen this a while ago, but let's just pretend it's brand new. The new app icon is the most outrageously flat icon I've even seen. Compare it to that of 48.0.2564.103[^103]: - - ![|512| Old and new app icons side by side. To the left, [the 48.0.2564.103 icon](/img/20160306-chrome-mac-48.0.2564.103-icon.png); to the right, [the 49.0.2623.75 icon](/img/20160306-chrome-mac-49.0.2623.75-icon.png).](/img/20160306-chrome-mac-48.0.2564.103-49.0.2623.75-icons-side-by-side.png) - - And let's see them in action: - - ![|560| Both icons in the dock, old one the left and new one on the right.](/img/20160306-chrome-mac-48.0.2564.103-49.0.2623.75-icons-side-by-side-in-dock.png) - - Apart from flatness (lack of any gloss found in almost all Apple icons, however flattened they are), see how the new icon is notably larger than the old one, and any other circular icons for that matter. Apparently, consistency and guidelines mean nothing to them. - - I wonder why they made this change. Maybe for material design? I certainly don't want to see my Mac infested by material design, thank you. And maybe to keep the icon in line with their new Google branding? Indeed, just like [the new Google logo](https://web.archive.org/web/20160306221914/https://g-design.storage.googleapis.com/production/v5/assets/g-logo.png) which did away with serifs, this one has no depth at all and is very childish. - - It's a shame I can't just throw this icon out of my dock. Looks like in addition to iTunes now I have yet another icon to replace following each update, except this one updates much more often, and almost silently. - -2. Downloads. I almost thought I was hacked when I opened the Downloads tab and saw - - ![|848| Downloads in 49.0.2623.75.](/img/20160306-chrome-mac-49.0.2623.75-downloads.png) - - instead of a nice and clean - - ![|728| Downloads in 48.0.2564.103.](/img/20160306-chrome-mac-48.0.2564.103-downloads.png) - - Materail design infestation, apparently. Funny how they managed to convey less info in a LOT more space, and look horrible at the same time. At least they can choose a pleasant color palette if they want to use color (which is totally unnecessary as seen from the old design)? No, they can't. - -3. Incognito mode. There's a reason why books are printed on light-colored paper, and there's a reason why the web is predominantly light-backgrounded, including user agent default style sheets. The old incognito follows the light background rule, plus a non-intrusive notice in the middle and a reasonably shaded tab bar to indicate incognito status: - - ![|893| Incognito window in 48.0.2564.103.](/img/20160306-chrome-mac-48.0.2564.103-incognito.png) - - But not anymore. Since those of you using Incognito mode must be conducting shady business, why not highlight that with a black background: - - ![|625| Incognito window in 49.0.2623.75. Even more shocking if you maximize your browser windows.](/img/20160306-chrome-mac-49.0.2623.75-incognito.png) - - Oh. My. God. Now I hesitate whenever I want to press ⇧⌘N; it's just too great a cultural shock for me to handle. - -Those are just three changes I've discovered so far. Hopefully there are no more lurking surprises. - -Conclusion? Sigh. - ---- - -**03/09/2016 update**. They also broke showing/hiding extension buttons (from toolbar) recently, probably in the same update. We used to be able to reshow a hidden button from `chrome://extensions`; that's no longer possible. Now we need to click on the hamburger (great), right click on one of the hidden buttons — which temporarily promotes the button to the toolbar and display the context menu, and while the context menu is still on, click on "Keep in Toolbar". So intuitive, your average computer users are definitely going to figure that out by themselves. Very nice. - - -[^103]: I realized the last stable was 48.0.2564.109 instead of 48.0.2564.103 only after taking the screenshots. Doesn't matter anyway. - -[^wontfix]: Dev left a [comment](https://bugs.chromium.org/p/chromium/issues/detail?id=276746#c28) when marking that issue as wont fix: - - > ... The current look is a precursor to a family of related work to make the Omnibox better, so expect to see more investment in this space to come. ... - - A family of related work? After 2.5 years the omnibox looks almost exactly the same as the screenshot in the issue. More to come my ass. Maybe I should be grateful, at least it didn't get worse. diff --git a/source/blog/2016-04-10-emacss-got-a-redesigned-website.md b/source/blog/2016-04-10-emacss-got-a-redesigned-website.md deleted file mode 100644 index 3a270ec5..00000000 --- a/source/blog/2016-04-10-emacss-got-a-redesigned-website.md +++ /dev/null @@ -1,24 +0,0 @@ ---- -title: "Emacs's got a redesigned website!" -date: 2016-04-10T03:04:19-07:00 -date_display: April 10, 2016 ---- - -I've been very busy lately, so I haven't posted anything for a month. As a result, I have many topic notes sitting in Notes.app — including the kik-left-pad-npm drama, the Text Expander outcry, and such — waiting to be organized and written up (I'll probably never write them up in the end, since these days it's very weird to write an opinion piece about an event whose attention span has already lapsed). - -Anyway, this will be a short post about Emacs's [redesigned website](https://gnu.org/software/emacs/). See screenshot at the end. Apparently this was [last week's news](https://twitter.com/NicolasPetton/status/714854524108800000), but there's little interest in Emacs in general, so the news only reached me two days ago, sort of by chance. - -According my impression, Emacs has been the underdog for quite some time. First, when you compare to vi/Vim, hard stats shed light on popularity: there are way more VimL repos than Elisp ones on GitHub.[^github] Also, there are more exciting (or at least exciting-sounding or excitement-inducing) things happening in the Vim realm, e.g. Neovim, but not so much in the Emacs kingdom (excuse me if I missed something big). I'm actually very curious how Vim sold itself to so many people. I, for one, can't tolerate the Esc key at all (yes, I know basic editing in Vim, and I know the various workarounds to Esc, some of them reasonable and some not). I can't understand how people could laugh at Escape Meta Alt Control Shift — oh, I never used Esc in Emacs once, by the way — when the single most awkward Esc key serves a fundamental purpose by default in their own beloved editor. The Esc key is of course not my only gripe with Vim, nor the biggest; I'll however stop here to avoid turing this post into a complaint about Vim. Apart from Vim, Emacs is also being sidelined by more modern GUI-based text editors like Atom,[^emacs-gui] or various IDEs. Atom [recently](http://blog.atom.io/2016/03/28/atom-reaches-1m-users.html) reached one million monthly active users. I actually like certain parts of Atom a lot, e.g. the project navigation sidebar,[^navigation] but I simply can't give up my good ol' tty. - -Personal preferences aside, I think Emacs does need a bit more publicity to draw a few more users. Whether redesigning the website will help at all I don't know; maybe the effect will be statistically indistinguishable from zero, but the bottom line is that people like pretty websites, so why not. The redesigned homepage is a bit more graphics-heavy, but it currently weighs a total of 521.33KB — within the tolerable range. - -The most interesting thing I found on the redesigned homepage is the link to [emacsrocks.com](http://emacsrocks.com). I aimlessly clicked on the last episode — [episode 15](http://emacsrocks.com/e15.html) — just to see what it was like, and ended up astonished. The episode is about [`restclient.el`](https://github.com/pashky/restclient.el), which turned out to be wicked cool. In the real world it's probably a little bit too geeky to my liking, and I use the more mundane (and more powerful) [Paw](https://luckymarmot.com/paw) as my REST client, but I can't stop admiring the beauty of `restclient-mode`. I'll definitely find time to watch all episodes of Emacs Rocks, and you probably should, too. - -![|720| A scaled down screenshot of the redesigned [gnu.org/software/emacs](https://gnu.org/software/emacs/). Full screenshot on my 2880x1800 MBP is [here](/img/20160409-emacs-website-screenshot.png). Actually I lied a bit — the screenshots were taken with [`pageres`](https://github.com/sindresorhus/pageres), so I could have specified any resolution.](/img/20160409-emacs-website-screenshot-half-size.png) - - -[^github]: According to [GitHut](http://githut.info/), in 2014 Q4, there were 22,450 VimL and 9,978 Elisp repositories on GitHub, respectively. And according to a real time search I did just now, the [VimL number](https://github.com/search?q=language%3AVimL) has risen to 82,519 and the [Elisp number](https://github.com/search?q=language%3AElisp) to 30,320. The ratio has risen from 2.25:1 to 2.72:1. To add insult to injury, on GitHub's [advanced search page](https://github.com/search/advanced), GitHub lists VimL in the "Popular" language section and Elisp in "Everything else". Hurt feelings anyone? - -[^emacs-gui]: Of course Emacs can operate in standalone GUI mode (or more precisely, window system mode), and more can be done in GUI mode (both in terms of customizability and functinality). However, in my early days with Emacs I found the GUI look like crap — the default always does, even to this day. I can never bring myself to use anything crappy-looking, unless I've got no choice, so I went with the TUI. Later I learned how to make the GUI habitable (still not as nice as the uniformity I find in tty, though), but by that time I'm already totally in love with tty mode and probably will never switch. - -[^navigation]: In Emacs I have ido, fiplr and sr-speedbar to help with navigation, but this is one area where a graphical sidebar really shines. diff --git a/source/blog/2016-05-07-chrome-is-screwing-with-our-extensions-again.md b/source/blog/2016-05-07-chrome-is-screwing-with-our-extensions-again.md deleted file mode 100644 index 8f12bbb3..00000000 --- a/source/blog/2016-05-07-chrome-is-screwing-with-our-extensions-again.md +++ /dev/null @@ -1,32 +0,0 @@ ---- -title: "Chrome is screwing with our extensions... Again" -date: 2016-05-07T18:49:26-07:00 -date_display: May 7, 2016 ---- - -Chrome is growing more and more hostile by the day. See [Google Chrome keeps getting uglier](/blog/2016-03-06-google-chrome-keeps-getting-uglier.html) for an earlier take. What I didn't report in the earlier post is that not only can't you show/hide extension buttons as easily as before, you can't even control which buttons appear in the toolbar anymore — they come and go as they wish. - -As if screwing the app icon, extension buttons and the overall design is not enough, now they have upped their game again. I'm running Chrome 50.0.2661.94 from April 28, and I just rebooted my machine only to be greeted with a fleeting "unsupported extensions" (or something like that) message as I launched Chrome. I digged into the extensions page, and guess what, all sideloaded extensions (except unpacked ones) have been disabled.[^first] This in itself may not be too surprising (Google took away sideloaded extensions from non-developers last year), except that **the "enable" button, which used to work at least in developer mode, doesn't function anymore.** The message is very stupid: - -> This extension is not listed in the Chrome Web Store and **may** have been added without your knowledge. - -Bold by me. Okay, so what if they have been added **with my knowledge**? No way to enable legit extensions (some written by none other than myself) just because of a "may"? Here's the [only migration path](https://support.google.com/chrome/answer/2811969) they offer, by the way: - -> If you need to use a disabled extension, you can contact the extension's developer and ask them to upload their extension to the Chrome Web Store. - -Seriously? Do they honestly think Chrome Web Store serves everyone's needs? First, they have every right to refuse or take down any extension in their store. This is dangerous. What if one day they conclude that Adblock Plus is hurting their ad revenue too much and decide to take it down? Secondly, people may not want to make every extension publicly available. For instance, I have some personal extensions that I have developed on my dev machine, packaged into .crx, and installed on other machines. Some of these are publicly available (on GitHub), and others are not. It's not hard to conclude that other people may have private extensions too, and there may be extensions that are only available in some private circles. Now, people have to load unpacked extensions, which is much easier to screw up for regular folks, or they're out of luck. - -To add insult to injury, every time I launch Chrome now, I'm greeted by this "Disable Developer Mode Extensions" message: - -> Extensions running in developer mode can harm your computer. If you're not a developer, you should disable these extensions running in developer mode to stay safe. - -As if there're not enough malicious extensions in the Chrome Web Store, let alone crap. May I tell Chrome that I *am* a developer and ask it to shut up? Apparently no. - -With the current trend in Chrome, I might want to switch to Opera again.[^safari] The only thing preventing me from doing so right now is their new [horrendous-looking fat icon](https://i.imgur.com/F8Tc67m.png). However, Chrome has also destroyed their icon and I need to [replace it](https://github.com/zmwangx/fileicon) after every update anyway, so I might as well do the same thing for Opera. We'll see. - - -[^first]: I'm not sure why they weren't disabled upon first launch after the update, but given the randomness of extension buttons in my toolbar with hardly any action on my part, I won't be surprised if I were told that they had messed up the extension system completely. - -[^safari]: Modern day Safari is also pretty nice, and the team is showing great attitude lately, with Safari Technology Preview and tweets like [this one](https://twitter.com/webkit/status/725725657548738561), for instance. However, the lack of extensions is a big road block, and the fact that the used-to-be-free Safari Developer Program has been incorporated into the $99/yr Apple Developer Program certainly doesn't help. (I used to be a member. Now I've been kicked out.) - - Note that Safari is more locked down in a sense compared to OS X and iOS. On OS X you can apparently run unsigned software; on iOS 9 and later you can create personal provisioning profiles with just an Apple ID. Neither is true for Safari extensions, which still require a signing key from developer program membership. I wonder if Apple will introduce free keys for personal use on Safari, too. diff --git a/source/blog/2016-06-04-Mode-kiosk-sur-une-Raspberry-Pi-1.md b/source/blog/2016-06-04-Mode-kiosk-sur-une-Raspberry-Pi-1.md new file mode 100644 index 00000000..8944f5b1 --- /dev/null +++ b/source/blog/2016-06-04-Mode-kiosk-sur-une-Raspberry-Pi-1.md @@ -0,0 +1,140 @@ +--- +title: "Mode kiosk sur une Raspberry Pi 1" +date: 2016-06-04T00:37:05+02:00 +date_display: Jun 04, 2016 +--- + +# Mise en place du système + +Pour l'un de mes stages il y a quelques semaines, je devais réaliser un écran connecté afin de faire un show room pour une entreprise mais le matériel fournis étant une Raspberry Pi 1, je me suis tout de suite douté qu'il risquait d'avoir des problèmes de performances. De plus pour faire cet écran connecté, le chef de projet avait décidé de le faire en web, peut être qu'il aurait été préférable de le faire avec une autre techno, je ne sais pas car je n'ai pas étudié la question. + +Mais des problèmes de performances, oh que oui j'en ai rencontrés ! + +Pour commencer, je ne connaissais pas les configurations déjà présentes sur la carte et dès que j'ai commencé à mettre en un peu de JS dans mon code pour la page web, le navigateur n'a pas arrété de crasher au démarrage de la rasp. + +Bon, après le changement de la conf sur plusieurs navigateurs, de changement de gestionnaire de fenêtre j'ai ai eu marre et j'ai décidé de changer directement de distribution. Ah oui, car la rasp était de base sur une raspbian, alors j'ai installé un archlinux dessus et depuis elle va beaucoup mieux, par contre je ne vous cache pas que le JS est toujours lent mais fonctionnel. + +EDIT: tinycorelinux aurait pus être une alternative aussi... + +Pour l'installation d'Archlinux, pas besoin d'expliquer comment faire, la doc sur leur site est très bien mais je vous mets quand même un [lien](https://archlinuxarm.org/platforms/armv6/raspberry-pi/#installation) car je suis gentil. ;) + +--------------------- + +{{icon>exclamation-triangle?128&color=#D16900}} Avant d'aller plus loin, je vous conseille viviement de changer les mots de passe des comptes `root` et `alarm` ! + +--------------------- + +Après l'installation, j'ai dû installer quelques paquets, que voici : + +Pour la partie graphique : + + * xorg-server + * xorg-xinit + * matchbox-window-manager + * xf86-video-fbdev + * xorg-xset + * fbset + * xwit (aur) + +Et pour la partie serveur web : + + * php + * php-apache + * php-mcrypt + * apache + +# Mise en place du démarrage automatique du navigateur lors de la connexion + +Bon avant d'automatiser le tout nous allons faire en sorte que notre interface graphique démarre sans encombre. Pour ça nous allons créer le fichier `.xinitrc` ou le modifier si celui-ci est déja présent, voila à quoi ressemble mon fichier de conf: + +```sh +#!/bin/sh +while true; do + # Disable DPMS / Screen blanking + xset -dpms + xset s off + + # Reset the framebuffer's colour-depth + fbset -depth $( cat /sys/module/*fb*/parameters/fbdepth ); + + # Hide the cursor (move it to the bottom-right, comment out if you want mouse interaction) + xwit -root -warp $( cat /sys/module/*fb*/parameters/fbwidth ) $( cat /sys/module/*fb*/parameters/fbheight ) + + # Démarre le gestionnaire de fenétre (suprimer "-use_cursor no" si vous vouler l'intégration de la souris) + matchbox-window-manager -use_titlebar no -use_cursor no & + midori -a http://127.0.0.1/Magpie-box -e Fullscreen +done; +``` + +Je précise que dans le cas actuel ma boucle permet de redémarer le navigateur en cas de crash de celui-ci au cas où... +Et pour démarrer cette interface graphique un simple coup de `startx` et c'est plié. + +# Configuration du navigateur + +On va s'occuper de l'étape où j'ai passé la plus part de mon temps, la configuration du navigateur. Car après m'être littéralement battu avec eux j'ai enfin trouvé la solution ! Sur la Raspberry Pi 1 seulement midori et firefox pouvaient tourner mais le problème est le suivant : + + * Midori prend peu de ressources mais a quelques soucis avec le javascript; + * Firefox gère très bien le javascript mais prend trop de ressources pour la rasp -- je parle du cas où il y a des images plutôt lourdes à charger, ce qui était mon cas pour le projet malheureusement :/ + +Midori pose aussi problème lorsqu'on éteint et qu'on redémmare la rasp de manière brutale, physiquement, le navigateur tente de recharger l'onglet fermé mais n'y arrive pas et du coup il faut rafraichir la page à la main mais je n'ai pas trouvé le moyen de désactiver ce fichu plugin malheureusement. + +Donc j'ai opté pour firefox, par contre le mode kiosk n'est possible qu'en installant un plugin et cela ce fait de manière graphique, je n'ai pas encore regardé pour le faire via le terminal. Il faut commencer par modifier la config en tapant dans la bar d'adresse `about:config` et approuver qu'on ne va pas tout casser. Après on change l'option de vérifiction de la signature du plugin de true à false : je ne comprends pas trop + +``` +xpinstall.signatures.required false +``` + +Et maintenant on installe le [plugin](https://github.com/NeodarZ/r-kiosk/blob/master/build/r_kiosk.xpi). + +EDIT: luakit est une alternative à ne pas écarter mais [qutebrowser](https://qutebrowser.org) semble être une meilleur alternative... ;) + +## Configuration du serveur web + +Une fois ceci configuré, il faut configurer le serveur web pour qu'il soit compatible avec php7, pour cela il faut éditer le fichier `/etc/httpd/conf/httpd.conf` et commenter la ligne suivante : + +``` +LoadModule mpm_event_module modules/mod_mpm_event.so +``` + +Afin de décommenter la ligne suivante : + + +``` +LoadModule mpm_prefork_module modules/mod_mpm_prefork.so +``` + +Ah et ne pas oublier de rajouter cette ligne à la fin : + +``` +Include conf/extra/php7_module.conf +``` + +## Mise en place de la connection automatique + +Maintenant que notre interface graphique démarre tranquillement, on va pouvoir automatiser le tout, pour cela on va commencer par faire en sorte que la connection soit automatique pour cela on crée le dossier suivant : `/etc/systemd/system/getty@tty1.service.d/` + +Et enfin créer et modifier le fichier suivant : `/etc/systemd/system/getty@tty1.service.d/override.conf` : + +``` +[Service] +ExecStart= +ExecStart=-/sbin/agetty --autologin alarm --noclear %I 38400 linux +``` + +On peut remarquer que j'ai mis deux fois `ExecStart=`, ce n'est pas une erreur, c'est juste que ma rasp ne voulait pas booter automatiquement avec un seul alors qu'avec deux, c'était nickel... Aller savoir pourquoi ^^ + +Bon maintenant que notre session se lance il va faloir faire en sorte que notre belle interface graphique se lance toute seule comme une grande, alors pour ça il faut commencer par copier le fichier suivant : `/etc/skel/.bash_profile` et ajouter à la fin : + +```sh +[[ -z $DISPLAY && $XDG_VTNR -eq 1 ]] && exec startx +``` + +Et là on se dit, oui c'est fini ! Et bien non ! :p +Ce serait trop facile. Pour faire simple, il faut juste autoriser n'importe quel utilisateur à lancer le serveur Xorg. Pour cela il vous faut créer et modifier le fichier `/etc/X11/Xwrapper.config` et ajouter cette ligne : + +``` +allowed_users=anybody +``` + +Et voila maintenant c'est bon, nous pouvons profiter de notre mode kiosk fraichement installé ! ;) +Personnellement je ne vous cache pas que je me suis battu avec la conf de mon navigateur qui finalement démarre sans trop de difficulté... diff --git a/source/blog/2016-06-24-its-2016-and-microsoft-is-the-only-legit-player-who-spams-me-without-unsubscribe-links.md b/source/blog/2016-06-24-its-2016-and-microsoft-is-the-only-legit-player-who-spams-me-without-unsubscribe-links.md deleted file mode 100644 index 3a15dc0e..00000000 --- a/source/blog/2016-06-24-its-2016-and-microsoft-is-the-only-legit-player-who-spams-me-without-unsubscribe-links.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -title: "It's 2016, and Microsoft is the only legit player who spams me without unsubscribe links" -date: 2016-06-24T05:40:01+08:00 -date_display: June 24, 2016 ---- - -I'm so tired of Microsoft spam. Microsoft is known for being intrusive accross the board, and their newsletters are no different: I literally can't name one legit company in this day and age who doesn't put unsubscribe links in newsletters.[^amazon] I get "Azure pricing and services updates" newsletters all the time, as well as "exciting news" from Windows Insider Program (which doesn't excite me at all) every once in a short while.[^insider] I still occasionally receive random Chinese language promotions of Windows, presumably because I used a Windows Phone as my secondary phone for three months back home in the summer of 2013 (which was a horrible experience). Why Microsoft hasn't been regulated for spam yet, I do not know. - -[^amazon]: To be fair, Amazon used to force promotional email on student members, but (if memory serves) I haven't seen one in ages. - -[^insider]: "If you wish to stop receiving Windows Insider Program emails, you will need to leave the program." I guess that's the price of downloading a couple of Windows 10 insider builds. diff --git a/source/blog/2016-09-01-this-blog-is-now-behind-cloudflare.md b/source/blog/2016-09-01-this-blog-is-now-behind-cloudflare.md deleted file mode 100644 index 8bfde9b3..00000000 --- a/source/blog/2016-09-01-this-blog-is-now-behind-cloudflare.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -title: "This blog is now behind CloudFlare" -date: 2016-09-01T20:11:00+08:00 -date_display: September 1, 2016 ---- - -Back in July I registered the domain [zhimingwang.org](http://zhimingwang.org) and pointed this GitHub Pages-powered blog at it. Since then I have lost the HTTPS badge due to GitHub Pages not supporting HTTPS on custom domains (see [isaacs/github#156](https://github.com/isaacs/github/issues/156)). - -There have been a lot of discussions on isaacs/github#156 (and stupid [+1's](/blog/2016-01-18-me-too-comments-on-github.html) too). Among the proposed solutions is putting the website behind CloudFlare. I carefully investigated [this option](https://blog.cloudflare.com/secure-and-fast-github-pages-with-cloudflare/) and read almost all the arguments against it. I fully understand CloudFlare's SSL models (summarized in the image below), and I do realize most if not all of the limitations of CloudFlare, including CloudFlare being a huge MITM (which is inevitable for a CDN anyway), as well as most if not all of its annoyances, including CAPTCHAs which I myself would occasionally run into when I'm browsing with PIA VPN, and JavaScript-based browser checks. - -![|500| CloudFlare's SSL modes. I use the Full SSL mode so that both ends of the connection are encrypted. Again, I know CloudFlare is a big MITM and could be a high profile target. Credit: [CloudFlare](https://blog.cloudflare.com/secure-and-fast-github-pages-with-cloudflare/).](/img/20160901-cloudflare-ssl-modes.png) - -After careful evaluation, I decided that CloudFlare's SSL model is good enough for me. After all, this is just a damn blog, with nothing sensitive. TLS is still nice because it guards against prying eyes and unethical ad-injecting ISPs or Wi-Fi hotspots, but other than that, it isn't necessary. - -End result: this blog is now behind CloudFlare. Readers should now see that green HTTPS badge again (note that I'm enforcing HTTPS — without HSTS though). As for CAPTCHAs, I have adjusted the firewall settings on CloudFlare's dashboard — "Security Level" to "Essentially Off" and "Challenge Passage" to 1 year, so hopefully it won't be too annoying.[^tor] - -[^tor]: I don't use Tor, and don't intend to raise Big Brother's suspicion by using it, so I have no idea of the actual Tor experience. - -**09/01/2016 Update.** I just realized that [CloudFlare supports whitelisting Tor traffic](https://support.cloudflare.com/hc/en-us/articles/203306930-Does-CloudFlare-block-Tor-). Did that. diff --git a/source/blog/2016-10-26-pyenv-compiling-python-with-sqlite-in-nonstandard-location.md b/source/blog/2016-10-26-pyenv-compiling-python-with-sqlite-in-nonstandard-location.md deleted file mode 100644 index 96530740..00000000 --- a/source/blog/2016-10-26-pyenv-compiling-python-with-sqlite-in-nonstandard-location.md +++ /dev/null @@ -1,48 +0,0 @@ ---- -title: "pyenv: compiling Python with SQLite in nonstandard location" -date: 2016-10-26T12:16:22-04:00 -date_display: October 26, 2016 ---- - -This is a quick post sharing a workaround that I needed just now. - -I was trying to compile Pythons with pyenv on a RHEL 6.8 cluster. Unfortunately `sqlite-devel` is not installed and I doubt I can convince my sysadmin to install a package for me. The lack of SQLite headers resulted in Pythons without `_sqlite3` which is essential for me. Hinting at SQLite headers from Linuxbrew with `CPATH` did not help either. - -Digging into CPython source code, turns out that CPython only looks into [a fixed set of paths](https://github.com/python/cpython/blob/59fa72e34da71fb24f52251c1cc88ed3c3b14797/setup.py#L1132-L1138): - -```python -sqlite_inc_paths = [ '/usr/include', - '/usr/include/sqlite', - '/usr/include/sqlite3', - '/usr/local/include', - '/usr/local/include/sqlite', - '/usr/local/include/sqlite3', - ] -if cross_compiling: - sqlite_inc_paths = [] -``` - -Well that's unfortunate. Luckily pyenv makes it really easy to patch Python source code; take a look at [`plugins/python-build/share/python-build/patches`](https://github.com/yyuu/pyenv/tree/master/plugins/python-build/share/python-build/patches) and you'll get the idea. Therefore, in the case of Linuxbrew'ed pyenv and SQLite, say we want to build Python 3.5.2 with SQLite support, we simply put the following patch at `~/.linuxbrew/opt/pyenv/plugins/python-build/share/python-build/patches/3.5.2/Python-3.5.2/linuxbrew-sqlite3.patch`: - -```diff -diff --git a/setup.py b/setup.py -index 174ce72..774fd65 100644 ---- a/setup.py -+++ b/setup.py -@@ -1108,6 +1108,7 @@ class PyBuildExt(build_ext): - '/usr/local/include', - '/usr/local/include/sqlite', - '/usr/local/include/sqlite3', -+ os.path.expanduser('~/.linuxbrew/opt/sqlite/include/'), - ] - if cross_compiling: - sqlite_inc_paths = [] -``` - -That's it. Now - -``` -$ pyenv install 3.5.2 -``` - -and enjoy. diff --git a/source/blog/2017-04-28-test-ee.md b/source/blog/2017-04-28-test-ee.md deleted file mode 100644 index 409099bb..00000000 --- a/source/blog/2017-04-28-test-ee.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -title: "Test ee" -date: 2017-04-28T00:37:05+02:00 -date_display: April 28, 2017 ---- - -Yolo !!!!! diff --git a/source/css/jquery.jscrollpane.css b/source/css/jquery.jscrollpane.css new file mode 100644 index 00000000..57ccca25 --- /dev/null +++ b/source/css/jquery.jscrollpane.css @@ -0,0 +1,115 @@ +/* + * CSS Styles that are needed by jScrollPane for it to operate correctly. + * + * Include this stylesheet in your site or copy and paste the styles below into your stylesheet - jScrollPane + * may not operate correctly without them. + */ + +.jspContainer +{ + overflow: hidden; + position: relative; +} + +.jspPane +{ + position: absolute; +} + +.jspVerticalBar +{ + position: absolute; + top: 0; + right: 0; + width: 16px; + height: 100%; + background: red; +} + +.jspHorizontalBar +{ + position: absolute; + bottom: 0; + left: 0; + width: 100%; + height: 16px; + background: red; +} + +.jspCap +{ + display: none; +} + +.jspHorizontalBar .jspCap +{ + float: left; +} + +.jspTrack +{ + background: #dde; + position: relative; +} + +.jspDrag +{ + background: #bbd; + position: relative; + top: 0; + left: 0; + cursor: pointer; +} + +.jspHorizontalBar .jspTrack, +.jspHorizontalBar .jspDrag +{ + float: left; + height: 100%; +} + +.jspArrow +{ + background: #50506d; + text-indent: -20000px; + display: block; + cursor: pointer; + padding: 0; + margin: 0; +} + +.jspArrow.jspDisabled +{ + cursor: default; + background: #80808d; +} + +.jspVerticalBar .jspArrow +{ + height: 16px; +} + +.jspHorizontalBar .jspArrow +{ + width: 16px; + float: left; + height: 100%; +} + +.jspVerticalBar .jspArrow:focus +{ + outline: none; +} + +.jspCorner +{ + background: #eeeef4; + float: left; + height: 100%; +} + +/* Yuk! CSS Hack for IE6 3 pixel bug :( */ +* html .jspCorner +{ + margin: 0 -3px 0 0; +}
\ No newline at end of file diff --git a/source/css/theme.css b/source/css/theme.css index e3e2125a..081a23d7 100644 --- a/source/css/theme.css +++ b/source/css/theme.css @@ -17,20 +17,12 @@ body { background-color: #000; color: #fff; - font-family: Times, "Times New Roman", - /* Chinese fonts */ - "Kaiti SC", /* macOS */ - "Songti SC", /* macOS 10.12+ where Kaiti SC isn't installed by default - but is instead available as a downloadable component */ - KaiTi, /* Windows (simkai.ttf, not always included despite - https://www.microsoft.com/typography/fonts/product.aspx?PID=161 - https://www.microsoft.com/typography/fonts/product.aspx?PID=164) */ - "Microsoft YaHei", /* Windows */ - "Heiti SC", /* iOS */ + font-family: "monospace", + "helvetica", serif; - font-size: 16px; + font-size: 12px; -webkit-font-smoothing: antialiased; - margin: 100px 0; + margin: 0 0 100px 0; } .bodya { @@ -84,7 +76,8 @@ only screen and ( min-resolution: 1.25dppx) { display: inline-block; position: relative; left: 2px; - font-family: "Helvetica Neue", Arial, sans-serif; + font-family: "monospace", + "helvetica", Arial, sans-serif; font-size: 35px; font-weight: normal; letter-spacing: 2px; @@ -170,10 +163,10 @@ a .active { color: #fff; } -p, h2, ul { +/*p, h2, ul { padding-left: 10vw; padding-right: 10vw; -} +}*/ code { font-size: 90%; @@ -307,7 +300,7 @@ noscript a { .rss-icon:before, .atom-icon:before { content: "\e800"; - font-family: fontello; + font-family: "monospace","helvetica"; font-size: 105%; } @@ -319,15 +312,28 @@ noscript a { .cc-icon:before { content: "\e801"; - font-family: fontello; + font-family: "monospace","helvetica"; font-size: 95%; } -.header { +.title-header { display: table; margin: 0 auto; } +.link-header { + text-decoration: none; +} + +table { + text-align: center; + width: 100%; +} + +.ouer { + display: block; +} + .code-outer { margin-left: 1vw; width: 65%; @@ -335,7 +341,7 @@ noscript a { margin-bottom: 1vw; border: 1px solid #fff; overflow: auto; - font-family: monospace; + font-family: "monospace","helvetica"; } .left-h1 { @@ -373,14 +379,14 @@ noscript a { @media screen and (max-width: 1023px) { body { - margin: 40px 0 100px 0; + margin: 0 0 100px 0; } .nav { position: static; width: 100%; height: 150px; - margin: 80px 0 20px 0; + margin: 20px 0 80px 0; } .nav-icon { @@ -408,6 +414,10 @@ noscript a { /*** Ultranarrow screen ***/ @media screen and (max-width: 500px) { + .outer { + display: none; + } + .content, .content-separator, .footer { width: 90%; } diff --git a/source/gpg/corentin.breton@neodarz.net.public.asc b/source/gpg/corentin.breton@neodarz.net.public.asc new file mode 100644 index 00000000..0f3650ac --- /dev/null +++ b/source/gpg/corentin.breton@neodarz.net.public.asc @@ -0,0 +1,51 @@ +-----BEGIN PGP PUBLIC KEY BLOCK----- + +mQINBFgAfzUBEACy8gjyBG5YUR/xk3MS7fjwHpq6mOtTefar47VkpQ5RbSBSEmG9 +yphVT3yS8/CIZfUwt3c1esBCPNArdmoTYZXhYADRtawp9aRm7G5XUcOojJFV/nDP +VCnfDSUFVMXb2HVl9JlHMNGQbmDq+Lwv4aQQsxi+wEJ17wmkfWQmZo7FekJkzB7r +8alVKM95OFLHuj1ZmZQfY0arzwn6LNunoGjzh0QmTVQv95ze+WBxOeUUjrb2QFmU +jW8fF0/JifeXplwqLy6ErB2cKZRQicdYxcUuohx+KkYnk3Ij1iLFxZJjYjWlci1h +XBn7WJ1zx8acWfDsCQ/eDfR6fweUnKt9qDarbJGDrCdhvyOUJFCFe6L2KR/fmeek +wK0U0VjiAAeTed/W1OVIN7BspnAWZjGXL2nSfzhUC+DqysSSYXqmCfFLpC7jPmdU +rINiRY3TLUP7gNcmcXGOkDOoJJCzBPuwMbYp5H1Phs5CE3XVlZ+X2YXWjG4794r1 +QJ5bU/mfywLz3rn9aw6xh/bj5mc75bOEJWyFSPhERb7zzViKKb5qg6sZU2iWXoEk +YmBjvxyhWLsElUJUOZFu/CNV9a4P514H+AKaCyfqLKwDylKamIwa3S/3HeR7cO7w +87HDommD5+S+yWSvTDdFSycRz7RBOhBFOYR0nV9CQGIkYmmPLb97Pii5wQARAQAB +tC1Db3JlbnRpbiBCcmV0b24gPGNvcmVudGluLmJyZXRvbkBuZW9kYXJ6Lm5ldD6J +Aj0EEwEIACcFAlgAfzUCGwMFCQHhM4AFCwkIBwIGFQgJCgsCBBYCAwECHgECF4AA +CgkQkF6rkld9pCxJGQ//ffMVDNgaXNsHKvFnvo2wOvSkgY/K8OxdcOILNJ4oo+Ki +QJEmlUM7RcvEyWcmaddFe9eULf0lF17rK2nnnS4Mz26XZBv/6ZdZKX4Mk11LRMAL +1L47aYcA0XTrNCfJVn5yBlsu5u/bKI6TK85uOcfS8VXpapPpNtSzXfjzaXDoIy3M +EPiBl0BMlZykvN6QZYA0tprB8q0oxFlBGq8RYjNQrXewZ9o1DvrcmarYkiVB7BZm +BnywQlHTKVfNd87OkC2SnuGHkWXgx98VEj7IpfR/8hDsGj+5luvHVpKLCBTXbSVl +oA3Vcttj5gVi4TsQq5VyilyGZzkY4HLJLrCfEbLjy4EWAKK9RYlrgpyuczYXziLc +eLVRKKDz4EYNAAgXcUwweUhAr8MecdgdoQjvV2ywGTxCtM5WnbYVGtWzK6M7rOgP +pheGKPNY5gc9f/jPJgHUJQyE/U1GQ2j/imP6k0J0bFBzC5jUgErVieNhZU1go+uD +XSd+RGy8ulNdUC8HU67meZRLdApeOa9t4zIak5XnxYNvc3+FhG3pcM94UIsMfk7p +IY5BeutCqQFOFoN3mjE+iv9HQ3mdOQ/ge7SZ5Sr9k2MS2dSKmXYEp+6LUG0QvmZT +ivW81kBufMFmMNsGfXTsCSMNvS0p0fPEV335w8RehieF4LJkJAg3l/9cuscCM365 +Ag0EWAB/NQEQAML+H3NvIVbYx9IVlKjPZ+TvtocTQOOh0HtXv+PCmotvSHx7kViK +49Vqq6VWjYd88Nf9l/duyFlrOFPbXRuJKT9vrTYm2f9pZ8KveHhNhF83WDCfZMmN +V+Gu5/w+pCtaXHL1ALNeGVMICdF7vualKf/72z5m2KQUFwfMEABZF7lb47Th86v7 +vndM1z5ATXPzc/YaMmOODX9Wz3Cx7K6KJ3OrTlsmFwh5ITu+GQS5iIS5IPgb0Th4 +DbPupRGDldGH3BFEYqOhhtT6xvPwksFwYl1g1YT516kYQRwrHSVDeQfrN1oOM0Ye +OY1FzrTFdwQS8kc8jGNs+bQuGO5ZBK3z6t05Zq6i/3V9tjX819vaNhk6AeL65T5C +JHuIz3Q/ISuKnfj9WbfBvfTzT4ZXRfb72BXHLSYf3qPxwXO5VLaiWKpwd30I93hK +bH+P7z4ZSGixwVM4ccUnGkP0enPJAlyY6KtlmxHn3i+gupjEwnIwelCkRn9MWx7S +aX3Uzi0jyDFQovJ7XfezutgtV6Y55VBf1QLI1cpFW5Szgm3boCXM1lbnCiwLzgxK +dASsEOUURIyFfv+qXammRUSzldt6JK+6R/2iw/sv1SaiL6oEaaMNuRHJWEN2oQuP +Hq2OGKLivA09RcmUXjhS6cHHk+AuXcjuBsS5M5J215yvlHPmUv38ZRSpABEBAAGJ +AiUEGAEIAA8FAlgAfzUCGwwFCQHhM4AACgkQkF6rkld9pCzIJQ//QjJnbm9GaloX +cC/xsEmaJVzdw3yMRgTyTixTtLl6AWfRxYqM++UbwPxVb5pePQwtvotfpgYpd5uz +9oF1FRc58EadETYSrtYQwysPTvNexVEqTzN/eN3OFqKZBMvYEkBU06PTVTtY18En +Gk//pujJugHxTUaBfXzUpDVD//ohCVoZIANc60Gx5m24FHZSEVbl48tU2CWEy3KG +dASqLY7yFA1QRJe8eTp8dWSgYczNjyTOOK+ZV2Y5yU6amv/5WDSGJOSBgdP41Om9 +HSrzbp1aFj70BT7SbBs9y1856HZhTxITvK4Lxg8DZMpGiMiakEAMCcVXS3ecDFT1 +wDMCjve0nVZ5LCKv8E0dRN6zvpAy1Cn50qWNqw61SS/HaPny9/50tSoh4ezI7AJi +quE0bkqdwMhbC8aBJw/mh983FKzvI5DyqqvmdKYwX3A3qzz3Qv9mgweD1BG1bYr/ +6CU7prj+LfWRJXc5hz5aFI+uiSA+uyyixwGErscv02xTm2umfMgq8VT7n3XcshoO +IzsB7Hvr9xaD7EJMO0hPFYaBWqPdkHgAlAzKwfnBUowcIY30Ol0tnnwGeNnqts7O +ZOippl9ZwNQBqAygXu3JSIknLooQWgYPF7J5ntggNKunhnKwhlEcVNaMlO/njen1 +Mn4cpXsYGOdqftE9XVboRvnV8jChT9I= +=AaNC +-----END PGP PUBLIC KEY BLOCK----- diff --git a/source/index.md b/source/index.md index 89b421dc..823de8ea 100644 --- a/source/index.md +++ b/source/index.md @@ -26,6 +26,4 @@ Je stocke ici quelques truc, jusqu'a maintenant, en rapport avec l'informatique Je stocke aussi la plus part de mon code sur mon propre serveur ou parfois sur framagit (non pas github - ça pue c'est pas libre :p) lorsque que le projet à pour objectif d'être partager. -Je prend parfois de stocker des notes que qui sont directement accesible ici. - -Il m'arrive parfois de partager des liens qui arrivent dans mon agrégateur de flux RSS. +Il m'arrive parfois de partager des liens qui arrivent dans mon agrégateur de flux RSS via shaarli. diff --git a/source/js/code_scrollbar.js b/source/js/code_scrollbar.js new file mode 100644 index 00000000..b99914c8 --- /dev/null +++ b/source/js/code_scrollbar.js @@ -0,0 +1,10 @@ +$(function() +{ + $('.sourceCode diff').jScrollPane(); +}); + +$(window).bind('resize', function() { + var scroll = $('.sourceCode diff').jScrollPane(); + location.reload(); + scroll.reinitialise(); +}); diff --git a/source/js/jquery.jscrollpane.min.js b/source/js/jquery.jscrollpane.min.js new file mode 100644 index 00000000..71e94c50 --- /dev/null +++ b/source/js/jquery.jscrollpane.min.js @@ -0,0 +1,8 @@ +/*! + * jScrollPane - v2.0.23 - 2016-01-28 + * http://jscrollpane.kelvinluck.com/ + * + * Copyright (c) 2014 Kelvin Luck + * Dual licensed under the MIT or GPL licenses. + */ +!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof exports?module.exports=a(require("jquery")):a(jQuery)}(function(a){a.fn.jScrollPane=function(b){function c(b,c){function d(c){var f,h,j,k,l,o,p=!1,q=!1;if(N=c,void 0===O)l=b.scrollTop(),o=b.scrollLeft(),b.css({overflow:"hidden",padding:0}),P=b.innerWidth()+rb,Q=b.innerHeight(),b.width(P),O=a('<div class="jspPane" />').css("padding",qb).append(b.children()),R=a('<div class="jspContainer" />').css({width:P+"px",height:Q+"px"}).append(O).appendTo(b);else{if(b.css("width",""),p=N.stickToBottom&&A(),q=N.stickToRight&&B(),k=b.innerWidth()+rb!=P||b.outerHeight()!=Q,k&&(P=b.innerWidth()+rb,Q=b.innerHeight(),R.css({width:P+"px",height:Q+"px"})),!k&&sb==S&&O.outerHeight()==T)return void b.width(P);sb=S,O.css("width",""),b.width(P),R.find(">.jspVerticalBar,>.jspHorizontalBar").remove().end()}O.css("overflow","auto"),S=c.contentWidth?c.contentWidth:O[0].scrollWidth,T=O[0].scrollHeight,O.css("overflow",""),U=S/P,V=T/Q,W=V>1,X=U>1,X||W?(b.addClass("jspScrollable"),f=N.maintainPosition&&($||bb),f&&(h=y(),j=z()),e(),g(),i(),f&&(w(q?S-P:h,!1),v(p?T-Q:j,!1)),F(),C(),L(),N.enableKeyboardNavigation&&H(),N.clickOnTrack&&m(),J(),N.hijackInternalLinks&&K()):(b.removeClass("jspScrollable"),O.css({top:0,left:0,width:R.width()-rb}),D(),G(),I(),n()),N.autoReinitialise&&!pb?pb=setInterval(function(){d(N)},N.autoReinitialiseDelay):!N.autoReinitialise&&pb&&clearInterval(pb),l&&b.scrollTop(0)&&v(l,!1),o&&b.scrollLeft(0)&&w(o,!1),b.trigger("jsp-initialised",[X||W])}function e(){W&&(R.append(a('<div class="jspVerticalBar" />').append(a('<div class="jspCap jspCapTop" />'),a('<div class="jspTrack" />').append(a('<div class="jspDrag" />').append(a('<div class="jspDragTop" />'),a('<div class="jspDragBottom" />'))),a('<div class="jspCap jspCapBottom" />'))),cb=R.find(">.jspVerticalBar"),db=cb.find(">.jspTrack"),Y=db.find(">.jspDrag"),N.showArrows&&(hb=a('<a class="jspArrow jspArrowUp" />').bind("mousedown.jsp",k(0,-1)).bind("click.jsp",E),ib=a('<a class="jspArrow jspArrowDown" />').bind("mousedown.jsp",k(0,1)).bind("click.jsp",E),N.arrowScrollOnHover&&(hb.bind("mouseover.jsp",k(0,-1,hb)),ib.bind("mouseover.jsp",k(0,1,ib))),j(db,N.verticalArrowPositions,hb,ib)),fb=Q,R.find(">.jspVerticalBar>.jspCap:visible,>.jspVerticalBar>.jspArrow").each(function(){fb-=a(this).outerHeight()}),Y.hover(function(){Y.addClass("jspHover")},function(){Y.removeClass("jspHover")}).bind("mousedown.jsp",function(b){a("html").bind("dragstart.jsp selectstart.jsp",E),Y.addClass("jspActive");var c=b.pageY-Y.position().top;return a("html").bind("mousemove.jsp",function(a){p(a.pageY-c,!1)}).bind("mouseup.jsp mouseleave.jsp",o),!1}),f())}function f(){db.height(fb+"px"),$=0,eb=N.verticalGutter+db.outerWidth(),O.width(P-eb-rb);try{0===cb.position().left&&O.css("margin-left",eb+"px")}catch(a){}}function g(){X&&(R.append(a('<div class="jspHorizontalBar" />').append(a('<div class="jspCap jspCapLeft" />'),a('<div class="jspTrack" />').append(a('<div class="jspDrag" />').append(a('<div class="jspDragLeft" />'),a('<div class="jspDragRight" />'))),a('<div class="jspCap jspCapRight" />'))),jb=R.find(">.jspHorizontalBar"),kb=jb.find(">.jspTrack"),_=kb.find(">.jspDrag"),N.showArrows&&(nb=a('<a class="jspArrow jspArrowLeft" />').bind("mousedown.jsp",k(-1,0)).bind("click.jsp",E),ob=a('<a class="jspArrow jspArrowRight" />').bind("mousedown.jsp",k(1,0)).bind("click.jsp",E),N.arrowScrollOnHover&&(nb.bind("mouseover.jsp",k(-1,0,nb)),ob.bind("mouseover.jsp",k(1,0,ob))),j(kb,N.horizontalArrowPositions,nb,ob)),_.hover(function(){_.addClass("jspHover")},function(){_.removeClass("jspHover")}).bind("mousedown.jsp",function(b){a("html").bind("dragstart.jsp selectstart.jsp",E),_.addClass("jspActive");var c=b.pageX-_.position().left;return a("html").bind("mousemove.jsp",function(a){r(a.pageX-c,!1)}).bind("mouseup.jsp mouseleave.jsp",o),!1}),lb=R.innerWidth(),h())}function h(){R.find(">.jspHorizontalBar>.jspCap:visible,>.jspHorizontalBar>.jspArrow").each(function(){lb-=a(this).outerWidth()}),kb.width(lb+"px"),bb=0}function i(){if(X&&W){var b=kb.outerHeight(),c=db.outerWidth();fb-=b,a(jb).find(">.jspCap:visible,>.jspArrow").each(function(){lb+=a(this).outerWidth()}),lb-=c,Q-=c,P-=b,kb.parent().append(a('<div class="jspCorner" />').css("width",b+"px")),f(),h()}X&&O.width(R.outerWidth()-rb+"px"),T=O.outerHeight(),V=T/Q,X&&(mb=Math.ceil(1/U*lb),mb>N.horizontalDragMaxWidth?mb=N.horizontalDragMaxWidth:mb<N.horizontalDragMinWidth&&(mb=N.horizontalDragMinWidth),_.width(mb+"px"),ab=lb-mb,s(bb)),W&&(gb=Math.ceil(1/V*fb),gb>N.verticalDragMaxHeight?gb=N.verticalDragMaxHeight:gb<N.verticalDragMinHeight&&(gb=N.verticalDragMinHeight),Y.height(gb+"px"),Z=fb-gb,q($))}function j(a,b,c,d){var e,f="before",g="after";"os"==b&&(b=/Mac/.test(navigator.platform)?"after":"split"),b==f?g=b:b==g&&(f=b,e=c,c=d,d=e),a[f](c)[g](d)}function k(a,b,c){return function(){return l(a,b,this,c),this.blur(),!1}}function l(b,c,d,e){d=a(d).addClass("jspActive");var f,g,h=!0,i=function(){0!==b&&tb.scrollByX(b*N.arrowButtonSpeed),0!==c&&tb.scrollByY(c*N.arrowButtonSpeed),g=setTimeout(i,h?N.initialDelay:N.arrowRepeatFreq),h=!1};i(),f=e?"mouseout.jsp":"mouseup.jsp",e=e||a("html"),e.bind(f,function(){d.removeClass("jspActive"),g&&clearTimeout(g),g=null,e.unbind(f)})}function m(){n(),W&&db.bind("mousedown.jsp",function(b){if(void 0===b.originalTarget||b.originalTarget==b.currentTarget){var c,d=a(this),e=d.offset(),f=b.pageY-e.top-$,g=!0,h=function(){var a=d.offset(),e=b.pageY-a.top-gb/2,j=Q*N.scrollPagePercent,k=Z*j/(T-Q);if(0>f)$-k>e?tb.scrollByY(-j):p(e);else{if(!(f>0))return void i();e>$+k?tb.scrollByY(j):p(e)}c=setTimeout(h,g?N.initialDelay:N.trackClickRepeatFreq),g=!1},i=function(){c&&clearTimeout(c),c=null,a(document).unbind("mouseup.jsp",i)};return h(),a(document).bind("mouseup.jsp",i),!1}}),X&&kb.bind("mousedown.jsp",function(b){if(void 0===b.originalTarget||b.originalTarget==b.currentTarget){var c,d=a(this),e=d.offset(),f=b.pageX-e.left-bb,g=!0,h=function(){var a=d.offset(),e=b.pageX-a.left-mb/2,j=P*N.scrollPagePercent,k=ab*j/(S-P);if(0>f)bb-k>e?tb.scrollByX(-j):r(e);else{if(!(f>0))return void i();e>bb+k?tb.scrollByX(j):r(e)}c=setTimeout(h,g?N.initialDelay:N.trackClickRepeatFreq),g=!1},i=function(){c&&clearTimeout(c),c=null,a(document).unbind("mouseup.jsp",i)};return h(),a(document).bind("mouseup.jsp",i),!1}})}function n(){kb&&kb.unbind("mousedown.jsp"),db&&db.unbind("mousedown.jsp")}function o(){a("html").unbind("dragstart.jsp selectstart.jsp mousemove.jsp mouseup.jsp mouseleave.jsp"),Y&&Y.removeClass("jspActive"),_&&_.removeClass("jspActive")}function p(c,d){if(W){0>c?c=0:c>Z&&(c=Z);var e=new a.Event("jsp-will-scroll-y");if(b.trigger(e,[c]),!e.isDefaultPrevented()){var f=c||0,g=0===f,h=f==Z,i=c/Z,j=-i*(T-Q);void 0===d&&(d=N.animateScroll),d?tb.animate(Y,"top",c,q,function(){b.trigger("jsp-user-scroll-y",[-j,g,h])}):(Y.css("top",c),q(c),b.trigger("jsp-user-scroll-y",[-j,g,h]))}}}function q(a){void 0===a&&(a=Y.position().top),R.scrollTop(0),$=a||0;var c=0===$,d=$==Z,e=a/Z,f=-e*(T-Q);(ub!=c||wb!=d)&&(ub=c,wb=d,b.trigger("jsp-arrow-change",[ub,wb,vb,xb])),t(c,d),O.css("top",f),b.trigger("jsp-scroll-y",[-f,c,d]).trigger("scroll")}function r(c,d){if(X){0>c?c=0:c>ab&&(c=ab);var e=new a.Event("jsp-will-scroll-x");if(b.trigger(e,[c]),!e.isDefaultPrevented()){var f=c||0,g=0===f,h=f==ab,i=c/ab,j=-i*(S-P);void 0===d&&(d=N.animateScroll),d?tb.animate(_,"left",c,s,function(){b.trigger("jsp-user-scroll-x",[-j,g,h])}):(_.css("left",c),s(c),b.trigger("jsp-user-scroll-x",[-j,g,h]))}}}function s(a){void 0===a&&(a=_.position().left),R.scrollTop(0),bb=a||0;var c=0===bb,d=bb==ab,e=a/ab,f=-e*(S-P);(vb!=c||xb!=d)&&(vb=c,xb=d,b.trigger("jsp-arrow-change",[ub,wb,vb,xb])),u(c,d),O.css("left",f),b.trigger("jsp-scroll-x",[-f,c,d]).trigger("scroll")}function t(a,b){N.showArrows&&(hb[a?"addClass":"removeClass"]("jspDisabled"),ib[b?"addClass":"removeClass"]("jspDisabled"))}function u(a,b){N.showArrows&&(nb[a?"addClass":"removeClass"]("jspDisabled"),ob[b?"addClass":"removeClass"]("jspDisabled"))}function v(a,b){var c=a/(T-Q);p(c*Z,b)}function w(a,b){var c=a/(S-P);r(c*ab,b)}function x(b,c,d){var e,f,g,h,i,j,k,l,m,n=0,o=0;try{e=a(b)}catch(p){return}for(f=e.outerHeight(),g=e.outerWidth(),R.scrollTop(0),R.scrollLeft(0);!e.is(".jspPane");)if(n+=e.position().top,o+=e.position().left,e=e.offsetParent(),/^body|html$/i.test(e[0].nodeName))return;h=z(),j=h+Q,h>n||c?l=n-N.horizontalGutter:n+f>j&&(l=n-Q+f+N.horizontalGutter),isNaN(l)||v(l,d),i=y(),k=i+P,i>o||c?m=o-N.horizontalGutter:o+g>k&&(m=o-P+g+N.horizontalGutter),isNaN(m)||w(m,d)}function y(){return-O.position().left}function z(){return-O.position().top}function A(){var a=T-Q;return a>20&&a-z()<10}function B(){var a=S-P;return a>20&&a-y()<10}function C(){R.unbind(zb).bind(zb,function(a,b,c,d){bb||(bb=0),$||($=0);var e=bb,f=$,g=a.deltaFactor||N.mouseWheelSpeed;return tb.scrollBy(c*g,-d*g,!1),e==bb&&f==$})}function D(){R.unbind(zb)}function E(){return!1}function F(){O.find(":input,a").unbind("focus.jsp").bind("focus.jsp",function(a){x(a.target,!1)})}function G(){O.find(":input,a").unbind("focus.jsp")}function H(){function c(){var a=bb,b=$;switch(d){case 40:tb.scrollByY(N.keyboardSpeed,!1);break;case 38:tb.scrollByY(-N.keyboardSpeed,!1);break;case 34:case 32:tb.scrollByY(Q*N.scrollPagePercent,!1);break;case 33:tb.scrollByY(-Q*N.scrollPagePercent,!1);break;case 39:tb.scrollByX(N.keyboardSpeed,!1);break;case 37:tb.scrollByX(-N.keyboardSpeed,!1)}return e=a!=bb||b!=$}var d,e,f=[];X&&f.push(jb[0]),W&&f.push(cb[0]),O.bind("focus.jsp",function(){b.focus()}),b.attr("tabindex",0).unbind("keydown.jsp keypress.jsp").bind("keydown.jsp",function(b){if(b.target===this||f.length&&a(b.target).closest(f).length){var g=bb,h=$;switch(b.keyCode){case 40:case 38:case 34:case 32:case 33:case 39:case 37:d=b.keyCode,c();break;case 35:v(T-Q),d=null;break;case 36:v(0),d=null}return e=b.keyCode==d&&g!=bb||h!=$,!e}}).bind("keypress.jsp",function(b){return b.keyCode==d&&c(),b.target===this||f.length&&a(b.target).closest(f).length?!e:void 0}),N.hideFocus?(b.css("outline","none"),"hideFocus"in R[0]&&b.attr("hideFocus",!0)):(b.css("outline",""),"hideFocus"in R[0]&&b.attr("hideFocus",!1))}function I(){b.attr("tabindex","-1").removeAttr("tabindex").unbind("keydown.jsp keypress.jsp"),O.unbind(".jsp")}function J(){if(location.hash&&location.hash.length>1){var b,c,d=escape(location.hash.substr(1));try{b=a("#"+d+', a[name="'+d+'"]')}catch(e){return}b.length&&O.find(d)&&(0===R.scrollTop()?c=setInterval(function(){R.scrollTop()>0&&(x(b,!0),a(document).scrollTop(R.position().top),clearInterval(c))},50):(x(b,!0),a(document).scrollTop(R.position().top)))}}function K(){a(document.body).data("jspHijack")||(a(document.body).data("jspHijack",!0),a(document.body).delegate('a[href*="#"]',"click",function(b){var c,d,e,f,g,h,i=this.href.substr(0,this.href.indexOf("#")),j=location.href;if(-1!==location.href.indexOf("#")&&(j=location.href.substr(0,location.href.indexOf("#"))),i===j){c=escape(this.href.substr(this.href.indexOf("#")+1));try{d=a("#"+c+', a[name="'+c+'"]')}catch(k){return}d.length&&(e=d.closest(".jspScrollable"),f=e.data("jsp"),f.scrollToElement(d,!0),e[0].scrollIntoView&&(g=a(window).scrollTop(),h=d.offset().top,(g>h||h>g+a(window).height())&&e[0].scrollIntoView()),b.preventDefault())}}))}function L(){var a,b,c,d,e,f=!1;R.unbind("touchstart.jsp touchmove.jsp touchend.jsp click.jsp-touchclick").bind("touchstart.jsp",function(g){var h=g.originalEvent.touches[0];a=y(),b=z(),c=h.pageX,d=h.pageY,e=!1,f=!0}).bind("touchmove.jsp",function(g){if(f){var h=g.originalEvent.touches[0],i=bb,j=$;return tb.scrollTo(a+c-h.pageX,b+d-h.pageY),e=e||Math.abs(c-h.pageX)>5||Math.abs(d-h.pageY)>5,i==bb&&j==$}}).bind("touchend.jsp",function(){f=!1}).bind("click.jsp-touchclick",function(){return e?(e=!1,!1):void 0})}function M(){var a=z(),c=y();b.removeClass("jspScrollable").unbind(".jsp"),O.unbind(".jsp"),b.replaceWith(yb.append(O.children())),yb.scrollTop(a),yb.scrollLeft(c),pb&&clearInterval(pb)}var N,O,P,Q,R,S,T,U,V,W,X,Y,Z,$,_,ab,bb,cb,db,eb,fb,gb,hb,ib,jb,kb,lb,mb,nb,ob,pb,qb,rb,sb,tb=this,ub=!0,vb=!0,wb=!1,xb=!1,yb=b.clone(!1,!1).empty(),zb=a.fn.mwheelIntent?"mwheelIntent.jsp":"mousewheel.jsp";"border-box"===b.css("box-sizing")?(qb=0,rb=0):(qb=b.css("paddingTop")+" "+b.css("paddingRight")+" "+b.css("paddingBottom")+" "+b.css("paddingLeft"),rb=(parseInt(b.css("paddingLeft"),10)||0)+(parseInt(b.css("paddingRight"),10)||0)),a.extend(tb,{reinitialise:function(b){b=a.extend({},N,b),d(b)},scrollToElement:function(a,b,c){x(a,b,c)},scrollTo:function(a,b,c){w(a,c),v(b,c)},scrollToX:function(a,b){w(a,b)},scrollToY:function(a,b){v(a,b)},scrollToPercentX:function(a,b){w(a*(S-P),b)},scrollToPercentY:function(a,b){v(a*(T-Q),b)},scrollBy:function(a,b,c){tb.scrollByX(a,c),tb.scrollByY(b,c)},scrollByX:function(a,b){var c=y()+Math[0>a?"floor":"ceil"](a),d=c/(S-P);r(d*ab,b)},scrollByY:function(a,b){var c=z()+Math[0>a?"floor":"ceil"](a),d=c/(T-Q);p(d*Z,b)},positionDragX:function(a,b){r(a,b)},positionDragY:function(a,b){p(a,b)},animate:function(a,b,c,d,e){var f={};f[b]=c,a.animate(f,{duration:N.animateDuration,easing:N.animateEase,queue:!1,step:d,complete:e})},getContentPositionX:function(){return y()},getContentPositionY:function(){return z()},getContentWidth:function(){return S},getContentHeight:function(){return T},getPercentScrolledX:function(){return y()/(S-P)},getPercentScrolledY:function(){return z()/(T-Q)},getIsScrollableH:function(){return X},getIsScrollableV:function(){return W},getContentPane:function(){return O},scrollToBottom:function(a){p(Z,a)},hijackInternalLinks:a.noop,destroy:function(){M()}}),d(c)}return b=a.extend({},a.fn.jScrollPane.defaults,b),a.each(["arrowButtonSpeed","trackClickSpeed","keyboardSpeed"],function(){b[this]=b[this]||b.speed}),this.each(function(){var d=a(this),e=d.data("jsp");e?e.reinitialise(b):(a("script",d).filter('[type="text/javascript"],:not([type])').remove(),e=new c(d,b),d.data("jsp",e))})},a.fn.jScrollPane.defaults={showArrows:!1,maintainPosition:!0,stickToBottom:!1,stickToRight:!1,clickOnTrack:!0,autoReinitialise:!1,autoReinitialiseDelay:500,verticalDragMinHeight:0,verticalDragMaxHeight:99999,horizontalDragMinWidth:0,horizontalDragMaxWidth:99999,contentWidth:void 0,animateScroll:!1,animateDuration:300,animateEase:"linear",hijackInternalLinks:!1,verticalGutter:4,horizontalGutter:4,mouseWheelSpeed:3,arrowButtonSpeed:0,arrowRepeatFreq:50,arrowScrollOnHover:!1,trackClickSpeed:0,trackClickRepeatFreq:70,verticalArrowPositions:"split",horizontalArrowPositions:"split",enableKeyboardNavigation:!0,hideFocus:!1,keyboardSpeed:0,initialDelay:300,speed:30,scrollPagePercent:.8}});
\ No newline at end of file diff --git a/source/template.html b/source/template.html index 705a2b3c..543142f2 100644 --- a/source/template.html +++ b/source/template.html @@ -23,8 +23,22 @@ $endif$ $if(custom-css)$ <style type="text/css">$custom-css$</style> $endif$ + <link type="text/css" href="/css/jquery.jscrollpane.css" rel="stylesheet" media="all" /> + <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> + <script type="text/javascript" src="/js/jquery.jscrollpane.min.js"></script> + <script type="text/javascript" src="/js/code_scrollbar.js"></script> </head> <body> + <a class="link-header" href="/"><div class="outer"style="width:100%" ><pre class="title-header"><code> + ████ ██ ██ ██ ██ ████ + ░░░░ ░░██ ██ ██ ██ ██ ░░██ ██ ░░░░ + ░░██ ██ ░░██ ░░██ ██ ░░██ ██ + ░░██ ░██ ░░ ░░ ██ ░██ ██ + ░░██ ░██ ██ ░██ ██ + ░░██ ░░██ ██ ██ ██ + ░░██ █████ ░░██ ███ ██ █████ ██ + ░░ ░░░░░ ░░ ░░░ ░░ ░░░░░ ░░ + </code></pre></div></a> <nav class="nav"> <a class="nav-title" href="/" title="Home"><!--blog title--></a> -- generate menu here -- @@ -36,16 +50,6 @@ $endif$ <li><a href="https://git.neodarz.net">code</a></li> </ul> </nav> - <div class="outer"style="width:100%" ><pre class="header"><code> - ████ ██ ██ ██ ██ ████ - ░░░░ ░░██ ██ ██ ██ ██ ░░██ ██ ░░░░ - ░░██ ██ ░░██ ░░██ ██ ░░██ ██ - ░░██ ░██ ░░ ░░ ██ ░██ ██ - ░░██ ░██ ██ ░██ ██ - ░░██ ░░██ ██ ██ ██ - ░░██ █████ ░░██ ███ ██ █████ ██ - ░░ ░░░░░ ░░ ░░░ ░░ ░░░░░ ░░ - </code></pre></div> <div class="bodya"> @@ -76,6 +80,7 @@ $body$ </article> </div> </div> + </div> <div class="footer">·.: CC-BY-SA || <a href="https://git.neodarz.net/neodarz/my_new_personal_website.git/about/" style="text-decoration: none;"><Source code> :.·</a></div> </body> </html> diff --git a/source/website/compétences.md b/source/website/compétences.md index d580062f..b32c8f54 100644 --- a/source/website/compétences.md +++ b/source/website/compétences.md @@ -2,4 +2,8 @@ title: "Compétences" --- -Mon joli de compétences +| Compétence | Activité | Justification | +|------------|-----------|----------------| +| Mettre a jour | P1.1 | C'est une bonne question !| +| | | | +| | | | diff --git a/source/website/cv-contact.md b/source/website/cv-contact.md new file mode 100644 index 00000000..fb0a864c --- /dev/null +++ b/source/website/cv-contact.md @@ -0,0 +1,63 @@ +--- +title: "CV/Contact" +--- + +CV: + +Mail: echo bqa3s9Js.Wa39qs@s3qEray.s39 | tr 9qarbJEWy3s toracidbzen + +PGP: [9D00 6C6E 30CE C9A8 88A6 F804 905E AB92 577D A42C](/gpg/corentin.breton@neodarz.net.public.asc) + +``` +-----BEGIN PGP PUBLIC KEY BLOCK----- + +mQINBFgAfzUBEACy8gjyBG5YUR/xk3MS7fjwHpq6mOtTefar47VkpQ5RbSBSEmG9 +yphVT3yS8/CIZfUwt3c1esBCPNArdmoTYZXhYADRtawp9aRm7G5XUcOojJFV/nDP +VCnfDSUFVMXb2HVl9JlHMNGQbmDq+Lwv4aQQsxi+wEJ17wmkfWQmZo7FekJkzB7r +8alVKM95OFLHuj1ZmZQfY0arzwn6LNunoGjzh0QmTVQv95ze+WBxOeUUjrb2QFmU +jW8fF0/JifeXplwqLy6ErB2cKZRQicdYxcUuohx+KkYnk3Ij1iLFxZJjYjWlci1h +XBn7WJ1zx8acWfDsCQ/eDfR6fweUnKt9qDarbJGDrCdhvyOUJFCFe6L2KR/fmeek +wK0U0VjiAAeTed/W1OVIN7BspnAWZjGXL2nSfzhUC+DqysSSYXqmCfFLpC7jPmdU +rINiRY3TLUP7gNcmcXGOkDOoJJCzBPuwMbYp5H1Phs5CE3XVlZ+X2YXWjG4794r1 +QJ5bU/mfywLz3rn9aw6xh/bj5mc75bOEJWyFSPhERb7zzViKKb5qg6sZU2iWXoEk +YmBjvxyhWLsElUJUOZFu/CNV9a4P514H+AKaCyfqLKwDylKamIwa3S/3HeR7cO7w +87HDommD5+S+yWSvTDdFSycRz7RBOhBFOYR0nV9CQGIkYmmPLb97Pii5wQARAQAB +tC1Db3JlbnRpbiBCcmV0b24gPGNvcmVudGluLmJyZXRvbkBuZW9kYXJ6Lm5ldD6J +Aj0EEwEIACcFAlgAfzUCGwMFCQHhM4AFCwkIBwIGFQgJCgsCBBYCAwECHgECF4AA +CgkQkF6rkld9pCxJGQ//ffMVDNgaXNsHKvFnvo2wOvSkgY/K8OxdcOILNJ4oo+Ki +QJEmlUM7RcvEyWcmaddFe9eULf0lF17rK2nnnS4Mz26XZBv/6ZdZKX4Mk11LRMAL +1L47aYcA0XTrNCfJVn5yBlsu5u/bKI6TK85uOcfS8VXpapPpNtSzXfjzaXDoIy3M +EPiBl0BMlZykvN6QZYA0tprB8q0oxFlBGq8RYjNQrXewZ9o1DvrcmarYkiVB7BZm +BnywQlHTKVfNd87OkC2SnuGHkWXgx98VEj7IpfR/8hDsGj+5luvHVpKLCBTXbSVl +oA3Vcttj5gVi4TsQq5VyilyGZzkY4HLJLrCfEbLjy4EWAKK9RYlrgpyuczYXziLc +eLVRKKDz4EYNAAgXcUwweUhAr8MecdgdoQjvV2ywGTxCtM5WnbYVGtWzK6M7rOgP +pheGKPNY5gc9f/jPJgHUJQyE/U1GQ2j/imP6k0J0bFBzC5jUgErVieNhZU1go+uD +XSd+RGy8ulNdUC8HU67meZRLdApeOa9t4zIak5XnxYNvc3+FhG3pcM94UIsMfk7p +IY5BeutCqQFOFoN3mjE+iv9HQ3mdOQ/ge7SZ5Sr9k2MS2dSKmXYEp+6LUG0QvmZT +ivW81kBufMFmMNsGfXTsCSMNvS0p0fPEV335w8RehieF4LJkJAg3l/9cuscCM365 +Ag0EWAB/NQEQAML+H3NvIVbYx9IVlKjPZ+TvtocTQOOh0HtXv+PCmotvSHx7kViK +49Vqq6VWjYd88Nf9l/duyFlrOFPbXRuJKT9vrTYm2f9pZ8KveHhNhF83WDCfZMmN +V+Gu5/w+pCtaXHL1ALNeGVMICdF7vualKf/72z5m2KQUFwfMEABZF7lb47Th86v7 +vndM1z5ATXPzc/YaMmOODX9Wz3Cx7K6KJ3OrTlsmFwh5ITu+GQS5iIS5IPgb0Th4 +DbPupRGDldGH3BFEYqOhhtT6xvPwksFwYl1g1YT516kYQRwrHSVDeQfrN1oOM0Ye +OY1FzrTFdwQS8kc8jGNs+bQuGO5ZBK3z6t05Zq6i/3V9tjX819vaNhk6AeL65T5C +JHuIz3Q/ISuKnfj9WbfBvfTzT4ZXRfb72BXHLSYf3qPxwXO5VLaiWKpwd30I93hK +bH+P7z4ZSGixwVM4ccUnGkP0enPJAlyY6KtlmxHn3i+gupjEwnIwelCkRn9MWx7S +aX3Uzi0jyDFQovJ7XfezutgtV6Y55VBf1QLI1cpFW5Szgm3boCXM1lbnCiwLzgxK +dASsEOUURIyFfv+qXammRUSzldt6JK+6R/2iw/sv1SaiL6oEaaMNuRHJWEN2oQuP +Hq2OGKLivA09RcmUXjhS6cHHk+AuXcjuBsS5M5J215yvlHPmUv38ZRSpABEBAAGJ +AiUEGAEIAA8FAlgAfzUCGwwFCQHhM4AACgkQkF6rkld9pCzIJQ//QjJnbm9GaloX +cC/xsEmaJVzdw3yMRgTyTixTtLl6AWfRxYqM++UbwPxVb5pePQwtvotfpgYpd5uz +9oF1FRc58EadETYSrtYQwysPTvNexVEqTzN/eN3OFqKZBMvYEkBU06PTVTtY18En +Gk//pujJugHxTUaBfXzUpDVD//ohCVoZIANc60Gx5m24FHZSEVbl48tU2CWEy3KG +dASqLY7yFA1QRJe8eTp8dWSgYczNjyTOOK+ZV2Y5yU6amv/5WDSGJOSBgdP41Om9 +HSrzbp1aFj70BT7SbBs9y1856HZhTxITvK4Lxg8DZMpGiMiakEAMCcVXS3ecDFT1 +wDMCjve0nVZ5LCKv8E0dRN6zvpAy1Cn50qWNqw61SS/HaPny9/50tSoh4ezI7AJi +quE0bkqdwMhbC8aBJw/mh983FKzvI5DyqqvmdKYwX3A3qzz3Qv9mgweD1BG1bYr/ +6CU7prj+LfWRJXc5hz5aFI+uiSA+uyyixwGErscv02xTm2umfMgq8VT7n3XcshoO +IzsB7Hvr9xaD7EJMO0hPFYaBWqPdkHgAlAzKwfnBUowcIY30Ol0tnnwGeNnqts7O +ZOippl9ZwNQBqAygXu3JSIknLooQWgYPF7J5ntggNKunhnKwhlEcVNaMlO/njen1 +Mn4cpXsYGOdqftE9XVboRvnV8jChT9I= +=AaNC +-----END PGP PUBLIC KEY BLOCK----- +``` diff --git a/source/website/cv.md b/source/website/cv.md deleted file mode 100644 index b59cff09..00000000 --- a/source/website/cv.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -title: "CV" ---- - -Vous pouvez télécharger mon CV ici : nope :p diff --git a/source/website/projets.md b/source/website/projets.md index 6bfd90b7..59bebbb6 100644 --- a/source/website/projets.md +++ b/source/website/projets.md @@ -27,15 +27,15 @@ Petite liste de projets auquel j'ai participé qui sont plus ou moins bien about # RADIO-MALRAUX -Écouter la radio : nope +Écouter la radio : Ce projet à deux objectifs, l'un technique et l'autre social. Technique dans le sens où monter une web radio ne se fait pas du jour au landemain, il faut réfléchir sur comment faire, avec quoi et correctement. -Le défit était de le faire exclusivement avec des Raspberry Pu afin de pouvoir l'héberger localement au lycée et consommé peut d'énergie. +Le défit était de le faire exclusivement avec des Raspberry Pi afin de pouvoir l'héberger localement au lycée et consommé peu d'énergie. Et l'ai aussi socialement dans le sens, où aimant les logiciels libre et souhaitant les partager, nous avons décidé diffuser exclusivement de la -musique libre. +musique libre de droit. Plus d'information : |