Random Sampling Data with Header

I’ve mention a handy script call sample, which can randomly sample row/record-based data with given probability. One major problem with this script is that it doesn’t consider data with a header row specifying field names. It samples the head row like every other row. It’s not the end of the world though; two lines of head and cat commands can easily fix that. But it has become more and more annoying to do this every time. ...

July 31, 2015 · Ceshine Lee

Migrated the Blog from Pelican to Hugo

I’ve been using pelican to build blog.ceshine.net for about two years, and as you can see, I’ve not been very productive. Part of the reasons is that I found I spent more time tuning the code rather than actually writing stuffs. Recently Go-based Hugo caught my attention. Go can easily compile multi-platform binary executables, which makes deployment much easier. Hugo also provide a decent built-in web server whose performance is good enough for some small-scale production use. So after some experimenting, I decided to replace the old pelican site with Hugo. ...

July 28, 2015 · Ceshine Lee

Bayesian Logistic Regression using PyMC3

I’ve been reading this amazing (free) book Bayesian Methods for Hackers. I was half way through in early 2015, but dropped it because of some nuisances. But when I finally restarted reading it, I found it might be a good thing that I stopped reading for a while. Now I have more appreciation of the Bayesian methods and more mathematical understanding to fully grasp the idea the book trying to convey. (To be honest, I was quite confused about some concept like MAP in the first round of reading) ...

July 11, 2015 · Ceshine Lee

Change Sources of Ubuntu in a Docker image

The official docker images of Ubuntu use archive.ubuntu.com as the default package source. Because my Internet connection is metered, I’d like to change it to the free mirror server my ISP provides. And this command does the trick: sed -i 's/http:\/\/archive.ubuntu.com/http:\/\/mirror.internode.on.net\/pub\/ubuntu/g' /etc/apt/sources.list Change http://mirror.internode.on.net/pub/ubuntu to the url of whatever mirror you prefer. And add RUN to the start of the line and put it into the Dockerfile.

July 7, 2015 · Ceshine Lee

Docker: Remove All Untagged Images

By courtesy of this post, its comment section and this thread: Clean up old containers docker ps -a | grep 'Exited' | awk '{print $1}' | xargs --no-run-if-empty docker rm Remove All Untagged Images docker rmi $(docker images -q --filter "dangling=true")

July 5, 2015 · Ceshine Lee