Blogs

Category: none



Unzip zip file with specially encoded filenames inside

29 Nov 2016    command-line, unzip

Encoding is always hard to get right. At least to many programs and programers I have seen, getting encoding right is not a trivial task at all. If we just need to work with the 26 characters in English and a few digits and symbols, a lot of problems will be gone. But since the fall of Towser of Babel, we have so many languages–and my mother tongue is one of the most special and ancient languages–Chinese–so I read and work with Chinese stuff a lot.

unzip with glob syntax to work with multiple zip files

20 Nov 2016    linux

glob syntax is powerful when we work in Linux terminals. We use it in less, grep, find and others. However, it just does not work with unzip. So if we try:

grep and show capture group only

19 Nov 2016    python

Linux/Unix terminal is powerful. Among many great tools such as cat, tail, head, less, vim, find, grep, cut and so many more, grep is very useful when we want to check if some pattern could be found within text stream. It is very rich in features and fast in performance.

deploy Django project with docker

09 Nov 2016    python

Docker is a very popular container and a lot of companies are using it – it provides isolation and flexibility to application development and deployment. Especially when you do not have sudo access and you want to deploy your web application, docker can be very handy.

use psql to create database user with readonly access to db

08 Nov 2016    postgres

As recently I am working with some structured relational data, I choose to use postgres as the database. And after cleaning the data and move it into database, some colleague came and asked for the access to the data. So if I choose to trust him, I can just give him my database super user and password and ask him to use python interface program provided by me. However, what if he decided to connect to my db and decided to DROP DATABASE? Trust is cheap. Let’s setup restriction.

Fix 404 error on Ubuntu when trying to update and upgrade

22 Oct 2016    Python

Linux is great. And for those who come from Windows background and want to have a smooth transition, Ubuntu seems like the most suitable choice to dive into the Linux world. I moved from Windows to Linux about 3 to 4 years ago as I want to learn more about Linux administration. So I first chose Ubuntu as the distribution to get started with Linux. The overall user-experience is great. I have the convenience of working with a similar environment with web servers–setting up development environment has never been so easy. And I have a pretty good GUI as well. Probably the only thing missing in OSes other than Windows is the power of gaming–but I do not play PC games anyway.

Python Django Class Based Views and Access Mixins

29 Aug 2016    Python, Django

Last time I used Django it was about 2 years ago and I was basically in the world of Flask, Rails and Node.js during that time. Now for one project I need to pick up Django again(because of its built-in support for admin portal and permissions). Although 3 years ago there were already class based views, I did not use that feature at that time and this time I thought I could give it a try.