J

jdhao's digital space

Recent content on jdhao's digital space

About

Welcome to my personal website! I am glad to hear what brings you here. Do not hesitate to share in the comment below! Who am I? # Hi, I am jdhao, a machine learning engineer who is passionate about working with computer vision. I am experienced in tools like NumPy, OpenCV, and PIL, and also in data visualization tools like Matplotlib. I have broad experiences working on various vision-related projects, ranging from image retrieval, OCR, document image analysis and reconstruction, to video deduplication.

2001/1/1
articleCard.readMore

Select fields in Elasticsearch: _source, fields and stored_fields

In Elasticsearch, when we index documents to an index, by default the source of the document is stored in meta field _source. When you search your index, you see a special field _source for each matched/hit product.

2025/10/17
articleCard.readMore

中式葱花饼制作

本文总结如何制作中式家常版本的“葱花饼”。

2025/8/24
articleCard.readMore

菜谱: 凉拌苤蓝(卜留克/kohlrabi)

今天总结一下在德国超市里常见的蔬菜苤(piě)蓝(德语叫kohlrabi,在中国东北叫“卜留克”) 凉拌的做法。

2025/8/6
articleCard.readMore

我也有高考 PTSD

和众多网友一样,我也有高考 PTSD。

2025/6/10
articleCard.readMore

Garmin Course Syncing Not Working?

Recently I was trying to sync my hiking course from Garmin connect to my Garmin Forerunner 965 and found that it does not work.

2025/6/8
articleCard.readMore

Prevent Accidental Index Delete in Elasticsearch

In Elasticsearch, you can use wildcard in a lot of the index operations. This is very handy, but can be dangerous sometimes, e.g., when you use wildcards when deleting indexes. You may delete unintended indexes accidentally and cause serious interruptions to your business/work.

2025/6/7
articleCard.readMore

How to Import GPX File into Garmin Watch

This post will give a quick summary on how to import GPX route into Garmin watch.

2025/5/17
articleCard.readMore

Python system PATH issues When We Use Pytest

When I try to run pytest locally for a Python project, I noticed that the import in those test scripts may fail if I run pytest in different directories. The import error usually means that your actual code modules is not in the python path, so they can not be imported successfully by your test scripts. This has something to do with how pytest set up the python path when you run it.

2025/5/14
articleCard.readMore

菜谱:泰式打抛牛肉

本次来复刻泰国非常受欢迎的打抛饭。

2025/3/12
articleCard.readMore

菜谱:烤箱羊肉串

本文总结如何用烤箱烤羊肉串。

2025/3/9
articleCard.readMore

How to Filter Warnings in Python/pytest

When we are using 3rd packages in Python, we may see some warning messages. For example, when you use the package BeautifulSoup and provide it with an url:

2025/3/6
articleCard.readMore

家常烤箱烤鸡腿

这次来总结一下烤箱烤鸡腿的做法。

2025/2/2
articleCard.readMore

Comparison between Several Desktop Speakers

In this post, I would like to compare several speakers that are relatively small in size and are suitable as desktop speakers.

2025/1/24
articleCard.readMore

How to Use luarocks Package in Neovim

Although neovim has built a lot of modules to ease the use of Lua, sometimes we may still want to use some packages from Luarocks. In this post, I would like to share how you can install a package from Luarocks and use it in nvim.

2024/12/12
articleCard.readMore

Macbook 外接显示器

最近趁着黑五入手了外接显示器,顺便了解了一下显示器相关的各种标准和技术,本文做一个总结。

2024/12/4
articleCard.readMore

家常萝卜炖羊排

寒冷的冬天,和羊肉汤更配。

2024/11/30
articleCard.readMore

Run the Job Immediately after Starting Scheduler in Python APScheduler

When using APScheduler package in Python, I want to run the scheduled job right after I start the scheduler. How can I do it properly?

2024/11/2
articleCard.readMore

Retry for Google Cloud Client

When we use one of the google cloud python clients to communicate with GCP, there may be errors occurring sometime calling the client API methods.

2024/10/9
articleCard.readMore

菜谱:土豆金枪鱼沙拉

今天来总结一下土豆金枪鱼沙拉的做法。

2024/10/3
articleCard.readMore

菜谱:椰香咖喱鸡

本次来总结一下椰汁咖喱鸡的做法。

2024/9/27
articleCard.readMore

凉拌绿豆宽粉制作

本次来总结凉拌绿豆宽粉的做法。

2024/9/24
articleCard.readMore

Make Python logging Work in GCP

When deploying a Python application to GCP Kuberntes Engine, we may see issues that the logging level is not correct in the cloud logging explorer. In order for the Python logging package to work with GCP, we need some additional configurations.

2024/9/21
articleCard.readMore

Liveness and Readiness Check in Kubernetes

2024/9/21
articleCard.readMore

Notes on Using GCP Logging

2024/9/17
articleCard.readMore

西班牙土豆饼制作

本次来复刻一下在网上看到的西班牙土豆饼。

2024/9/13
articleCard.readMore

Elasticsearch Version Conflict Error

The version conflict error is often seen when doing document indexing operations in Elasticsearch.

2024/9/12
articleCard.readMore

How to Use the Elasticsearch task API

In Elasticsearch (ES), you can run a task and check its status with the task API. For example, if you use the reindex API in ES with parameter with_for_completion=False, ES will not wait for the process to finish and will return a task instead.

2024/8/16
articleCard.readMore

Speed up document indexing in Elasticsearch via bulk indexing

In Elasticsearch, there is index API where you can index a single document to an index.

2024/7/27
articleCard.readMore

Index refresh issue in Elasticsearch

Recently when I was working with Elasticsearch, I found this weird issue that the document count for the newly created index is not correct. Also there are problems with reindex, if you reindex the source index to destination index, there is nothing in the destination index despite no errors.

2024/7/25
articleCard.readMore

Google Cloud Storage Usage

Some notes on using the Google Cloud storage.

2024/7/11
articleCard.readMore

家常煎羊排制作

在德国的德超很少能见到羊肉,不过在土耳其超市可以很方便买到羊肉。 本期我来做一个煎羊排,之所以不是因为烤羊排是因为我没有合适的烤盘和锡箔纸,所以没有尝试。

2024/4/10
articleCard.readMore

凉拌茄子制作

本文简单总结凉拌茄子的制作方法。

2024/4/10
articleCard.readMore

Configure Python logging with dictConfig

Apart from directly configuring the Python logging in the code itself. We can also configuring the logging using fileConfig or dictConfig.

2024/3/12
articleCard.readMore

Debugging Wezterm Issues

A short summary on how to debug Wezterm issues.

2024/2/27
articleCard.readMore

Black Formatter Setup for Python Project

This post is about how to set up black, the popular code formatter for Python projects.

2024/2/23
articleCard.readMore

Git line ending config

This post is about how to set up Git so that people using different operating systems can work in the same repository, without messing up the line ending of source files.

2024/2/22
articleCard.readMore

Garmin Forerunner 965 Essential Tips and Setups

In this post, I want to share a list of tips/setups for the Garmin Forerunner 965 watch. Some of the settings are also applicable to other Garmin watches.

2024/2/5
articleCard.readMore

How to Download Files from Google Cloud Storage in the Databricks Workspace Notebook

In this post, I want to share the complete process and setup to download files from GCP in a Databricks workspace notebook. Since the notebook itself is non-interactive when you run the shell command, the setup process is a bit different from the normal GCP authentication.

2023/11/22
articleCard.readMore

Databricks Cli Usage

We can use the Databricks cli to interact with Databricks workspaces programmatically on the command line. In this post, I want to share simple usage about Databricks cli.

2023/11/22
articleCard.readMore

Working with Databricks Workspace Files

Some observation and finding in working with Databricks workspace files.

2023/11/19
articleCard.readMore

手抓羊肉饭制作

这次我来复刻手抓羊肉饭。

2023/11/10
articleCard.readMore

Databricks Init Scripts

2023/10/21
articleCard.readMore

Using Virutal Environment in Python with venv

Using a virtual environment for Project dev in Python is a good practice. venv is module that is available since Python 3.3. It can help us to manage the virtual environment in a simple way.

2023/10/11
articleCard.readMore

File Systems in Databricks

A summary of different file systems in Databricks.

2023/10/3
articleCard.readMore

LATERAL VIEW EXPLODE in Spark

For array type column, explode() will convert it to n rows, where n is the number of elements in the array. For map/dictionary type column, explode() will convert it to nx2 shape, i.e., n rows, 2 columns (for key and value).

2023/9/26
articleCard.readMore

菜谱:麻婆豆腐

本文总结麻婆豆腐的做法。

2023/9/23
articleCard.readMore

在德国做台湾卤肉饭

本次来复刻台湾卤肉饭。

2023/9/23
articleCard.readMore

FastAPI testing and OpenAPI doc generation

Some notes on developing a web application with FastAPI.

2023/9/21
articleCard.readMore

Change Timezone in Databricks Spark

The Databricks cluster is using UTC as the default timezone. So when you run some time-related code, the displayed time is not the local time, which is not ideal. In this post, I want to share how to change the timezone setting for Databricks cluster.

2023/9/16
articleCard.readMore

How to Profile Your Python Script/Module

In my previous post, I shared how to profile a single function using line_profiler. In this post, I want to share how to profile Python script/module and visualize the profile stat to pinpoint the slow part of the code.

2023/9/13
articleCard.readMore

菜谱:茄子肉沫

家常少油版本茄子肉沫制作。

2023/9/9
articleCard.readMore

Migrating from Packer.nvim to Lazy.nvim

TL;DR: Lazy.nvim is amazing. It is easy to switch and reduce your startup time immensely. Just try it! I think Packer.nvim has been a revolutionary plugin manager after nvim 0.5. It introduces a lot of lazy loading techniques to speed up the startup process of Neovim.

2023/9/2
articleCard.readMore

How to Extract PDF file on macOS

To extract pdf pages from several files, we can use the open source tool qpdf.

2023/8/25
articleCard.readMore

How to Deploy Fastapi Application with Docker

In post, I want to summarize the complete steps to deploy a demo web service implemented with FastAPI in Docker container.

2023/8/2
articleCard.readMore

Nerdfont Icon Missing after Wezterm Upgrade

When I upgrade wezterm from April release to July release, I noticed that some of the unicode icons in my neovim config are shown as box.

2023/7/26
articleCard.readMore

Pylsp setup for Neovim in 2023

TL;DR: my config for pylsp can be found here. In this post, I would like to share my latest setup for Pylsp in Neovim.

2023/7/22
articleCard.readMore

How to Parse Query Param With Multiple Values in FastAPI

In HTTP request, same query parameter with multiple values are allowed. For example, for query parameter brand, the query string looks like this: brand=foo&brand=bar. How to parse value of this parameter to a list in FastAPI? There are several different ways.

2023/7/14
articleCard.readMore

菜谱:土豆胡萝卜烧牛肉

本文总结简易版“土豆胡萝卜烧牛肉”做法。

2023/7/2
articleCard.readMore

Zsh Startup Files in macOS

In this post, I want to share what I find about the Zsh startup files and their loading order in macOS.

2023/6/17
articleCard.readMore

PATH Variable Changed inside Tmux on macOS?

Recently, I met a strange issue related to Tmux. After open a tmux session, the PATH variable is changed and is different from outside tmux.

2023/6/13
articleCard.readMore

Work with JSON File in Neovim

In this post, I want to share how you can work effectively with JSON file inside Neovim.

2023/6/13
articleCard.readMore

Running/importing Python code/module in Databricks

Databricks is centered around notebooks for doing a lot of works. As a result, it is often not obvious how to run or re-use code from another notebook or Python module. In this post, I want to share how to do this in the Databricks.

2023/6/7
articleCard.readMore

Agile and Scrum

This is my learning notes for Agile and Scrum.

2023/5/25
articleCard.readMore

菜谱:凉拌牛肉

本文总结简易版凉拌牛肉的做法。

2023/5/22
articleCard.readMore

Awesome Command Line Tools Written in Rust

In this post, I want to share some command line tools written in Rust, which are good alternatives to some of the original tools used in command line.

2023/5/16
articleCard.readMore

How to get or set Databricks spark configuration

In this post, I summarize how to get or set a Databricks spark configuration/property.

2023/5/14
articleCard.readMore

Set Up German Version macOS

I got a Macbook with a German keyboard layout, and I am not accustomed to it. This post summarizes some tweaks made to the German version of Macbook to make it work for me.

2023/4/22
articleCard.readMore

Add A Custom Search Engine for Vimium

Vimium is a Chrome extension that lets us to browse the internet with our fingers, rather than using the mouse. In this post, I will going to share how to add a custom search engine for Vimium.

2023/4/19
articleCard.readMore

中国大陆小米手机如何使用 Google Pay

要使用 Google Pay 需要谷歌服务的支持,小米手机至少旗舰机型都是自带谷歌服务的,但是默认没有打开。以我的小米 12S Pro 为例,直接在系统设置界面搜索 “谷歌”,有个“谷歌基础服务”,打开即可。

2023/3/21
articleCard.readMore

春节回乡记

由于疫情的影响,已经有两年没有在老家过春节。中国国内疫情管控放开以后,终于有机会回乡过春节。

2023/3/4
articleCard.readMore

滇西之行 2023

我在高中还是大学读了宗璞的系列小说《野葫芦引》,其中的《西征记》描写了滇西抗战的经历,所以我一直想去腾冲走一趟,去拜访一下国殇墓园,苦于打工人没有时间,这个愿望在今年实现了。

2023/3/1
articleCard.readMore

贵阳行 2023

每次去贵阳都是浮光掠影,因为它不是我的终点站。这次是因为去云南,需要在贵阳转车停留一晚。

2023/2/20
articleCard.readMore

程序员海外工作---语言篇

找海外工作很重要的一个要求语言过关,根据国家的不同,对语言的要求也不同,英语国家当然英语就足够了,有的欧洲国家公司还会要求你掌握当地语言,如果你不会,那投递简历时就可以跳过这些公司了。本文谈一谈我的英语学习经验,仅供参考。英语主要分为听说读写四个方面,下面就分开写一写我的经验。

2023/2/18
articleCard.readMore

2023 长沙行

大学毕业以后,就没去过长沙了,来深圳工作几年也没去过长沙一次,正好趁着这次有时间去长沙逛一下。

2023/2/10
articleCard.readMore

2023 西安行

如果你要问我心中第一美食之都,我会说是西安。西安我此前已经去过两次了,但仍意犹未尽。

2023/2/3
articleCard.readMore

德国工签申请指南

拿到德国工作 offer 以后,我们需要申请合适的签证前往德国。本文将会详细总结德国工签(欧盟蓝卡)申请需要的材料,填写细节,以及面签的流程,希望能够帮助到有同样疑惑的人。 Disclaimer: 本文仅仅代表个人经历,非官方权威建议,仅供各位读者参考。

2023/1/18
articleCard.readMore

2022 年博客回顾

2022 年总共写了 49 篇博客 1,大部分博客很短,没花太多时间就可以写完。从类别上看,大部分都是技术相关的,关于 Neovim,Lua,机器学习,SQL,Python 使用等等,可能并没有太多人看,主要是自己总结留给自己以后参考,有几篇是记录自己平时做菜的过程,还有一些是自己对一些问题的思考或者记录,例如 如何提技术问题 以及 对新冠的记录。

2023/1/6
articleCard.readMore

感染 omicron 记录

在 2022 年 12 月底,我也感染了 omicron 病毒,本文对感染过程做一记录。

2023/1/2
articleCard.readMore

How to Override Default Options in Neovim

A very common confusion for new users of Neovim is that their option settings for a particular filetype does not work in init.vim (or init.lua).

2022/12/2
articleCard.readMore

Variadic Arguments in Lua

In Lua, to pass variable number of arguments, we can use ... (three ellipses) syntax in function argument.

2022/12/2
articleCard.readMore

How to Enable Method Autocompletion for OpenCV

Introduction # In Python, some packages are written mainly or partially in C++, and the Python interfaces are just wrappers around the binary C++ module. Among these packages, there is OpenCV.

2022/11/16
articleCard.readMore

How to Read Local CSV File to Table in MySQL

I am using MySQL server version 8.0.30 on my macOS. I try to read a local csv file into a mysql table using LOAD DATA LOCAL INFILE following some post1, but unfortunately I get the following error:

2022/10/15
articleCard.readMore

I read the nvim v0.8 release note so you do not have to

This is not a complete list of changes. Just what I have noticed. Complete release note for nvim 0.8 is here.

2022/10/5
articleCard.readMore

Creating A Trigger in PostgreSQL

We can use trigger to automate oerations, for example, preventing insertion of a record if certain condition is met. In this post, we show an example trigger function and its usage.

2022/9/12
articleCard.readMore

Cost of Living in Shenzhen

Here is how much I spend for living in Shenzhen, China as a non-local people. Note the cost may vary a lot depending on various factors. All numbers are in the unit of Chinese Yuan (symbol ¥).

2022/9/4
articleCard.readMore

You Do Not Need a Plugin for This Feature

I saw from the repo awesome neovim1 a plugin that helps the user create the intermediate dir when they save a file. I wondered why this feature even needs a whole plugin? You can literally do this with a few lines of code.

2022/8/21
articleCard.readMore

Ctrl-left and Ctrl-right Not Working in macOS?

Recently, when I try to use Ctrl-left and Ctrl-right in Neovim, I found that they are not received by Neovim. I thought this is a Neovim issue. However, when I test these two shortcuts using cat in the terminal (I tried both Kitty and wezterm), it does not work either.

2022/8/20
articleCard.readMore

Benchmarking Your HTTP Service Using wrk

As a machine learning engineer/data scientist, after the model development process is finished, we need to deploy the model as a web service using different web frameworks. To achieve maximum performance and lower the hardware cost, we often need to optimize the speed our service, including TensorRT acceleration, config tuning, etc.

2022/8/10
articleCard.readMore

How to Change Commit Author Info in Git

This post summarizes how to update author info of Git commits.

2022/8/5
articleCard.readMore

Monitoring Service Stat with uwsgitop

When we serve a HTTP service via uWSGI, we can monitor its stats via uwsgitop.

2022/8/1
articleCard.readMore

A Dive into super() in Python

In Python, we often see the use of super() in class initialization.

2022/7/31
articleCard.readMore

How to Pass List by Value as Parameter in Python

If we pass list as parameter to a function and change the parameter, the original list is also changed. This is because list is a mutable type, when we pass list to a function, we are passing the same list.

2022/7/27
articleCard.readMore

在疫情的阴影下 (My Life under the Shadow of Covid19)

序:有感于无休无止的核酸检测,我觉得有必要写点什么,记录下正在发生的和已经发生的历史。 很多年后,回过头看 2020 年 1 月,我们无法预料到 Covid19 竟然对人类社会造成了如此大的影响。

2022/7/25
articleCard.readMore

我们为何工作?

工作的意义是什么?

2022/7/7
articleCard.readMore

Nvim 0.7.2 Released

Recently the nvim 0.7.2 version is released following the 0.7.0 release two months ago. Here are some of the updates in 0.7.0.

2022/6/29
articleCard.readMore

Learning SQL from Scratch(2): Setup and Preparations

update log 2022-10-12: add fake data generation website. 2022-10-11: add TUI client for MySQL and Postgres. 2022-09-24: add sample database we can try. In this post, I will talk about setting up SQL databases and also the tools needed to write SQL queries.

2022/6/4
articleCard.readMore

Learning SQL from Scratch(1): Do We Even Need to Start?

As a machine learning engineer who mainly deals with vision-based projects, I have little opportunity in my work to actually use SQL (Structured Query Language.). Even when I need it, I often just ask the data engineers for a favor. However, I thought it would be an essential skill to learn even if I do not need it for now.

2022/6/4
articleCard.readMore

What Happened When Logging without Handlers in Python

I saw a post from stackoverflow asking why his logger does not work as expect? The code is like:

2022/5/27
articleCard.readMore

How To Read and Write ply File in Python

In this post, I want to share how to generate ply files in Python.

2022/5/26
articleCard.readMore

Lua Learning Notes

As a long time nvim user, I am learning Lua and slowly transition my nvim config to lua. In this script, I will share some tips and lessons I have learned the hard way.

2022/5/21
articleCard.readMore

Fix Nvidia Apt Repository Public Key Error

When running apt-get update inside Ubuntu 18.04, I have the following error:

2022/5/5
articleCard.readMore

豆角焖面制作

今天总结一下“豆角焖面”的做法。 材料 # 四季豆,五花肉或瘦肉,大料,大蒜,姜,青椒,五香粉,酱油,老抽,料酒,鲜面条

2022/5/1
articleCard.readMore

Fix the Logitech Bluetooth Shit and Use Unifying Receiver

Background # The thing is that I have a Logitech pebble and mx keys mini keyboard, and I use Bluetooth to connect them to my mac, but they randomly lost connection when I was using them, especially for the mx keys mini keyboard, this occurred on a daily basis.

2022/4/30
articleCard.readMore

How to Calculate Square Root without Using sqrt()?

I saw an interesting question that how to get square root of x without using builtin function from your language. There are different ways to approach this problem.

2022/4/28
articleCard.readMore

How to Match Non-greedily in Nvim/Vim

A short note on how to match non-greedily in Nvim/Vim.

2022/4/27
articleCard.readMore

Push to GitHub with Personal Access Token (PAT)

To promote security, starting from Aug. 2021, many GitHub operations require use of personal access tokens (PAT).

2022/4/23
articleCard.readMore

How to Use Tensorboard in Pytorch

This is a brief note on how to use Tensorboard in PyTorch.

2022/4/20
articleCard.readMore

How to Add Color Emoji to Image in Python

In this post, I would like to share how to add color emoji to image with Python.

2022/4/3
articleCard.readMore

How to Do Image Alpha-compositing in Pillow

What is alpha-compositing If you have two images A and B, you alpha-composite A over B, it will create an effect that you can see both image A and B in the resulting image, as if A has transparency and you can see through A and also see B.

2022/4/1
articleCard.readMore

地道美味炸酱制作方法

今天介绍另外一种风格的炸酱制作,区别于之前写过的 老北京炸酱.

2022/3/28
articleCard.readMore

Nonlinear Activations for Neural Networks

Non-linear activations are important in deep neural networks. It is important in the sense that without non-linear activation functions, even if you have many linear layers, the end results is like you have only one linear layer, and the approximation ability of the network is very limited1. Some of most commonly-used nonlinear activation functions are Sigmoid, ReLU and Tanh.

2022/3/27
articleCard.readMore

Accelerate Batched Image Inference in PyTorch

I have a web service where the images come in a batch so I have to do inference for several images in PIL format at a time. Initially, I use a naive approach and just transform the images one by one, then combine them to form a single tensor and do the inference. The inference becomes really slow when I have a batch with more than 30 images. The inference time is about 1-2 seconds per batch.

2022/3/18
articleCard.readMore

Define A String Variable in LaTeX

Like other programming languages, the best way to to use a value multiple times in LaTeX is to define a variable for it. Later when you want to change the value, you only need to change it once. Here is how to do it.

2022/3/14
articleCard.readMore

Merging Branches with Git Rebase

When merging branches, the most direct way we can use is to git merge. However, with git-merge, the commit history and graph will be messy if there are a lot of branches.

2022/3/7
articleCard.readMore

Softmax with Temperature Explained

Softmax function is commonly used in classification tasks. Suppose that we have an input vector \([z_1, z_2, \ldots, z_N]\), after softmax, each element becomes:

2022/2/27
articleCard.readMore

A Curated List of File Explorers for Nvim

File explorer is one of the most widely-used types of plugin for Vim/Nvim. Below are my curated list of file explorers for Nvim. Some of these plugins are specifically written for Nvim and will not work for Vim.

2022/2/27
articleCard.readMore

关于正确提问技术问题

有个人 A 在 Vim tg 群,问了一个简单的 vim 问题,另外一位群友 B 给了间接的回答,告诉他应该多搜索一下。结果引发了大讨论,有人认为直接回答就好,没必要指教别人,没必要那么傲慢,居高临下,就炸锅了,引发了大讨论,还导致几个人退群。

2022/2/21
articleCard.readMore

Install pyav inside Ubuntu Docker

Building a usable Docker image with all the packages living peacefully is hard. Here is how to install pyav using Docker.

2022/2/11
articleCard.readMore

Dependency Hell When Building A PyTorch GPU Docker Image

In order to for PyTorch to use host GPU inside a Docker container, their versions must match.

2022/2/9
articleCard.readMore

External Executable Not Allowed to Run after Hugo v0.91?

Today I upgrade Hugo from v0.75 to the latest version (v0.92). When I run the deployment script to build the site and push, I saw the following error:

2022/2/2
articleCard.readMore

凉菜调味汁制作方法

凉菜万能调料汁制作方法。

2022/2/1
articleCard.readMore

菜谱:蒜蓉炒虾

家常版蒜蓉炒虾🦐制作方法。

2022/2/1
articleCard.readMore

A Dig into PyTorch Model Loading

Saving and loading PyTorch models # Models in PyTorch are a subclass of torch.nn.Module. To save the model parameters, we use model.state_dict() to get all the model parameters:

2022/1/28
articleCard.readMore

Selected Questions from LinkedIn Git Assessment

I took the LinkedIn Git assessment and got a certificate1, but found that I am not super clear on some of the questions. Here is an analysis of some of the questions and their answers.

2022/1/14
articleCard.readMore

Why do We Use LogSumExp in Machine Learning?

LogSumExp is often used in machine learning. It has the following form:

2022/1/9
articleCard.readMore

How to Squash Last N Commits in Git?

We often need to squash several related commits to make the commit history cleaner. There are several different ways to achieve this.

2022/1/9
articleCard.readMore

How to Make An Impressive and Beautiful GitHub Profile

update log 2022-08-21: add section on profile visitor stat 2022-04-09: add section on Stack Overflow stats card. In this post, I will share how to customize your GitHub profile page, and you can find the end result here.

2022/1/3
articleCard.readMore

Using Neovim after Three Years -- A Retrospect

I started using Neovim (nvim for short) about three years ago, in Sep. 2018. At that time, nvim had just released v0.3.1. Over the years, I have been a staunch nvim user, constantly learning new knowledge, and sharing tips, tricks and interesting plugins in my blog posts.

2021/12/31
articleCard.readMore

How to Extract Key Frames from A Video with FFmpeg

In order to get enough information from videos, we often need to extract video frames. However, we do not want to extract every frame from a video due to: information redundancy in successive video frames. huge storage space needed by these video frames. In this post, I want to share how to extract key frames from video to reduce the storage, but still capture enough information from a video.

2021/12/25
articleCard.readMore

Download Files to Local Storage in iPad

When downloading files using Safari browser in iPad, the files will be saved on your iCloud drive. For me, I want to download the files locally without filling up my iCloud space.

2021/12/25
articleCard.readMore

Using STL Containers with pybind11

In my old post, I have shared how to use pybind11 to accelerate execution of Python code.

2021/12/23
articleCard.readMore

Sort lines based on a column in Vim/Nvim

I have a file where each line has several comma-separated items. I want to sort the lines, based on a certain column. How do we do it inside Vim/Nvim?

2021/12/21
articleCard.readMore

Process video in a certain time range with FFmpeg?

When dealing with videos, we may want to process video in a specific time range, for example, to only process video from 50 seconds to 70 seconds. How do we specify the time range in ffmpeg?

2021/12/16
articleCard.readMore

回顾我的手机换代史

科技发展的这样快,常常让我们忘了以前是什么样的。手机现在已成了现代人的一部分,须臾离不开了,十几年前还不是这样。有时候我坐在地铁上,看着低头认真滑手机的人们,就在想没有手机之前大家的生活都是什么样的,竟然想不起来了。

2021/12/12
articleCard.readMore

【2021 年】iPad 安装 Shadowrocket

在苹果系统上安装一个工具真麻烦,简单总结如何在 iPad 上安装 Shadowrocket 小火箭。

2021/12/12
articleCard.readMore

Migration from Nvim 0.5.1 to Nvim 0.6.0

About five months ago, the biggest update of Nvim comes with its v0.5.0 release. With v0.5, we finally get the official LSP support in Nvim core and better Lua support, among other features and bug fixes1. TL;DR: My LSP-related config can be found here.

2021/12/1
articleCard.readMore

How I Manage My Personal Blog

In this post-web2.0 age, people seem to blog less and less, and blogs seem to be dying slowly. People are separated in different Apps where the content is not searchable by search engines. However, I still prefer to write using a blog. In this post, I want to share how I manage my blog.

2021/11/28
articleCard.readMore

Git Learning Notes (4)

My Git learning notes.

2021/11/27
articleCard.readMore

Nifty Nvim/Vim Techniques That Make My Life Easier -- Series 11

This is the 11th post of my post series on nifty Nvim/Vim techniques that will make my editing experience easier. Click here to check other posts in this series. Series 10: https://jdhao.github.io/2021/06/17/nifty_nvim_techniques_s10/ Series 9: https://jdhao.github.io/2021/01/07/nifty_nvim_techniques_s9/ Series 8: https://jdhao.github.io/2020/11/11/nifty_nvim_techniques_s8/ Series 7: https://jdhao.github.io/2020/09/22/nifty_nvim_techniques_s7/ Series 6: https://jdhao.github.io/2019/12/21/nifty_nvim_techniques_s6/ Series 5: https://jdhao.github.io/2019/11/11/nifty_nvim_techniques_s5/ Series 4: https://jdhao.github.io/2019/09/17/nifty_nvim_techniques_s4/ Series 3: https://jdhao.github.io/2019/05/14/nifty_nvim_techniques_s3/ Series 2: https://jdhao.github.io/2019/04/17/nifty_nvim_techniques_s2/ Series 1: https://jdhao.github.io/2019/03/28/nifty_nvim_techniques_s1/

2021/11/22
articleCard.readMore

Fuzzy-switching Tmux Sessions with Ease

During my work, I use multiple Tmux sessions to manage different projects. When I create a new session, I usually give it unique name so that I know that the project is about via the session name.

2021/11/20
articleCard.readMore

事情经常是 Now or Never

我平时用 chrome 浏览器,有时候查一个新东西,喜欢把有关系的网页都打开,所以浏览器就塞满了 tab,这些内容我不一定都有时间去看一遍,所以 tab 就一直留在那里,有时候不得已要重启浏览器或者重启系统,不想丢失这些 tab,就用 supertabs 插件把 tab 保存下来,期望有时间了再去看。

2021/11/17
articleCard.readMore

小米平板 5 Pro 体验

kindle voyage 看 PDF 格式电子书体验太差,正好八月份小米发布了小米平板 5 pro,小米平板 5 销售还挺火爆的,京东上一直断货,需要预约,遂从小米之家入手一台体验1。以下是使用小米平板 5 pro 两个多月的体验。

2021/11/13
articleCard.readMore

Audio Processing Using FFmpeg

Collected tips on audio processing with FFmpeg.

2021/11/10
articleCard.readMore

PyAV for video processing

ffmpeg is an excellent tool for video processing. However, using ffmpeg directly inside Python is not convenient enough. Previously, I have been using ffmpeg-python, which is a thin wrapper around the ffmpeg command line executable.

2021/11/4
articleCard.readMore

茅海建 《天朝的崩溃》

花了一周的时间,看完了茅海建的《天朝的崩溃》,虽然中学历史书中简略讲过第一次鸦片战争,对这段历史了解却甚少,我甚至天真地以为鸦片战争就是虎门战争之后就和谈了,然后签订了《南京条约》。

2021/10/31
articleCard.readMore

Using Diffs in Vim

Diff can be used to compare two versions of the same file to find the changes. If you use vim, you can use vimdiff to compare files:

2021/10/24
articleCard.readMore

Git Diff Setup

When we run git-diff, git uses its internal diff algorithm to generate diff for changed files.

2021/10/24
articleCard.readMore

Find Which Font is Used in A PDF

Sometimes, we are interested in which font is used for the main text in a PDF. How do we find out?

2021/10/20
articleCard.readMore

Scheduling Your Tasks with Apscheduler

In Python, to run a task periodically, we can use the package apscheduler.

2021/10/20
articleCard.readMore

Why Use Cross Entropy in Classification Task?

In classification tasks, the de facto loss to use is the cross entropy loss.

2021/10/16
articleCard.readMore

Setting up Yasnippet for Emacs

Unlike Vim/Neovim, where there are snippet engines like ultisnips and other plugins. In Emacs, the de facto snippet engine is yasnippet.

2021/10/6
articleCard.readMore

Customize Tabline in Emacs

A short note on how to set up a more beautiful tabline for Emacs.

2021/9/30
articleCard.readMore

中秋贵阳重庆行

趁着中秋节小长假,去重庆和贵阳玩了几天。

2021/9/22
articleCard.readMore

Straight.el Bootstrap and Package Install Issue

update log 2022-02-08: update fastgit URL I am using straight.el to manage my Emacs packages. However, due to GitHub access issues, the bootstrap snippet can not be downloaded successfully and run. After staring Emacs, it hangs forever with high CPU usage.

2021/9/15
articleCard.readMore

Learning Emacs as A Nvimmer in One Day

update log 2021-11-24: Add more detailed instructions for installing doom-modeline. I have been using Neovim for over three years and I have been constantly hearing the greatness of its rival editor Emacs. So today I am gonna to try it and see if it is truly great. Edit: My final Emacs conf is here.

2021/9/12
articleCard.readMore

Hands on with Three Git TUI Clients

If you are not accustomed to typing git commands on the command line, there are also some TUI clients for easing the use of git.

2021/9/11
articleCard.readMore

Using Virtual Text in Neovim

In Neovim, we can use the virtual text feature to place virtual text anywhere in the current buffer, which is not possible with normal text.

2021/9/9
articleCard.readMore

老北京炸酱面制作

总结一下老北京炸酱面的制作过程,备忘。

2021/9/5
articleCard.readMore

Integer Literal Type and Overflow In C++

I want to print the largest number that unsigned int can represent, which is 2^32 - 1. I use the following code:

2021/9/3
articleCard.readMore

GNU Make FAQ

GNU Make is a build automation tool typically used on Linux systems1. Below I will summarize a list of FAQs, which explain how Make works and how to use Make.

2021/8/29
articleCard.readMore

问题根源是什么?

一件关于思维的小事,值得记录。

2021/8/20
articleCard.readMore

Pybind11 hands on

To accelerate the execution of some performance critical code, we can write the code in C++ with the help of pybind11 and export the C++ code as shared library1. Then we can import the shared library as a module and enjoy speed boost.

2021/8/17
articleCard.readMore

给 Hugo even 主题添加 utterances 评论系统

建立博客以来,试用了多款评论系统,不过最终还是用了 disqus,但是 disqus 令人讨厌的是默认添加很多烦人的广告,牛皮癣一样,而且在国内无法加载,必须翻墙才能显示。utterances 是一款基于 github issues 的评论系统,简洁,避免了 disqus 的广告以及加载问题。这篇文章总结如何给 Hugo-even 主题添加 utterances 评论系统。

2021/8/15
articleCard.readMore

macOS Operation Not Permitted?

Some permission related issue on macOS.

2021/8/15
articleCard.readMore

Setting up Sumneko Lua Language Server for Nvim-lsp

Update log 2022-08-13: update nvim lsp config for lua-language-server. In this post, I will share how to set up sumneko lua for nvim-lspconfig.

2021/8/12
articleCard.readMore

Is GitHub Down Today?

update: On 2021-11-28, we expericence another GitHub outage which lasts more than two hours, see here. On 2021-08-10 23:30 CST, I observed that I cannot push to my GitHub repo even with --force. After checking the GitHub status site, it seems that the GitHub API is down1. It is not the first time that GitHub is down. There has been several failure reports last year (2020), due to MySQL and other issues. At this moment, I have realized how much I and other developers around world are relying on this free service.

2021/8/11
articleCard.readMore

macOS 上常用工具

点击查看更新记录 2022-03-07:增加 shotrr 2022-02-10: 增加 wezterm 介绍 记录我在 macOS 下常用到的工具。

2021/8/9
articleCard.readMore

Configure Windows Terminal in 2021

After updating my Windows system to the latest version, I can finally use the new Windows Terminal.

2021/8/6
articleCard.readMore

How Does The YouTube Content ID System Work?

Google introduced the content ID system in 2007 to cope with the unauthorized use of copyrighted music and video content. The content ID system has successfully helped the copyright owners to find the pirated content and paid billions of dollars to the copyright owners1.

2021/8/2
articleCard.readMore

基于内容的视频检索/视频指纹的应用

基于内容的视频检索(或视频指纹),是指根据视频内容,从数据库中找到和当前视频在画面上重复高的视频。

2021/7/24
articleCard.readMore

向量搜索引擎/工具

无论是推荐还是检索任务,都离不开向量检索引擎,当向量数量巨大(上千万或者上亿规模)的时候,使用精确搜索(exhaustive search)的时间成本对于用户来说无法接受,这时我们必须用到近似最邻近搜索(approximate nearest neighbor, 简称 ANN)。本文总结了一些常见的实现了 ANN 搜索的向量搜索引擎/工具。

2021/7/24
articleCard.readMore

Show Git Diff When Doing Git Commit

I saw on YouTube a video made by TJ DeVries on how to contribute to the neovim project. There is a scene where he commit via git commit, and whoa, a Neovim instance appeared with three split, with top left the commit message area, top right the git-status area, and on the right the git-diff info, which is really cool.

2021/7/24
articleCard.readMore

Delete Keys Matching A Pattern with py-redis-cluster

We have a Python web service where we store some key-val pairs in redis. Occasionally, I want to delete some of the keys matching a certain pattern. Current, we are using redis-py-cluster for redis-related operations.

2021/7/20
articleCard.readMore

Migrating from vim-plug to Packer.nvim

Update log 2022-03-27: fix a typo in requiring lua modules 2022-02-08: change fastgit URL 2022-02-05: add new autocmd for auto-running command PackerCompile. Over the past two years, I have been using vim-plug as my plugin manager for Nvim. Vim-plug is powerful, fast and amazing, especially considering that all its features are contained in a single vim script. It uses the old way to manage plugins, i.e., it will manage the loading of plugins directly.

2021/7/11
articleCard.readMore

快排(quick sort) C++ 实现

快排是一种快速排序算法,原理是从数组中选择一个 pivot,数组中小于等于 pivot 的元素放到左边,大于 pivot 的元素放到右边。然后对左边和右边数组分别递归进行快速排序,最后整个数组就成为排序好的数组。

2021/7/10
articleCard.readMore

A CheatSheet of C++ Container/Adapter and Common Structure

I use Python in my work, and rarely need C++. So I need to compile this C++ cheatsheet for common STL containers/adapters, just in case I need them.

2021/7/4
articleCard.readMore

Static and Dynamic Linkage in C++

In C++, we can build a library either statically or dynamically. In this post, I want to summarize how to build a static and a shared/dynamic library1.

2021/7/4
articleCard.readMore

Pretty Output Format in C++

Although std::cout in C++ is powerful, it lacks the ease of use of format string in Python. Fortunately, the 3rd party package fmt provides a similar feature for C++.

2021/7/4
articleCard.readMore

Install LLVM/Clangd from Source on CentOS 7

Clangd is a language server for C++/C etc. I try to use clangd 12 for C++ code auto-completion on CentOS 7.

2021/7/3
articleCard.readMore

Empty Entry in LD_LIBRARY_PATH May Lead to Security Issues

When I want to build glibc using the provided configure script (./configure --prefix=xxx), I saw the following error message:

2021/7/3
articleCard.readMore

A Guide on Squashing Commits with git-rebase

In this post, I would like to share how to squash commits using git-rebase.

2021/6/28
articleCard.readMore

小米9 MIUI 12 系统开机界面无限重启

最近更新到了 MIUI 12.5 系统,晚上手机突然开始不停重启(bootloop),手机在不停重启,进入 MIUI logo,然后又开始重启,有时候能进入到系统,但是还没等到我开始设置,又开始重启了。

2021/6/24
articleCard.readMore

电视盒子:当贝 B3 Pro 使用体验

在 之前的文章 中,我介绍了几款试用的安卓外贸盒子,由于做工以及试用中发现的问题,最终都没有入手。其实品牌电视盒子,也有一个不错的选择,就是当贝 B3 Pro,趁着京东 6.18 活动,最终以 699 价格入手了这款盒子。

2021/6/20
articleCard.readMore

Nifty Nvim/Vim Techniques That Make My Life Easier -- Series 10

This is the 10th post of my post series on nifty Nvim/Vim techniques that will make my editing experience easier. Click here to check other posts in this series. Series 11: https://jdhao.github.io/2021/11/22/nifty_nvim_techniques_s11/ Series 9: https://jdhao.github.io/2021/01/07/nifty_nvim_techniques_s9/ Series 8: https://jdhao.github.io/2020/11/11/nifty_nvim_techniques_s8/ Series 7: https://jdhao.github.io/2020/09/22/nifty_nvim_techniques_s7/ Series 6: https://jdhao.github.io/2019/12/21/nifty_nvim_techniques_s6/ Series 5: https://jdhao.github.io/2019/11/11/nifty_nvim_techniques_s5/ Series 4: https://jdhao.github.io/2019/09/17/nifty_nvim_techniques_s4/ Series 3: https://jdhao.github.io/2019/05/14/nifty_nvim_techniques_s3/ Series 2: https://jdhao.github.io/2019/04/17/nifty_nvim_techniques_s2/ Series 1: https://jdhao.github.io/2019/03/28/nifty_nvim_techniques_s1/

2021/6/17
articleCard.readMore

安卓外贸电视盒子体验

家里有一台闲置的电视,想平时用来看 YouTube,看电影,于是决定入手一款电视盒子。试用了几款价格比较低的品牌电视盒子(小米、当贝),发现都无法轻松观看 YouTube,安装安卓应用也经常装不了。在寻找合适的电视盒子过程中了解到外贸盒子这种品类,外贸盒子的特点是配置高,但是通常做工一般。最近一个月也试用了两款电视盒子,实际上手体验的确不佳。

2021/6/13
articleCard.readMore

Serving Concurrent Requests for LibreOffice Service

We have set up a server to convert pptx files to pdf files using LibreOffice (version: 6.0.7.3 ). Libreoffice is started using subprocess.run() command in Python. The external command I use is something like the following1:

2021/6/11
articleCard.readMore

Excel Processing using Pandas

A brief summary of how to read and write excel files using Pandas package.

2021/6/11
articleCard.readMore

How to Merge PDF Files

I have several PDF files that I want to merge to one file. Each page in the PDF is actually an image. Here is what works best for me.

2021/5/31
articleCard.readMore

健康的公司和员工关系

加入公司快三年了,当初一起入职的同事最近几个月走了许多,我们组也有几位同事离职了,频繁的人事动荡多少也给其他人带来了冲击,正好来谈谈最近一直在思考的公司如何对待员工的问题。

2021/5/23
articleCard.readMore

当贝盒子 H1 使用体验

给老家的电视配了一个小米盒子 4s(安卓 6.0 系统,2g内存+8g存储,参考这里),感觉可以,回深以后也想给这边的电视配一个盒子。京东上当贝盒子 H1 的评价不错,就入手了当贝盒子 H1,以下是我的使用感受。

2021/5/9
articleCard.readMore

How to Use The Git-tag Feature

My notes on using tag feature of Git.

2021/5/8
articleCard.readMore

小米盒子 4s 初体验

小米盒子 4s 是小米在 2020 年推出的最新款盒子产品,颜值高,使用起来效果也不错。

2021/4/30
articleCard.readMore

广州之行

在周末跟着团队来广州团建,第二次来广州玩。

2021/4/18
articleCard.readMore

Notes on FFmpeg (1)

2021/4/16
articleCard.readMore

Post Nested Data Structure to the Server Using Requests

In this post, I will share how to post complex data and decode it in the server side in Python.

2021/4/8
articleCard.readMore

菜谱: 茄子肉沫,糖醋排骨

2021/4/5
articleCard.readMore

Why Are Some Logging Messages Missing in Python?

In my project, I use the Python logging package for logging service.

2021/4/1
articleCard.readMore

Creating Beautiful Bash Prompts

This post summarize how to change the Bash shell prompt to a better look. The end result is shown in the title image.

2021/3/31
articleCard.readMore

How To Install Latest Version of Git on Linux

Update log 2021-12-10: update endpoint rpm link for git The version of the default git bundled with the Linux system is often too old, and lacks certain features, which may break some tools. This post summarizes how to install newer versions of Git on Linux.

2021/3/27
articleCard.readMore

Notes on Docker -- s3

Personal notes on docker usage.

2021/3/25
articleCard.readMore

Better Zsh history

My notes on setting up history-related features for zsh.

2021/3/24
articleCard.readMore

菜谱;芹菜牛肉,清炒生菜

个人菜谱备忘。

2021/3/22
articleCard.readMore

Set up true color for nvim and tmux in Zoc terminal and xshell

In my daily work, I often ssh to a remote server using a terminal emulator. My local machine is a Windows 10 desktop. In this post, I want to share how to make true color work across terminal emulator, nvim and tmux.

2021/3/17
articleCard.readMore

print message not shown in nohup.out?

When starting a long-running Python program, I often run it under nohup so I can redirect all the output to nohup.out for easier inspection. I use nohup python test.py& to run the process in the background. Then I can run tail -f nohup.out to monitor the output message from this program.

2021/3/16
articleCard.readMore

Why is Wrong Stacktrace Printed for My Code?

The other day, when I was updating the source code with the project running, I noticed that the exception stack trace printed is not right, i.e., the printed error line is actually not the line that is triggering the exception.

2021/3/13
articleCard.readMore

腊汁肉制作

本文总结简易家庭版腊汁肉夹馍中的腊汁肉制作。

2021/3/7
articleCard.readMore

如何制作一碗美味的豌杂面

作为北方人 and 面食爱好者,周末尝试做了四川美食豌杂面,本文总结家庭版豌杂面的制作。

2021/3/6
articleCard.readMore

Vim 实现的输入法体验

文接上回,Vim 虽然贵为编辑器之神,有一个没有解决好的问题就是输入中文,以及中英文的切换问题。最近也尝试了一些试图利用 Vim 提供的功能,在 Vim 中实现输入法的插件。本文做一总结点评。

2021/2/26
articleCard.readMore

如何让 Neovim 中文输入时自动切换输入法

更新日志 2023-06-18:增加 macism 以及 im-select.nvim 使用。 2022-11-07:针对 macbook M1 CPU 设置添加说明,添加 smartim 插件使用。 Vim/Neovim 下输入中文最大的痛,就是在 Normal 模式下,需要频繁从中文模式切换到英文模式,来输入 Vim 的各种命令。本文总结几款插件,可以帮助我们在 macOS、Windows 下,进入 Normal 模式的时候自动切换到英文输入。

2021/2/25
articleCard.readMore

Set up Inverse Search for LaTeX with VimTeX and Neovim

2022-01-19: With the release of VimTeX v2.8, all the hack here may not be needed anymore. Update log 2021-10-22: Update the script to write server name. 2021-10-10: Fix typo and minor tweak. Since --remote option hasn’t been restored by Neovim, it is actually not very straightforward to set up inverse search for PDF files when we are editing large LaTeX files with the help of VimTeX. I spend some time figuring out how to do it on both Windows and macOS and succeed. I thought it would be helpful for people looking for the solution.

2021/2/20
articleCard.readMore

Git Learning Notes (3)

Git learning notes.

2021/2/17
articleCard.readMore

如何制作饺子馅

如何制作美味的饺子馅。

2021/2/13
articleCard.readMore

记录我的 2020

用文字记录生活,给自己的生命留下印迹,我的 2020。

2021/2/11
articleCard.readMore

Using Proxy in Python Requests package

If we need to access the internet via a proxy server, we should set proxy properly when making HTTP/HTTPS requests using the Requests package.

2021/2/7
articleCard.readMore

How to Get or Set Clipboard Text in Python

There are several Python packages by which we can get and set the system clipboard.

2021/2/3
articleCard.readMore

Bracketed Paste Mode in Terminal

A note on bracketed paste mode in terminal and Neovim.

2021/2/1
articleCard.readMore

Tmux Cheatsheet

In this post, I collect some useful tips for using Tmux.

2021/1/25
articleCard.readMore

Better Git log

Some of the settings to make git log better.

2021/1/25
articleCard.readMore

Anaconda Python 和 pip 国内源/镜像

使用国外的源下载 Python 发行版和各种 Python 库,速度实在是太慢了😭😠,国内的源速度会快很多,权宜之计。

2021/1/17
articleCard.readMore

Install Python3 in Ubuntu Docker

Build a Ubuntu docker with Python3 and pip support.

2021/1/17
articleCard.readMore

Cross the Wall

To cross the fucking firewall, we need some handy tools.

2021/1/10
articleCard.readMore

解决 GitHub 资源无法下载的问题

更新记录 2022-02-08: fasgit hub 被 GFW 封了,换一个地址。 GitHub 虽然没被封,但是阻断严重,下载 GitHub 资源速度奇慢无比,总结一些验证可行的方法。

2021/1/8
articleCard.readMore

Nifty Nvim/Vim Techniques That Make My Life Easier -- Series 9

This is the 9th post of my post series on nifty Nvim/Vim techniques that will make my editing experience easier. Click here to check other posts in this series. Series 11: https://jdhao.github.io/2021/11/22/nifty_nvim_techniques_s11/ Series 10: https://jdhao.github.io/2021/06/17/nifty_nvim_techniques_s10/ Series 8: https://jdhao.github.io/2020/11/11/nifty_nvim_techniques_s8/ Series 7: https://jdhao.github.io/2020/09/22/nifty_nvim_techniques_s7/ Series 6: https://jdhao.github.io/2019/12/21/nifty_nvim_techniques_s6/ Series 5: https://jdhao.github.io/2019/11/11/nifty_nvim_techniques_s5/ Series 4: https://jdhao.github.io/2019/09/17/nifty_nvim_techniques_s4/ Series 3: https://jdhao.github.io/2019/05/14/nifty_nvim_techniques_s3/ Series 2: https://jdhao.github.io/2019/04/17/nifty_nvim_techniques_s2/ Series 1: https://jdhao.github.io/2019/03/28/nifty_nvim_techniques_s1/

2021/1/7
articleCard.readMore

Copy from Remote Server to Local Clipboard via OSC 52 in Neovim

In my daily work, I usually log into a remote server via a terminal emulator and do my development work there. Sometimes, I need to copy text from remote server to my local machine’s clipboard. Previously, I use mouse to select and copy the text, which I find to be quite cumbersome.

2021/1/5
articleCard.readMore

Using Concurrent.futures in Python

My notes on using concurrent.futures in Python.

2020/12/29
articleCard.readMore

Git Directory and Work-Tree Explained

Git has two option --git-dir and --work-tree. What is the use for them?

2020/12/25
articleCard.readMore

Linux Tips and Tricks -- s3

Calculate the stat of a column of numbers # Suppose we have a file where each line a number, and we want to the get stat of these numbers on the command line. Use python # If Python is installed in the system, we can use the following command:

2020/12/22
articleCard.readMore

Introducing better-esacape.vim: My First Vim/Neovim Plugin

After using and learning Neovim for over 2 years, I have finally published my first plugin – better-escape.vim.

2020/12/18
articleCard.readMore

Build C++ Project with CMake -- A Simple Example

For small projects, people tend to directly invoke the compiler with the suitable options to build the program. While it is feasible, it is tedious to type those compilation options and flags. For projects with multiple source files and header files, it becomes inefficient to build by hand. On Linux, people may write Makefile and build with make. On Windows, people may use Visual Studio for writing and build their project.

2020/12/12
articleCard.readMore

Why Are Some Libraries Linked by Default in GCC?

Different behavior of linkage between Clang and GCC.

2020/12/10
articleCard.readMore

Building OpenCV from Source on Linux

In this post, I will summarize how to build OpenCV from source, and introduce how to use it when writing C++ programs.

2020/12/7
articleCard.readMore

Get Pinyin Initials of Chinese characters

To get a reasonably large collection of traditional and simplified Chinese characters in use toady, we may use zhon:

2020/12/4
articleCard.readMore

Setting up Neovim for C++ Development with LSP

update log 2022-02-08: update fastgit URL In this post, I would like to share how to set up Neovim for writing simple C++ programs.

2020/11/29
articleCard.readMore

A Better Mapping to Leave Insert Mode than jk

Update 2021-01-14: I ended up writing a plugin called better-escape.vim which aims at solving this issue. A very popular insert mode mapping for Neovim/Vim is to map jk or kj or jj to <ESC> for quicker escaping from the insert mode. I have used the following mapping for quite some time: inoremap jk <ESC>

2020/11/23
articleCard.readMore

The Correct Way to Create List of Empty List in Python

TL;DR: do not use list multiplication to initialize an empty list of list, or you will end up wasting hours debugging your program.

2020/11/22
articleCard.readMore

几种中文分词工具对比

Update log 2021-10-23: fix typo,更新链接。 对几种中文分词工具进行了调研,简单总结一下。

2020/11/20
articleCard.readMore

Pillow/PIL 缩放索引图像时的一个问题

今天遇到了一个有趣的问题,有人在 v2ex 上说自己的图片,经过 PIL 缩放到 800x600 以后,非常模糊,有什么办法可以解决。

2020/11/18
articleCard.readMore

Set up Fuzzy Completion for Vim-lsp

Update 2021-07-15: Note that pyls has been deprecated. There is new fork of it called pylsp, which is maintained by the community. In my older post, I have shared how to set up auto-completion for vim-lsp with the help of deoplete. One annoyance is that I can not use fuzzy matching for auto-completion: the completion items in the pop-up completion menu seems to be selected base on prefix matching.

2020/11/16
articleCard.readMore

A Beginner's Guide on Creating Your Own Text Objects from Scratch in Neovim/Vim

Shortly after I started using Neovim, I learned about the concept of text objects. For example, when the cursor is inside a pair of [], we can use ci] to change text inside them. This is definitely one of the greatest moments on my road of learning Vim. However, I haven’t really thought about how does text object really work.

2020/11/15
articleCard.readMore

Nifty Nvim/Vim Techniques That Make My Life Easier -- Series 8

This is the 8th post of my post series on nifty Nvim/Vim techniques that will make my editing experience easier. Click here to check other posts in this series. Series 11: https://jdhao.github.io/2021/11/22/nifty_nvim_techniques_s11/ Series 10: https://jdhao.github.io/2021/06/17/nifty_nvim_techniques_s10/ Series 9: https://jdhao.github.io/2021/01/07/nifty_nvim_techniques_s9/ Series 7: https://jdhao.github.io/2020/09/22/nifty_nvim_techniques_s7/ Series 6: https://jdhao.github.io/2019/12/21/nifty_nvim_techniques_s6/ Series 5: https://jdhao.github.io/2019/11/11/nifty_nvim_techniques_s5/ Series 4: https://jdhao.github.io/2019/09/17/nifty_nvim_techniques_s4/ Series 3: https://jdhao.github.io/2019/05/14/nifty_nvim_techniques_s3/ Series 2: https://jdhao.github.io/2019/04/17/nifty_nvim_techniques_s2/ Series 1: https://jdhao.github.io/2019/03/28/nifty_nvim_techniques_s1/

2020/11/11
articleCard.readMore

Notes on Using Python Regex Package

Some notes on using regular expressions in Python.

2020/11/9
articleCard.readMore

Set Up Lisp Dev Environment in Neovim

A quick summary on how to set up Lisp Development environment in Neovim.

2020/11/8
articleCard.readMore

Profiling Python Code with line_profiler

To profile Python code line by line, we can use line_profiler1.

2020/11/6
articleCard.readMore

Flake8 Config in Pyls for Code Linting.

Update 2021-07-15: Note that pyls has been deprecated. There is new fork of it called pylsp, which is maintained by the community. In my previous post, I have go over the basic setup to make vim-lsp work. However, I haven’t touch on an important part of writing code: linting. It turns out that configure it correctly is harder than I thought.

2020/11/5
articleCard.readMore

Replace Deoplete-jedi with LSP Finally

Update 2021-07-15: Note that pyls has been deprecated. There is new fork of it called pylsp, which is maintained by the community. After using deoplete along with deoplete-jedi for more than two years, I have finally decided to try something new for code completion. Yeah, you guess it, the Language Server Protocol (LSP in short).

2020/11/4
articleCard.readMore

解决不蒜子 (busuanzi) 文章计数出错问题

一个月之前,就发现自己的博客用的计数系统“不蒜子”对每篇博客访问量的统计出现了问题,刚写的博文,访问量都是几十万,显然不正常,但是很神奇,整个博客的访问量统计似乎并没有问题。当时也在 v2ex 发帖咨询了,不过没有人给出合理的答案,今天偶然间发现了原因,发文记录。

2020/10/31
articleCard.readMore

杨振宁的一个采访

在 YouTube 上看到了杨振宁在 2006 年的一个采访,挺不错。

2020/10/30
articleCard.readMore

Edit Multiple Files at once in Neovim

When I was in a folder and tried to edit multiple files using glob pattern with the following Neovim command: :edit *.vim I was surprised to find that Neovim gives the following error message: E77: Too many file names.

2020/10/28
articleCard.readMore

Bash Emacs-style Shortcut Cheatsheet

In Bash shell, when editting in the command line. There are two different modes, vi mode or Emacs mode. Emacs-mode is the default mode. Below are some of the handy shortcuts in Emacs-mode.

2020/10/26
articleCard.readMore

Switching Buffers in Neovim with mapping

I usually use {num}Ctrl-6 to switch buffers in Neovim, where {num} is the number of buffer (see this post). Since Neovim has built-in gt mapping to switch between tabpages, I thought it might be a good idea to use gb as buffer switching shortcut avoid strech when pressing Ctrl-6.

2020/10/16
articleCard.readMore

How to Insert Unicode Characters in Neovim/Vim

Except for the ASCII characters, it is often not straightforward to insert Unicode characters into Vim/Neovim. Below I will summarize a few ways to enter Unicode characters inside Neovim/Vim.

2020/10/7
articleCard.readMore

美国普罗米修斯--奥本海默传

最近一个月读了 Kai bird 和 Martin J. Sherwin 的《American prometheus》,这本书是著名物理学家奥本海默的传记,详细讲述了奥本海默的一生。为了写这本书,作者花了 25 年的时间,做了很多采访,查看了很多 FBI 关于奥本海默的资料。这本书是关于奥本海默的权威著作,2005 甫一问世, 2006 年就获得了普利策奖(传记类)。

2020/10/3
articleCard.readMore

Nifty Nvim/Vim Techniques That Make My Life Easier -- Series 7

This is the 7th post of my post series on nifty Nvim/Vim techniques that will make my editing experience easier. Click here to check other posts in this series. Series 11: https://jdhao.github.io/2021/11/22/nifty_nvim_techniques_s11/ Series 10: https://jdhao.github.io/2021/06/17/nifty_nvim_techniques_s10/ Series 9: https://jdhao.github.io/2021/01/07/nifty_nvim_techniques_s9/ Series 8: https://jdhao.github.io/2020/11/11/nifty_nvim_techniques_s8/ Series 6: https://jdhao.github.io/2019/12/21/nifty_nvim_techniques_s6/ Series 5: https://jdhao.github.io/2019/11/11/nifty_nvim_techniques_s5/ Series 4: https://jdhao.github.io/2019/09/17/nifty_nvim_techniques_s4/ Series 3: https://jdhao.github.io/2019/05/14/nifty_nvim_techniques_s3/ Series 2: https://jdhao.github.io/2019/04/17/nifty_nvim_techniques_s2/ Series 1: https://jdhao.github.io/2019/03/28/nifty_nvim_techniques_s1/

2020/9/22
articleCard.readMore

Highlight Groups Cleared after Starting Neovim

I want to use a custom highlight group for yank highlighting. Initially, I use the predefined highlight group IncSearch. I thought it a bit dim and want something brighter. So I defined the following highlight group:

2020/9/22
articleCard.readMore

Grammar Check in Neovim with LanguageTool

As a Neovim user who writes frequently, I want to use Neovim to check my grammar before posting it in my blog. In this post, I will compare several plugins used for grammar checking. Under the hood, they all use the opensource tool languagetool.

2020/9/20
articleCard.readMore

Find Line History in Git

When we are working on a real project, we may want to know from which commit a particular line is introduced.

2020/9/14
articleCard.readMore

Tqdm Issues and Tips

Tqdm is a popular package to show a progress bar. Here are a few tips when using tqdm.

2020/9/5
articleCard.readMore

A List of Common Git-branch Operations

Update log 2022-08-20: Add how to remove remote tracking branches that does not exist anymore This post summarizes some commonly used Git commands related to branch operations.

2020/9/3
articleCard.readMore

My Settings for the Fuzzy-finder LeaderF

LeaderF is Vim/Neovim plugin to fuzzy-search files, colorschemes, tags etc. quickly. It works across different platforms flawlessly. Here are some of its settings to address minor issues.

2020/8/26
articleCard.readMore

从产品猜测设计

关于产品设计的一些想法。

2020/8/24
articleCard.readMore

Measuring Code Running Time with contextmanager

In Python, context manager is a great way to handle the closing of resources. It makes sure that resources are correctly closed after their use.

2020/8/18
articleCard.readMore

Create Outline Text in Python with Pillow

update log 2022-04-12: add warning about dangers of omitting stroke_fill parameter. Sometimes, we may want to add outline color to text strokes with Pillow. Prior to version 6.2.0, we can not do this in Pillow. Fortunately, starting from version 6.2.0, pillow supports text outlines natively in its ImageDraw.text() method.

2020/8/18
articleCard.readMore

The Warmup Trick for Training Deep Neural Networks

Warmup is a training technique often used in training deep neural networks. In this post, I will try to explain what is warmup, and how does it work.

2020/8/14
articleCard.readMore

MIUI 12 输入法无法复制文本到剪切板

MIUI 12 更新以后,新增了更加细致的权限管理和隐私保护功能。

2020/8/6
articleCard.readMore

Note on font size

Relationship between point and pixel size # In digital typography, the size of text is commonly specified in points (pt). What is a point? A point is 1/72 of an inch (25.4 mm), i.e., 0.3528 mm (25.4/72). Therefor, point is a physical unit that has absolute value. Pixels are the smallest unit on screen to display images and graphics. It is not a physical unit. So there is no fixed relationship between point and pixel.

2020/8/4
articleCard.readMore

pip bad interpreter issue

I am using pip installed via minconda. I installed it under ~/miniconda3 and then move the installation directory to ~/tools/miniconda3. After that, I changed the PATH accordingly. However, when I use pip, I am seeing the following error:

2020/7/29
articleCard.readMore

Using Multiprocessing in Python

One way to achieve parallelism is to use multi-processing, where we can execute tasks in different cores of the CPU to reduce the total processing time. Python provides the multiprocessing package to facilitate this. This post summarizes some of the questions I have when I learn to use multiprocessing in Python.

2020/7/27
articleCard.readMore

Linux Tips and Tricks -- s2

A list of Linux command for common operations.

2020/7/23
articleCard.readMore

Why Cannot I Get the Value of A Env Variable in Python?

I found a strange issue when I wanted to get the value of an env variable from Python script.

2020/7/15
articleCard.readMore

Note on Using requests package

How to check request header and body? # When making requests, we may want to see exactly what are being requested. With requests, it is easy do access the request header and request body: import requests url = "http://httpbin.org/post" payload = {"apple": 10, "pear": [20, 30], "img": "http://example.com/demo.jpg"} r = requests.post(url, json=payload) print(f"request headers: {r.request.headers}") print(f"request body: {r.request.body}") A sample output is: request headers: {'User-Agent': 'python-requests/2.19.1', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-alive', 'Content-Length': '69', 'Content-Type': 'application/json'} request body: b'{"apple": 10, "pear": [20, 30], "img": "http://example.com/demo.jpg"}' Ref:

2020/7/9
articleCard.readMore

Set the Number of Threads to Use in PyTorch

In this post, I will share how PyTorch set the number of the threads to use for its operations.

2020/7/6
articleCard.readMore

如何找到技术问题根源?

在实际编程中,我们总会遇到各种各样的代码运行问题,如何快速发现问题的根源需要一些系统的方法,构造一个最小的能够复现错误的环境至关重要,也就是所谓的 MWE,minimal working example。

2020/7/5
articleCard.readMore

Switch Command with update-alternatives on Ubuntu

To build different projects, we may need to install different versions of the same software. To use a specific version, we may need to create a sym link to that version of the executable.

2020/7/2
articleCard.readMore

uWSGI Install and Use Issues

My notes on several issues when installing and running uWSGI.

2020/7/2
articleCard.readMore

Downloading Images Faster with requests Sessions

In my previous post, I write about how to download an image from URL using requests. In this post, I want to share ways to make the download speed faster.

2020/6/21
articleCard.readMore

IrfanView Settings

IrfanView is a lightweight, fast and powerful image viewer for Windows. Here are some settings to make it more useful.

2020/6/20
articleCard.readMore

Duplicate Logging Messages in Python

When I am working on a project, I find that the same message is printed twice. The following minimal code can reproduce this issue:

2020/6/20
articleCard.readMore

How to Download Image from URL using Python

Recently, I want to download some images using Python. This is what I’ve learned after the survey.

2020/6/17
articleCard.readMore

Tmux: Open Terminal Failed in Kitty Terminal

I have several terminal emulators installed on my Mac: kitty, Alacritty and iterm2. When I start a Tmux session in Alacritty and try to create another tmux session in kitty, I noticed this strange error that I have never met before:

2020/6/14
articleCard.readMore

Serving Flask Applications with uWSGI

In my older post, I have shared how to run the built-in development server to serve Flask web service. For production, we need to use more powerful web servers. Flask complies to the WSGI specification and can work with any web server that conforms to WSGI. In this post, I want share how to run Flask applications using uWSGI — a popular WSGI-compliant server.

2020/6/13
articleCard.readMore

Virtual Environment Management with Conda

Conda is the default package and environment management tool shipped with Anaconda. This post logs my cheatsheet and notes for working with virtual environments with conda.

2020/6/11
articleCard.readMore

Set Timezone inside Docker Container

After running a Ubuntu docker container, I found that the default time zone is UTC. I want to change it to my local timezone.

2020/6/11
articleCard.readMore

How to Use Asyncio with Flask Applications

I was using asyncio inside a view function for Flask to run some asynchronous functions and met an error.

2020/6/7
articleCard.readMore

Markdown Writing Tricks

update log 2022-02-08: Add sections on using CSS with Markdown. In this post, I share some of the tricks that will Make the Markdown file better and more beautiful.

2020/6/1
articleCard.readMore

Why You Should Use Snippets in Vim/Neovim

If you find yourself repeatedly type some similar-structured text in Vim/Nvim, you need to ask yourself if there is a better way to do it.

2020/5/27
articleCard.readMore

Highlight Yanked Region in Nvim/Vim

update (2020-09-19): update the settings for Nvim to reflect the latest changes in API. In Vim or Neovim, showing the yanked region in color gives use visual feedback on what we have copied. Here is how you can highlight yanked region in Vim or Neovim.

2020/5/22
articleCard.readMore

AI 的噱头

人工智能 (AI)甚嚣尘上,动则称颠覆,各家公司纷纷推出了自己的 AI 产品,但是这些产品真的有那么多人用吗?

2020/5/22
articleCard.readMore

Justmysocks 支持 v2ray 协议了!

two meetings 即将或者正在召开,上个谷歌也越来越难,最近墙对各种工具的阻断非常严重,连之前使用了 obfs 的 ss 都不行了,最近一段时间也处于时断时续的状态。 Justmysocks 之前一直用的都是 shadowsocks 协议,对墙的反制能力不行,每到关键时候就显露疲态。好消息是,justmysocks 终于在最近推出了基于 v2ray 协议的线路。

2020/5/22
articleCard.readMore

Space for CJK Languages (CJK 语言中的空格)

I was doing some typograph for Chinese text and want to insert a space equal to the width of a Chinese character. 最近在做一些中文排版的工作,有一个需求是在中文字符之间插入空格,并且空格的宽度等于中文字符的宽度,在某些情况下这样排版显得更加美观。

2020/5/16
articleCard.readMore

如何高效使用搜索引擎解决技术问题

之前感叹过使用中文搜索经常找不到想要的结果,这篇文章总结我对于如何有效搜索的一些想法。

2020/5/9
articleCard.readMore

Git Learning Notes (2)

My Git learning notes.

2020/5/7
articleCard.readMore

Kitty Terminal Config on Mac

Changelog 2021-08-21: Update the part on how to open URLs since some options are removed. Kitty is a fast and lightweight terminal emulator for Mac and Linux. In this post, I will summarize some of its settings.

2020/5/5
articleCard.readMore

Docker 学习系列 --- 2

本文总结一些 Docker 使用以及 Docker 镜像构建过程中遇到的问题。

2020/5/2
articleCard.readMore

Docker 学习系列 --- 1

Docker 是一种类似虚拟机的机制,允许我们在 host 机器创建一个隔绝的小型操作系统环境,并且可以保存下这个环境(称为 Docker 镜像),把这个 Docker 镜像部署到其他 host 机器,各个机器上的环境完全一致。这样我们就不需要每次在部署新环境的时候,重复执行安装程序、配置环境的流程,大大简化了我们的工作,提升了工作效率。

2020/5/2
articleCard.readMore

Bash Script Note 1

Writing robust scripts # We should use the following options in our bash script for better quality:

2020/4/27
articleCard.readMore

解决 Windows 下文件管理器中右键单击无响应问题

引子 # 最近使用工作电脑的时候,不知道为什么,在文件资源管理器里面鼠标右键单击打开菜单(也叫context menu)的时候,系统很大概率会卡顿,鼠标指针开始转圈,文件管理器白屏,然后会提示"未响应",过一会儿,右键菜单才会出现。以至于我每次点击右键之前,都很烦躁,希望不要出现卡顿的情况。

2020/4/26
articleCard.readMore

Shadowsocks 配置 obfs

最近几个月在手机上使用 justmysocks,感觉速度很慢,经常断流,连接不上。通过搜索,发现原因是使用的线路问题。为了学习之用,我们可以通过配置 obfs 增强服务稳定性。

2020/4/25
articleCard.readMore

How to Use Unified Logging Config Across Your Project

When we are working on a project, we often need to log some message for easier debugging. How do we configure logging once and use it across the project?

2020/4/24
articleCard.readMore

Git Learning Notes (1)

This is my personal note on learning Git.

2020/4/23
articleCard.readMore

Set up for C++/C Development in Neovim

This post summarizes how to set up various plugins needed for C++/C code editing, linting and formatting.

2020/4/19
articleCard.readMore

Get Current Time with Time Zone Info in Python

I am trying to generate a custom time format using the Python datetime package. My original code is: from datetime import datetime print(datetime.now().strftime("%Y-%m-%d %H:%M:%S%z"))

2020/4/17
articleCard.readMore

Build Web API with Flask --- Work with JSON-like Dict

This is a simple post about how to send JSON-like Dict data to a Flask server via requests package.

2020/4/13
articleCard.readMore

Build Web API with Flask -- Post and Receive Image

In this post, I want to write about how to build a simple image processing web API that returns the size of an image. The topics include how to build this web API with Flask and how to post image to this web API and get response.

2020/4/12
articleCard.readMore

Build A Web API Service Using Flask -- The Basics

Web API is a kind of web application. Simply put, web APIs are built for other applications to get info from the web server. For Python, Flask can be used to build web applications. In this post, I want to share how to build web APIs with Flask.

2020/4/6
articleCard.readMore

Convert PPTX Document to JPEG Images on Ubuntu

Changelog 2020-12-24: Add how to convert pptx to pdf using unoconv. In this post, I will share how to convert PPTX file to images. There are two steps. The first step is to convert PPTX to PDF, and the second step is to convert PDF to JPEG.

2020/3/30
articleCard.readMore

Conversion between base64 and OpenCV or PIL Image

When we are building web services using Python, we often send or receive images in base64 encoded format. However, when we are doing image processing tasks, we need to use PIL or OpenCV. In this post, I will share how to convert between OpenCV or PIL image and base64 encoded image.

2020/3/17
articleCard.readMore

腾讯云对象存储博客图床开启 CDN 加速(不需要购买额外域名)

本文主要分享腾讯云对象存储开启 CDN 的方法,不需要购买额外的域名。

2020/3/16
articleCard.readMore

Search and Replace in Multiple Files in Vim/Neovim

In Sublime-Text and other editors, we can press Ctrl-Shift-F to invoke the search and replace UI. We can also accomplish this task easily in Vim or Neovim with the built-in features. Here is how. There are two steps involved in this task. The first step is to find the files containing the search pattern under the current project or directory. The second step is to perform replacement for each file found in 1st step.

2020/3/14
articleCard.readMore

Change Table Column Width in LaTeX

When we create tables in LaTeX, the table column width will be automatically decided based on the content in the table cell. Sometimes, maybe we are not satisfied with the default column width and want to customize the column width. In this post, we will explain how to it in LaTeX.

2020/3/8
articleCard.readMore

Image or Table Side by Side in LaTeX

When we are writing articles using LaTeX, we often need to create side-by-side images or tables. In this post, I summarize several methods to achieve that.

2020/3/7
articleCard.readMore

LaTeX 并排显示图像或表格

使用 LaTeX 写文章的时候,经常需要并排显示图片或者表格,本文总结几种实现方法。

2020/3/7
articleCard.readMore

Tips on Writing Papers in LaTeX

Some useful tips on writing papers in LaTeX.

2020/3/6
articleCard.readMore

Point to Line Distance in 2D Plane

Suppose that we have a straight line formed by point B and C, and we have another point A. What is the distance from point A to line BC?

2020/2/23
articleCard.readMore

解决 Matplotlib 使用中文乱码问题

注:这是一篇旧文的中文翻译版本。 前不久,我在使用 Matplotlib 画图的时候,发现一些 Unicode 字符(例如,汉字) 无法正常显示:在生成的图片中,汉字是乱码的,显示为一个方框。经过大量的查找和阅读,我终于明白了如何在使用 Matplotlib 时,正确渲染 Unicode 字符1。

2020/2/22
articleCard.readMore

疫情时期的食物

新型冠状病毒疫情已经持续了差不多一个月,一切还没有恢复正常,3 号从家里回到深圳,正是疫情严重的时刻,大家都如临大敌。住处附近的餐馆都关了门,想在外面吃饭也不行了。为了减少外出,降低感染的风险,于是尽量从网上买菜。疫情之前,已经开始用叮咚买菜和朴朴超市,不过用的频率不高,疫情来了,更依赖这些在线服务,感谢这些疫情期间仍然开张的在线服务和送菜的小哥们。

2020/2/21
articleCard.readMore

Ripgrep Searching CheatSheet

Ripgrep is a command line tools that searches patterns under your current directory, like the good old grep, but with faster speed. In this post, I list some of the commonly-used flags for ripgrep.

2020/2/16
articleCard.readMore

Mac 系统如何远程连接控制 Windows 电脑

本文简单总结 macOS 系统远程连接 Windows 系统需要的工具以及简单设置。

2020/2/9
articleCard.readMore

为什么要用英语以及谷歌?

V2ex 是一个程序员聚集的论坛,也是我经常访问的一个论坛,经常有人在论坛上提问技术问题。前两天遇到一个帖子,问的是 vscode 如何取消按下点以后自动补全第一个候选项。

2020/1/22
articleCard.readMore

Missing Level 1 Header in TOC in Latest Hugo

After updating Hugo to the latest version (v0.62), apart from the issue of missing HTML code, I have also observed that level 1 header written in Markdown is not rendered in the generated TOC.

2020/1/19
articleCard.readMore

Vim 和 Neovim 的前世今生

引子 # 从完全使用 Neovim 进行日常项目开发与文档写作到现在,已经过去大约一年半的时间。一年半以前,我对 Vim 的了解还处在非常初级的阶段,甚至还不知道 Neovim,经过长时间的使用与学习,目前已经达到了熟练使用的程度。当然,Vim 的知识过于庞大,即便我已经使用了一年半的时间,还有很多 Vim/Neovim 的特性或者知识仍然有待了解与发掘。 在使用 Neovim 的过程中,我对 Neovim 和 Vim 的历史以及它们之间的恩怨情仇也产生了兴趣,散布在互联网上各处的博客、视频以及论坛讨论让我对过去的历史有了一定了解。 P.S., 我建立了一个 nvim 中文用户 tg 群,有兴趣可以加入。

2020/1/12
articleCard.readMore

Hugo Post Missing (Hugo 博客文章缺失问题)

Recently, when I was trying to generate my blog site using Hugo, I found that all my posts were successfully rendered, except for one new post. This was rather strange. 最近在使用 Hugo 生成博客文章的时候,发现有一篇新写的文章无法生成,而其他博文都可以成功渲染,非常奇怪。

2020/1/11
articleCard.readMore

我的 2019 阅读清单

2019 年年末的这三个月过得很快,最近一个月都在紧张忙碌中度过,以至于错过了年末的时间,没有写一篇 2019 年的阅读总结。

2020/1/11
articleCard.readMore

Doing Number Arithmetics in Vim/Neovim Substitutions

In this post, I want to share how to do number arithmetic quickly and get what you want in specified format. More specifically, the topic is: How do we add, subtract, multiply or divide a value to each number in a range?

2020/1/10
articleCard.readMore

Regex Keyword and Python Interpolation in Ultisnips

Vim-snippet provides a lot of useful Ultisnips snippets for various filetypes. For example, for Markdown, to insert level 1 header, the snippet trigger is sec, and for level 2 and 3 header, the triggers are ssec and sssec respectively. These triggers are non-intuitive and hard to remember and type.

2020/1/5
articleCard.readMore

Firenvim: Neovim inside Your Browser

Update log 2022-08-15: update firenvim conf; add install setting for packer.nvim Introduction # Last year, I have written a post on how to edit texts inside the browser using Vim/Nvim or browser extensions that have Vim emulations. However, none of them is good enough, since they are either not convenient to use or lacking features compared to real Neovim empowered by various plugins.

2020/1/1
articleCard.readMore

Content inside HTML tags missing in Latest Hugo?

Due to Markdown’s inability to center and resize image properly, I use the raw HTML tags inside markdown file to include images: 由于 Markdown 格式无法很好居中和设定图像尺寸,我使用 HTML tags 来添加图像(图像可以很好居中以及设定显示大小):

2019/12/29
articleCard.readMore

Creating Markdown Front Matter with Ultisnips

Introduction # Currently, I write my blog posts in Markdown and build the blog using Hugo. Hugo supports front matter for Markdown so that you can attach metadata for a post, such as title, date, tags, categories, etc.

2019/12/22
articleCard.readMore

Labelme JSON 标注格式转 voc XML 格式

Labelme 是一款常用的计算机视觉任务标注工具,可以用来标注分类,检测,分割等任务的数据。对于检测任务,labelme 生成的标注文件是 json 格式,每个图像对应一个相应的 json 文件。但是很多任务都使用 PASCAL VOC 的 xml 格式标注,例如 maskrcnn-benchmark 任务中的 voc 数据集。

2019/12/21
articleCard.readMore

Nifty Nvim Techniques That Make My Life Easier -- Series 6

This is the 6th post of my post series on nifty Nvim/Vim techniques that will make my editing experience easier. Click here to check other posts in this series. Series 11: https://jdhao.github.io/2021/11/22/nifty_nvim_techniques_s11/ Series 10: https://jdhao.github.io/2021/06/17/nifty_nvim_techniques_s10/ Series 9: https://jdhao.github.io/2021/01/07/nifty_nvim_techniques_s9/ Series 8: https://jdhao.github.io/2020/11/11/nifty_nvim_techniques_s8/ Series 7: https://jdhao.github.io/2020/09/22/nifty_nvim_techniques_s7/ Series 5: https://jdhao.github.io/2019/11/11/nifty_nvim_techniques_s5/ Series 4: https://jdhao.github.io/2019/09/17/nifty_nvim_techniques_s4/ Series 3: https://jdhao.github.io/2019/05/14/nifty_nvim_techniques_s3/ Series 2: https://jdhao.github.io/2019/04/17/nifty_nvim_techniques_s2/ Series 1: https://jdhao.github.io/2019/03/28/nifty_nvim_techniques_s1/

2019/12/21
articleCard.readMore

macOS 下如何为视频制作字幕

几周之前,在 YouTube 上看到了 Vim 创始人 Bram Moolenaar 在 Vim Conf 2018 上的主题报告,介绍了 Vim 的历史以及可能要添加的一些新特性,萌生了给这个视频配字幕的想法。

2019/12/15
articleCard.readMore

Running Command Asynchronously inside Neovim

Introduction # When I am writing some prototyping code inside Neovim, I want to run the script without going to the terminal and typing python toy_script.py. Of course, we can use :!python % in the command line to run the script (see :h :!). The problem is that running external command will block Nvim/Vim, and we can not move the cursor until the script finishes running.

2019/12/9
articleCard.readMore

Resolving Merge Conflict after Git Stash Pop

Sometimes, when we are working with our local changes in a Git repo, we may want to pull the latest updates from the remote repository. To avoid code conflict between remote files and local files. We can use git stash to store the unfinished local work temporarily.

2019/12/3
articleCard.readMore

Pylint: command not found?

The system I am currently using has Anaconda pre-installed by root under system locations.

2019/11/28
articleCard.readMore

A Hands-on Experience with Neovim's Built-in LSP Support

update log 2021-07-15: use pylsp instead of pyls since pyls is obsolete. 2021-04-08: update post based on latest version of Neovim-lsp. 2020-09-14: update lsp config to reflect the latest changes and add more plugins. Just a few days ago, the built-in Language Server Protocol support has been merged into Neovim master. This post is a hands-on experience of setting up LSP support for Python with the python-lsp-server. Note that settings here may be obsolete due to rapid evolving of the built-in lsp.

2019/11/20
articleCard.readMore

How to Convert PDF to Images with Imagemagick

Previously, I have talked about how to convert PDF to images using pdftoppm here. In this post, I want to share how to accomplish this task with Imagemagick.

2019/11/20
articleCard.readMore

互联网上常用缩略语集锦

上 Reddit 或 GitHub 时,在讨论中,经常会碰到一些缩略词,作为一名非 native speaker,我经常有点摸不着头脑,不知道这些缩略语啥意思。这篇文章总结一些常用缩略语以及中文含义。

2019/11/18
articleCard.readMore

File Backup in Neovim

There are several options related to file backup behavior in Vim/Nvim. backup writebackup backupdir backupcopy backupext In this post, I will explain how these options are related to each other.

2019/11/16
articleCard.readMore

Converting PDF Pages to Images with Poppler

In this post, I want to share how to convert PDF to images using the command line tool pdftoppm.

2019/11/14
articleCard.readMore

Nifty Nvim Techniques That Make My Life Easier -- Series 5

This is the 5th post of my post series on nifty Nvim/Vim techniques that will make my editing experience easier. Click here to check other posts in this series. Series 11: https://jdhao.github.io/2021/11/22/nifty_nvim_techniques_s11/ Series 10: https://jdhao.github.io/2021/06/17/nifty_nvim_techniques_s10/ Series 9: https://jdhao.github.io/2021/01/07/nifty_nvim_techniques_s9/ Series 8: https://jdhao.github.io/2020/11/11/nifty_nvim_techniques_s8/ Series 7: https://jdhao.github.io/2020/09/22/nifty_nvim_techniques_s7/ Series 6: https://jdhao.github.io/2019/12/21/nifty_nvim_techniques_s6/ Series 4: https://jdhao.github.io/2019/09/17/nifty_nvim_techniques_s4/ Series 3: https://jdhao.github.io/2019/05/14/nifty_nvim_techniques_s3/ Series 2: https://jdhao.github.io/2019/04/17/nifty_nvim_techniques_s2/ Series 1: https://jdhao.github.io/2019/03/28/nifty_nvim_techniques_s1/

2019/11/11
articleCard.readMore

Neovim Configuration for System-wide Use

I have been using Neovim for personal projects for over a year. Recently, I want to set up Neovim system wide so that other users in the server can also use my config if they want. In this post, I will summarize the necessary configurations.

2019/11/10
articleCard.readMore

How to sort a list of tuple or list in Python -- lambda or itemgetter?

In Python, when we want to sort a list of tuples or lists, we may want to sort it based on certain element in each sub-list, for example, sort the list based on the first element in each sub-list.

2019/11/6
articleCard.readMore

Building A Vim Statusline from Scratch

I have been using vim-airline to customize my statusline ever since I started using Neovim. It works great. Recently, I started a repo named minimal_vim to create a minimal configuration without external plugins for both Vim and Neovim. During the process, I learned how to build a custom statusline from scratch.

2019/11/3
articleCard.readMore

人类第一颗原子弹爆炸始末

花了差不多两个月时间,于上周看完了《The making of the atomic bomb》(中文名叫《原子弹秘史》),这本书是 1988 年美国普利策非虚构类最佳图书奖获奖作品。整本书很长,上百万字,作者在书中全景式展现了人类第一颗原子弹爆炸的完整历史,把原子物理学、核物理发现,犹太人的历史,原子弹的制造,还有科学家的成长历程,融为一体讲述,考证详实,虽然有大量的历史细节,读起来却很过瘾,一点也不枯燥。

2019/11/2
articleCard.readMore

Distributed Training in PyTorch with Horovod

Horovod is the distributed training framework developed by Uber. It support training distributed programs with little modification for both TensorFlow, PyTorch, MXNet and keras.

2019/11/1
articleCard.readMore

Learning Expect Programming

In my previous post, I talked about how to automate the server login process with the help of Expect programming language. This post continues my learning process.

2019/10/29
articleCard.readMore

Essential Knowledge about SSH

Although I use SSH (secure shell) every day, I seem to know little about it except the fact that I can use ssh command to log into my remote servers. Recently, I found myself some time to learn how does it work.

2019/10/27
articleCard.readMore

Nifty LaTeX Techniques -- Series 1

Change font size # By default, LaTeX provides several command to change the font size to predefined size. Those command include \scriptsize, \large, \Huge etc. However, even the font size provided by the \Huge command may not be large enough.

2019/10/22
articleCard.readMore

更改 Adsense 邮寄地址,重新寄送 PIN

之前的文章提到过,当 Adsense 帐号的收入达到 10 美元阈值的时候,谷歌会向你注册 Adsense 登记的地址发送一封邮件,里面有验证的 PIN 码,只有验证了 PIN 码,后续才能收到谷歌的付款。

2019/10/22
articleCard.readMore

Mintty Tips and Configurations

In this post, I want to share some useful tips and configurations about mintty.

2019/10/16
articleCard.readMore

Generating Table of Contents for Markdown with Tagbar

I have been using Vim plugin Tagbar for viewing and navigating tags inside my source file. However, for Markdown files, there is no support out of the box. In this post, I would like to share how to set up tagbar to show tags for Markdown.

2019/10/15
articleCard.readMore

Convert Python Script to Exe on Windows with Pyinstaller

Introduction # I have a use case where I want to convert my Python script to standalone executable so that I do not need to type python before it to run the script. On Linux, it is easy to achieve with the help of shebang. However, on Windows, it does not work. Then I thought I might convert the script to Windows executable.

2019/10/14
articleCard.readMore

Ubuntu on Windows Missing after Windows Update

I have been using Ubuntu on Windows via WSL for about a year and it works quite well. The terminal I use for Ubuntu on Windows is wsltty, which is a thin wrapper around mintty and other tools for starting WSL sessions. Recently, when I start clicking the WSL Terminal icon, it start a Window and then quit silently.

2019/10/11
articleCard.readMore

使用代理加速 Mac 终端下载速度

在 Mac 的终端 (terminal) 下载文件或者 clone git 仓库的时候,明显感觉速度特别慢,即使把梯子的全局模式打开也无济于事,需要在终端设置代理才能加快下载速度,本文简要总结需要的配置。

2019/10/10
articleCard.readMore

My Experience with Several Zsh Plugin Managers

In this post, I share my experience and opinions on several popular Zsh plugin managers.

2019/10/8
articleCard.readMore

深圳租房小记

作为深漂,大概每个人都要为租房费一番功夫。

2019/10/2
articleCard.readMore

How to Install zplug inside Docker Container

In the past few days, I tried to dockerize my development environment and put my daily programming tools inside container. I tried to install zplug inside docker container and met some issues. In this post, I want to share how to install zplug and other plugins inside the Docker container.

2019/10/1
articleCard.readMore

Why don't settings inside bashrc or bash_profile take effect?

In this post, I would like to share causes and solutions to a few issues related to login shell.

2019/9/29
articleCard.readMore

Setting Up Locale in Linux

Introduction # When I logged into a Ubuntu server, the system interface and messages are all shown in Chinese. I want them to be displayed in English. After some searching, I found out that we can change the locale settings.

2019/9/27
articleCard.readMore

谷歌 Adsense 申请及在 Hugo 中的配置

我的博客目前利用 GitHub pages 服务托管,不需要付费,但是博客的图床选用了腾讯云的对象存储,每个月还需要付一笔流量费用。为了保持收支平衡,也为了好玩,决定申请谷歌的 Adsense 一试。本文记录申请 Adsense 以及在 Hugo 博客中配置 Adsense 的过程。

2019/9/22
articleCard.readMore

How to Write Algorithm Pseudo Code in LaTeX

In this post, I want to summarize what I have learned about creating algorithmic pseudo code in LaTeX.

2019/9/21
articleCard.readMore

Nifty Nvim Techniques That Make My Life Easier -- Series 4

This is the 4th post of my post series on nifty Nvim/Vim techniques that will make my editing experience easier. Click here to check other posts in this series. Series 11: https://jdhao.github.io/2021/11/22/nifty_nvim_techniques_s11/ Series 10: https://jdhao.github.io/2021/06/17/nifty_nvim_techniques_s10/ Series 9: https://jdhao.github.io/2021/01/07/nifty_nvim_techniques_s9/ Series 8: https://jdhao.github.io/2020/11/11/nifty_nvim_techniques_s8/ Series 7: https://jdhao.github.io/2020/09/22/nifty_nvim_techniques_s7/ Series 6: https://jdhao.github.io/2019/12/21/nifty_nvim_techniques_s6/ Series 5: https://jdhao.github.io/2019/11/11/nifty_nvim_techniques_s5/ Series 3: https://jdhao.github.io/2019/05/14/nifty_nvim_techniques_s3/ Series 2: https://jdhao.github.io/2019/04/17/nifty_nvim_techniques_s2/ Series 1: https://jdhao.github.io/2019/03/28/nifty_nvim_techniques_s1/

2019/9/17
articleCard.readMore

A Few Grammar Questions in Writing

A few grammar-related questions in writing scientific papers.

2019/9/17
articleCard.readMore

How to Read and Write Images with Unicode Paths in OpenCV

The other day, when I was using OpenCV to read some images and print the image shape, I got an error: ‘NoneType’ object has no attribute ‘shape’. I was confused and do not know why since the image path is valid. It tooks me a while to understand the cause.

2019/9/11
articleCard.readMore

Tips on Writing Papers in LaTeX

In this post, I want to share some tips on writing papers using $\LaTeX$.

2019/8/28
articleCard.readMore

Creating A Professional Table in LaTeX with booktabs

The default table style provided by LaTeX is not good-looking and professional. In this post, I would like to talk about how to create professional table with the help of booktabs package. We will create the table shown in the title image.

2019/8/27
articleCard.readMore

How to Create Proper Folding for Vim/Nvim Configuration

<p> <figure> <img class="my-0 rounded-md" loading="lazy" alt="Folded config" src="https://blog-resource-1257868508.file.myqcloud.com/20190817223054.png" /> </figure> </p>

2019/8/16
articleCard.readMore

Linux Tips and Tricks -- s1

In this post, I list some of the often-used Linux command in my daily life.

2019/8/9
articleCard.readMore

JPEG Image Orientation and Exif

The other day I came across a strange bug during work. My colleagues gave me some photographs taken with a smartphone. On their machines (Windows 7), all the photos were shown correctly in landscape mode. However, when I checked those photos, I found that some of those photos were shown in portrait mode (rotated 90 or 270 degrees) or upside-down (rotated 180 degrees). I was curious what happened and learned about Exif and all its related stuff.

2019/7/31
articleCard.readMore

How Do I Show the Current File Path In Neovim?

I saw on StackExchange that someone asked about how to see the full path of current file in Vim. I think it would be helpful to write about how I do it.

2019/7/31
articleCard.readMore

JPEG Image Quality in PIL

Introduction # The other day, I was haunted by a bug and found that it was an issue with the image quality saved by Pillow after spending a few hours debugging the code.

2019/7/20
articleCard.readMore

Difference between view, reshape, transpose and permute in PyTorch

PyTorch provides a lot of methods for the Tensor type. Some of these methods may be confusing for new users. Here, I would like to talk about view() vs reshape(), transpose() vs permute().

2019/7/10
articleCard.readMore

Convert PIL or OpenCV Image to Bytes without Saving to Disk

Introduction # Sometimes, we may want an in-memory jpg or png image that is represented as binary data. But often, what we have got is image in OpenCV (Numpy ndarray) or PIL Image format. In this post, I will share how to convert Numpy image or PIL Image object to binary data without saving the underlying image to disk.

2019/7/6
articleCard.readMore

Fast Movement and Navigation Inside Vim or Neovim

Introduction # One key spirit of Vim is to accomplish something in as fewer key strokes as possible. When we repeat a command several times to perform an action, we need to ask ourselves if there is a better way to do it. Only in this way, can we make progress in mastering Vim. For example, to delete five lines of texts, if we press dd five times, we are certainly doing it the wrong way. After looking up the Vim manual, we know that we can use 5dd or d4j: only three keystrokes are needed instead of ten!

2019/6/26
articleCard.readMore

Unintuitive Behaviour of Case Sensitivity in Python glob

tl;dr: glob.glob() is case sensitive in Linux, but case insensitive in Windows. Recently, I was bitten by the unintuitive behaviour of glob.glob(). I think it would be beneficial to write down what I have found.

2019/6/24
articleCard.readMore

Binding Keys in Zsh

In this post, I want to share how to use bindkeys command to solve a few issues when using Zsh.

2019/6/13
articleCard.readMore

几把机械键盘试用体验

6.18 快到了,加上在家里使用的 IKBC C87 青轴声音太大,敲击费力,所以动了换一把更加静音,触发力度更小的键盘的心思。在京东和淘宝上入手了多款键盘试用,不得不说,一把好的键盘真的是难选啊。自从去年双十一入手了一把 Leopold 红轴键盘以后,其他的键盘真的很难入我的眼睛了。试用过的几把键盘以及感受如下:

2019/6/10
articleCard.readMore

Nvim Autocompletion with Deoplete

Note: this post is deprecated, I use nvim-cmp for auto-completion now. Deoplete is a good auto-completion plugin for Neovim. In this post, I introduce how to set up auto-completion for Nvim with the help of deoplete.

2019/6/6
articleCard.readMore

Converting Markdown to Beautiful PDF with Pandoc

update log 2022-07-19: Add build method via neovim 本文的中文版本参见 这里。 Over the past few years, I have been using some dedicated note-taking software to manage my notes. However, all these tools I have tried are unsatisfactory: they are either slow or cumbersome in terms of note searching. Finally, I decided to take my notes in Markdown and convert them to PDF using Pandoc for reading. In this post, I will summarize how I do it.

2019/5/30
articleCard.readMore

Exclusive and Inclusive Motion in Neovim/Vim

Introduction # Suppose that we have the following text in normal mode (cursor is indicated by ^): hello world ^ If we use dw, we delete hello<Space>1 and only world is left; if we use de, hello is deleted and <Space>world is left. Have you ever wondered about why dw do not delete w while de will delete the o in hello? It seems that motion e and w are somewhat inconsistent in their behaviours. It turns out that it has something to do with the exclusivity of motions in Vim.

2019/5/18
articleCard.readMore

Nifty Nvim Techniques Which Make My Life Easier -- Series 3

This is the 3rd post of my post series on nifty Nvim/Vim techniques that will make my editing experience easier. Click here to check other posts in this series. Series 11: https://jdhao.github.io/2021/11/22/nifty_nvim_techniques_s11/ Series 10: https://jdhao.github.io/2021/06/17/nifty_nvim_techniques_s10/ Series 9: https://jdhao.github.io/2021/01/07/nifty_nvim_techniques_s9/ Series 8: https://jdhao.github.io/2020/11/11/nifty_nvim_techniques_s8/ Series 7: https://jdhao.github.io/2020/09/22/nifty_nvim_techniques_s7/ Series 6: https://jdhao.github.io/2019/12/21/nifty_nvim_techniques_s6/ Series 5: https://jdhao.github.io/2019/11/11/nifty_nvim_techniques_s5/ Series 4: https://jdhao.github.io/2019/09/17/nifty_nvim_techniques_s4/ Series 2: https://jdhao.github.io/2019/04/17/nifty_nvim_techniques_s2/ Series 1: https://jdhao.github.io/2019/03/28/nifty_nvim_techniques_s1/

2019/5/14
articleCard.readMore

Why Doesn't Jedi Autocompletion Work for Some Methods

Currently I am writing all my Python code using Neovim and a couple of plugins to provide auto-completion, linting, etc.

2019/5/13
articleCard.readMore

Vim-like Editing inside Browser

Vim/Nvim has powerful ability in editing texts. But if you are in a browser and want to input some text, can we somehow utilize the editing power of Vim? In this post, I would like to share several ways to use Vim or Vim-like editing when you are working inside a browser.

2019/5/11
articleCard.readMore

Markdown 生成 HTML 时汉字之间出现多余空格问题

在过去很长一段时间,我都在使用 Sublime Text 来编辑 Markdown 文件,Sublime Text有一个非常实用的功能,可以设定 wrap_width 和 word_wrap 选项,自动在设定的 80个字符长度处 softwrap 文本。所以即使一个段落写成一行,编辑起来或者看起来都不违和。

2019/5/4
articleCard.readMore

小米 9 安装谷歌商店(Google Play Store)与相关配置

五一假期入手了小米9,在安装谷歌 Play 商店以及启用过程中遇到了一些问题,特此记录解决方法。

2019/5/4
articleCard.readMore

Create Mappings That Take A Count in Neovim

Many normal mode commands accept a count, which means to repeat the motion count times. For example, 3j moves the cursor 3 lines below the current line and 4w will move the cursor four words forward. Usually, the user-defined mappings can not take a count. Even if they can, they will most probably not work the way you expect them to. In this post, I will describe what I have learned to make a fairly complex mapping repeatable with a count.

2019/4/29
articleCard.readMore

Spell Checking in Nvim

Update log 2021-10-17: add spellsuggest option. In this post, I want to talk about how to enable the built-in spell checking feature in Nvim.

2019/4/29
articleCard.readMore

English Words Completion inside Neovim/Vim

Some words are hard to type, it is handy if Neovim can provide auto-completion for the words we are typing. We can achieve word completion in Neovim in two ways.

2019/4/26
articleCard.readMore

How to Use Python Inside Vim Script with Neovim

Introduction # I have been using Vim-airline for a while to customize my statusline. We can change the theme used for statusline with the many themes available in vim-airline-themes. Not all these themes looks good since it depends on the background color you use for Neovim and certainly your aesthetics.

2019/4/22
articleCard.readMore

Nifty Little Nvim Techniques to Make My Life Easier -- Series 2

This is the 2nd post of my post series on nifty Nvim/Vim techniques that will make my editing experience easier. Click here to check other posts in this series. Series 11: https://jdhao.github.io/2021/11/22/nifty_nvim_techniques_s11/ Series 10: https://jdhao.github.io/2021/06/17/nifty_nvim_techniques_s10/ Series 9: https://jdhao.github.io/2021/01/07/nifty_nvim_techniques_s9/ Series 8: https://jdhao.github.io/2020/11/11/nifty_nvim_techniques_s8/ Series 7: https://jdhao.github.io/2020/09/22/nifty_nvim_techniques_s7/ Series 6: https://jdhao.github.io/2019/12/21/nifty_nvim_techniques_s6/ Series 5: https://jdhao.github.io/2019/11/11/nifty_nvim_techniques_s5/ Series 4: https://jdhao.github.io/2019/09/17/nifty_nvim_techniques_s4/ Series 3: https://jdhao.github.io/2019/05/14/nifty_nvim_techniques_s3/ Series 1: https://jdhao.github.io/2019/03/28/nifty_nvim_techniques_s1/

2019/4/17
articleCard.readMore

Setting up Ultisnips for Neovim

If you have used Sublime Text before, you may be familiar with its snippet feature. Snippets let us type a trigger word and expand it to some boilerplate code or texts that we do not want to repeat typing. We will increase our efficiency dramatically with the help of snippets.

2019/4/17
articleCard.readMore

Mac 上罗技 M590 鼠标设置

本文简单总结 Macbook Pro 上罗技 M590 鼠标的设置。

2019/4/2
articleCard.readMore

Nifty Little Nvim Techniques to Make My Life Easier -- Series 1

This is the 1st post of a series posts on nifty techniques that make my editing experience in Neovim smoother. Click here to check other posts in this series. Series 11: https://jdhao.github.io/2021/11/22/nifty_nvim_techniques_s11/ Series 10: https://jdhao.github.io/2021/06/17/nifty_nvim_techniques_s10/ Series 9: https://jdhao.github.io/2021/01/07/nifty_nvim_techniques_s9/ Series 8: https://jdhao.github.io/2020/11/11/nifty_nvim_techniques_s8/ Series 7: https://jdhao.github.io/2020/09/22/nifty_nvim_techniques_s7/ Series 6: https://jdhao.github.io/2019/12/21/nifty_nvim_techniques_s6/ Series 5: https://jdhao.github.io/2019/11/11/nifty_nvim_techniques_s5/ Series 4: https://jdhao.github.io/2019/09/17/nifty_nvim_techniques_s4/ Series 3: https://jdhao.github.io/2019/05/14/nifty_nvim_techniques_s3/ Series 2: https://jdhao.github.io/2019/04/17/nifty_nvim_techniques_s2/

2019/3/28
articleCard.readMore

A Complete Guide on Writing LaTeX with Vimtex in Neovim

Update log 2021-02-20: Add inverse search settings on Windows and macOS Previously, I have written a post on how to write and compile LaTeX source code in Sublime Text. Now that I am familiar with Neovim, I want to do everything related to text editing inside Neovim. In this post, I would like to share how to configure Neovim for LaTeX editing and previewing. My complete config for vimtex can be found here (search vimtex) on my nvim-config repo .

2019/3/26
articleCard.readMore

Manipulating Images with Alpha Channels in Pillow

In image processing, alpha channel is usually used to control the transparency of an image. In itself, the alpha channel is just a gray level image1. In this post, I want to talk about how to add an alpha channel to RGB image and show it using the Pillow package.

2019/3/7
articleCard.readMore

Sublime Text Regular Expression Cheat Sheet

A cheat sheet about regular expressions used in Sublime Text.

2019/2/28
articleCard.readMore

Cropping Rotated Rectangles from Image with OpenCV

In computer vision tasks, we need to crop a rotated rectangle from the original image sometimes, for example, to crop a rotated text box. In this post, I would like to introduce how to do this in OpenCV.

2019/2/23
articleCard.readMore

Boosting Your Productivity on Terminal with Zsh and Plugins

In my previous post, I have introduced how to build Zsh from source and install oh-my-zsh to enhance your terminal experience. In this post, I’d like to show you how to manage plugins with zplug and a few more plugins to boost your productivity.

2019/2/19
articleCard.readMore

最新版 Rime 输入法使用 (2022 更新)

更新日志 2022-11-06: 更新基本概念,以及一些不清楚的地方。 之前一直听说过 Rime 这个神级输入法的大名,一直迟迟没有试用,一方面现有的各种输入法用着可以,另外,对于 Rime 没有 GUI 界面的配置感觉发怵。之前一直使用的是 QQ 输入法,最近一次升级,造成 Chrome 浏览器频频崩溃,是可忍孰不可忍,正好趁此机会卸载 QQ 输入法,试试 Rime 了。关于 Rime 的配置,网上能够找到的资料实在是过于丰富,为了使文章不过于冗长,一些简单的设置我将不再重复。 值得注意,Rime 的官方文档并不是很详细,所以网上的很多配置不一定是正确的,注意自己分辨和试验。

2019/2/18
articleCard.readMore

Display Image with Pillow inside Ubuntu on Windows

With the help of Windows Subsystem for Linux (WSL, for short)1, we can use the nearly full Linux environment on Windows system. In this post, I would like to share how to display images inside Ubuntu on Windows, which is one of the popular distrubtions.

2019/2/16
articleCard.readMore

Faster Directory Navigation with z.lua

If you work with terminals extensively, you may be tired of typing cd to go to directories, especially when directory names are very long. z.lua is such a tool to make your life easier by jumping to the desired directory smartly.

2019/2/14
articleCard.readMore

Cmder Advanced Configurations

In this post, I summarize some of the advanced configurations of Cmder.

2019/2/3
articleCard.readMore

Nvim-qt Settings on Windows 10

To run Neovim on Windows, you can either use the terminal Neovim or use a GUI for Neovim. If you use terminal Nvim, you may encounter various annoying issues. Based on my experience, I recommend you using a GUI client for Nvim instead of the terminal one.

2019/1/17
articleCard.readMore

Tmux Plugin Install and Management

In this post, I want to share how to manage tmux plugins with Tmux plugin manager (i.e., tpm) and also mention a few useful plugins.

2019/1/17
articleCard.readMore

How to Debug Python Code in Terminal

<p align="center"> <img src="https://blog-resource-1257868508.file.myqcloud.com/20190116225245.jpg" width="600"> </p>

2019/1/16
articleCard.readMore

Markdown Writing and Previewing in Neovim -- A Complete Guide

<p align="center"> <img src="https://blog-resource-1257868508.file.myqcloud.com/20200214144759.png" width="600"> </p>

2019/1/15
articleCard.readMore

Line Number Settings for More Efficient Movement in Neovim

In this post, I would like to share line number settings in Neovim to move the cursor more efficiently.

2019/1/11
articleCard.readMore

两个大规模中文语料库介绍以及处理

目前进行的工作需要大规模的语料库来生成中文文本图像,因此查找资料,找了一些中文语料库。本文介绍其中的两个最大的语料库,THUCNews 语料库和中文维基百科语料库,以及如何对原始语料库文件进行简单预处理。

2019/1/10
articleCard.readMore

Windows 系统下几款程序员不可不用的神器

工欲善其事,必先利其器,好的工具能使人效率倍增,这篇博客介绍本人常用的一些提升效率的工具,希望能够帮到读者。

2019/1/7
articleCard.readMore

我的 2018 阅读清单

2018 年对于我来说,是变化很大的一年,我很高兴自己能够下定决心做一些决定。这一年读书的数量并不多,因为有几部比较大部头,读完花费了相当多的时间。年初寒假的时候,买了最新款的 Kindle Oasis2,替换了几年前买的 Kindle Paper White1。最值得高兴的事情是现在可以完全无压力阅读英文原版书籍,没有阅读的障碍。

2018/12/25
articleCard.readMore

A Complete Guide to Neovim Configuration for Python Development

Change log 2022-01-29: Add deprecation notice 2021-01-17: Install nvim via tar ball instead of appimage 2020-12-01: Add detailed guide on installing Neovim on Linux TL;DR: My complete nvim configuration is here. Follow the guide there on how to use it. Most of the config below also applies to Windows and Mac. For how to configure Neovim on Windows, you may also be interested in this post. 2022-01-29: Note that this post is written more than three years ago. Some of the plugins mentioned here may not be maintained or may not be the best fit for Neovim, or even not needed, e.g., highlighted yank is builtin in Neovim since May 2020. I have shared some of the plugin changes in this post.

2018/12/24
articleCard.readMore

How Is Newline Handled in Python and Various Editors?

Every programmer knows newline character, but may be not so familiar. In this post, I want to share what I have learned about newline handling in various cases.

2018/12/8
articleCard.readMore

Two Issues Related to ImageFont Module in PIL

In this post, I want to write about two issues related to the ImageFont module in the PIL package.

2018/12/4
articleCard.readMore

在 Listary 中调用 GoldenDict 或欧路词典查单词

GoldenDict 是一款开源字典应用,功能强大,支持多种字典格式,同时也支持网络资源。欧路词典 是一款国产的查词软件,产品做得也很不错,同样支持多种字典格式。本文介绍 GoldenDict 以及欧路词典的配置, 以及如何在Listary 中调用它们实现查词功能。

2018/12/4
articleCard.readMore

Reading and Writing Text Files on Windows

If you are using Python 3 on Windows, you may have seen a Unicode decoding error when opening files in UTF-8 format: UnicodeDecodeError: ‘gbk’ codec can’t decode byte 0xaf in position 5: illegal multibyte sequence If you read the same file on Linux or macOS, you will find that this file can be opened without any error. Why is there a difference? It has something to do with the default encoding Python chooses to use on different platforms.

2018/12/3
articleCard.readMore

The Mathematics behind Font Shapes --- Bézier Curves and More

<p align="center"> <img src="https://blog-resource-1257868508.file.myqcloud.com/20200223203853.png"> </p>

2018/11/27
articleCard.readMore

快速识别图片字体:字体识别工具介绍

在日常工作中,有时候,我们可能需要知道图片中的文字用的是哪种字体,本文介绍几种在线字体识别工具(从图片识别所用的字体),并且给出一些提高字体识别准确率的方法。

2018/11/22
articleCard.readMore

Deoplete Failed to Load at Startup after Updating Python neovim Package

Today when I use :checkhealth to check if there are anything wrong with my Neovim and related packages. I got an info that Python neovim package is not up to date. So I tried to update neovim with pip install --upgrade neovim. This is the start of a disaster which wastes me several hours.

2018/11/19
articleCard.readMore

What Is The Difference between pip, pip3 and pip3.6 Shipped with Anaconda3?

On Windows system, if you install Python3 via Anaconda. Under Anaconda root directory, there is a directory named Scripts, in which pip.exe, pip3.exe and pip3.6.exe all exist. When we want to install a package, a natural question arises, is there any difference if I use pip install PACKAGE or pip3 install PACKAGE?

2018/11/19
articleCard.readMore

Windows 10 系统下 Neovim 安装与配置

本篇文章介绍如何在 Windows 系统下安装并配置终端上的 Neovim。关于如何配置 Neovim 的 GUI 客户端 nvim-qt,可以参考 这篇博客。

2018/11/16
articleCard.readMore

How to Use shutil.move() on Windows and Linux

Today when I try to move a file using shutil.move() on my Windows machine, I encounter an error message: PermissionError: [WinError 32] The process cannot access the file because it is being used by another process In this post, I will write about what I have learned from this error.

2018/11/15
articleCard.readMore

Neovim configuration on Windows 10

update: 2020-11-15, add detailed instruction for Neovim config location. TL;DR: After nearly one year of using Neovim on Windows, I find that the best experience one can get on Windows is to use GUI Neovim client such as Nvim-qt or fvim, not the terminal Nvim1. In this post, I want to share how to install and configure Neovim on Windows 102. For configurations of nvim-qt on Windows, check this post.

2018/11/15
articleCard.readMore

Commonly-used Building Options Explained

On Linux system, if we do not have root priviledge, we can not use package managers to install a package to its default location (usually under /usr). Besides, the packages installed by the package managers are often too old to have the latest features. Or, even if we have root priviledge, we do not want to mess up with the system-wide packages and just want to experiment with a package locally. On these ocassions, we may want to install the package to a custom location.

2018/11/7
articleCard.readMore

Fzf Installation and Usage

<script id="asciicast-218493" src="https://asciinema.org/a/218493.js" async></script>

2018/11/5
articleCard.readMore

Execellent Development Experience with Cygwin and Mintty Terminal on Windows 10

Linux is great for programming compared to Windows. If you miss the experience you get on Linux, maybe you should try Cygwin, which set up a Linux-like environment on Windows platform. In this post, I want to talk about how to configure Cygwin and how to use mintty terminal on Windows 10 to get excellent programming experience.

2018/10/23
articleCard.readMore

Tmux Questions and Trouble Shootings

In this post, I will summarize a list of questions related to Tmux during the process of learning how to use it.

2018/10/23
articleCard.readMore

File Sharing between Android and Mac Wirelessly without Pain

If you connect your Android device to a Macbook, you will notice that your phone is not recognized. Unlike Windows, Apple’s Mac is not so friendly to Android devices. Of course, you can install Android File Transfer provided by Google and connect your phone to Mac. But it is kinda cumbersome and does work so well. In this post, I want to share several ways to transfer files between Android and Mac wirelessly.

2018/10/21
articleCard.readMore

博客图床从七牛云存储迁移到腾讯云存储

去年建立博客的时候,选择了七牛对象存储来存放博客的图片,最近收到了七牛的邮件,之前一直在用的域名只是一个测试域名,再过一阵就要回收了,到时必须使用自己的域名。大概看了一下,申请自己的域名还要涉及注册和备案,我仅仅是需要存储图片,这样太费周章,所以决定把博客的图片从七牛迁移出来。

2018/10/20
articleCard.readMore

Setting up True Color Support for Neovim and Tmux on Mac

Update log 2021-11-23: update tmux and nvim version to the latest and fix other issues. In this post, I want to share how to set up true color support in Tmux, Nvim and the shell to make them work nicely together.

2018/10/19
articleCard.readMore

An Introduction to Lookaround Regular Expression in Neovim/Vim

Today I want to use some regular expressions for searching and replacing in my files. But I found that Nvim/Vim regular expression engine has its own flavor, which is different from the regex engine used by Sublime Text1. I ended up learning some of the basics of Nvim-style regex. In this post, I want to share about how to use lookaround2 in Nvim.

2018/10/18
articleCard.readMore

Building and Install Tmux from Source on Linux

Tmux is a great terminal multiplexer. Tmux installed via the package manager is often too old. So I decided to install the latest version of Tmux that supports true colors from source. Since I do not have root privilege on the system, I have to build Tmux and install it under my HOME. If that is also what you want, keep reading.

2018/10/16
articleCard.readMore

Building Zsh from Source and Configuring It on CentOS

Update: this is my first post on Zsh install and configuration. For a list of useful plugins I use to boost my productivity, see this post. Zsh is a powerful shell with better auto-completion and richer features. There are also various plugins to enrich your experience of using Zsh. In this post, I will give a brief summary on how to install and set up zsh.

2018/10/13
articleCard.readMore

Mechanical Keyboard Set up For Mac

Recently I bought a MacBook Pro 2018. While it is a good design overall, its built-in keyboard is not so great AFAIK. So I bought a mechanical keyboard ikbc c87. The mechanical keyboard is designed for the Windows operating systems. I have to make a few tweaks to make my typing experience smooth.

2018/10/13
articleCard.readMore

A Simple Guide on How to Use the Python Logging Module

In the past, I use plain print() to display some statistics during training process of my models. However, it is not convenient to save the statistics in a file for later inspection. Once the program is finished, we do not have an overview of the training process. I am aware that there are packages such as tensorboardX and visdom, which are specifically designed for inspecting the various statistics during training. Right now, I would rather keep the program plain simple and usable. So I decided to give Python logging package a try.

2018/10/12
articleCard.readMore

Set up the Default Value for Boolean Option in Argparse

TL;DR If you want to set a parameter’s default value to True using argparse, use parser.add_argument('--param', action='store_false') Otherwise, use parser.add_argument('--param', action='store_true')

2018/10/11
articleCard.readMore

把博客从 Hexo 迁移到 Hugo

这个博客于 2017 年 2 月开始搭建运行,最初使用的是 Hexo 搭建,配合精美的 NexT 主题,经过鼓捣,差不多算是做出了让自己满意的博客。不过每次安装 Hexo,要配置的东西太多了,总觉得不是很简洁,另外,随着文章数量的增加,Hexo 生成博客的速度也慢了下来。怀着尝鲜的心态,我把 Hexo 博客迁移到了 Hugo。

2018/10/10
articleCard.readMore

Fixing the nerdtree Window Problem with `bd` Command in Nvim

If you have a nerdtree file navigation window on the left of the current buffer and use :bd1, you will find that the nerdtree window will occupy the whole window. When you open another buffer, you have to manually resize the nerdtree window to a smaller size, which is super annoying. How to prevent this behaviour?

2018/10/9
articleCard.readMore

Server Autologin with Expect

I use a Windows 10 machine and need to connect to Linux servers. After using several ssh clients for connecting to the server, I finally settled for Cygwin and Wsltty, which is open-sourced and use the well-known mintty terminal. But one feature I miss from the SSH tools such as MobaXterm or Xshell is that these tools can save the server IP, port, user name and even password, so that you can log into the server with just a click. With mintty terminal, I have to manually ssh to my server each time, which is tedious and time consuming. Fortunately, I have found the Expect scripting language which is pretty powerful for this task.

2018/10/8
articleCard.readMore

The Fastest Way to Search A Keyword across the Project in Neovim

When we want to find out where a method is used across the whole project, how do we do that in Nvim? Various tools are available, for example, ack, ag or rg. These are the 3 most popular tools to use. In the following post, I will introduce how to install and use these packages in Neovim (Nvim).

2018/10/7
articleCard.readMore

Vim-like Settings for Tmux

I am a Neovim (or Nvim in abbreviation) user. In Nvim, we use Ctrl-W as prefix for window-related operations. However, the default prefix is Ctrl-B in Tmux. As a result, I often mistakenly press Ctrl-W when trying to change panes inside Tmux, which is annoying. Why not change tmux prefix to be more vim-like?

2018/9/30
articleCard.readMore

How to Switch between Buffers Quickly in Neovim/Vim

When working on real projects using Neovim, we often open several files in a window. Each file corresponds to a buffer. How to switch between these buffers quickly?

2018/9/29
articleCard.readMore

How to Use Tagbar in Neovim

If you have a source file with hundreds or thousands of lines of code. How to you see its structure and go to some classes or methods quickly in Nvim? The solution is to use tagbar.

2018/9/28
articleCard.readMore

写给初学者的 Markdown 教程

这是一篇帮助初学者快速入门 Markdown 的文章,看完此篇,你应该就可以使用 Markdown 写出格式规范的文章了。

2018/9/21
articleCard.readMore

Use Pylint for Code Checking inside Neovim

Pylint is a popular static code checker which can effectively find the possible bugs in your source code. It is easy to install pylint with conda or pip:

2018/9/20
articleCard.readMore

Intro to Nvim File Explorer Plugin Nerdtree

Nerdtree is a file explorer for Vim/Neovim. It will generate a file navigation window just like an IDE. We can operate on files easily in the nerdtree window. In this post, I will summarize some of its configurations and usages.

2018/9/10
articleCard.readMore

为什么 .bash_profile 里面的设置不生效?

最近安装了 Neovim,并且在 HOME 目录下的 .bash_profile 中设置好了 Neovim 可执行程序对应的 PATH 变量。奇怪的是,每次在 SSH 客户端打开一个新的服务器连接 session,登录服务器,进入自己账号以后,位于 .bash_profile 中的 PATH 设置命令没有生效,导致我无法启动安装的 Neovim,每次登录以后,我还必须手动 source 一下 .bash_profile 文件,然后才能使用 nvim 命令,非常让人恼火。本文记录我排查问题的过程以及最终的解决方案。

2018/9/6
articleCard.readMore

Linux 下 Neovim 配置 Python 开发环境指南

我的完整 Neovim 配置可以点这里查看。 2022-01-29: 本文写于三年以前,其中提到的一些插件已经不再维护,或者对于 Neovim 不是最佳选择,甚至还有一些插件被 Nvim 自带的功能所替代,例如,从 2020.05 开始,highlighted yank 开始内置。我在 这篇博文 分享了一些插件迁移的事情。 Vim 是一款主要流行于 *nix 系统上的强大的编辑器,另外一款可以与之媲美的编辑器是 Emacs,这两款编辑器广泛流行于程序员群体,关于谁是编辑器之王的争论经久不息。Vim 的功能虽然强大,但是作为一款「古老」的编辑器1,也不是没有缺点:随着 Vim 代码量的增加,维护变得日益困难,不利于快速增加新功能;另外,它的主要开发者目前只有一个人,Bram Moolenaar,也不符合当今开源社区多人协作的习惯。为了克服 Vim 的这些缺点,保留 Vim 的优点(最大程度兼容 Vim),让 Vim 的开发能有更快的迭代速度,Neovim 项目诞生了。本文介绍如何安装 Neovim 并配置 Python 开发环境(在以下叙述中,Neovim 和 Nvim 含义相同,不再加以区分)2。

2018/9/5
articleCard.readMore

How to Replace A Page of PDF File with Another PDF

In this post, I want to write about how to replace one page of existing PDF files with a new PDF image.

2018/6/4
articleCard.readMore

How to Change Intersection Point of X and Y Axis in Matplotlib

In this post, I will share how to position the intersection of x and y axis at a specific point using Matplotlib. The spines # In order to re-position x and y axis, we need to understand an important concept in Matplotlib —spines. According to Matplotlib documentation: Spines are the lines connecting the axis tick marks and noting the boundaries of the data area. They can be placed at arbitrary positions. See function:set_position for more information.

2018/5/21
articleCard.readMore

利用母版视图在 PowerPoint 中制作个性化页脚页眉

本文简要总结一下如何在 PowerPoint 中使用母版视图制作个性化的页脚页眉1,先上效果图: 背景介绍 # 假如张三是哈佛(哈尔滨佛学院,简称「哈佛」)的一个学生,他要作一篇报告,题目为“论马克思主义在人工智能时代的指导作用”,除了 PPT 的首页之外,其余每张幻灯片(slide)页脚要标明作者,报告的题目,时间,以及当前幻灯片的编号和所有幻灯片的数目;在页眉部分,右边要有哈佛的一个标志。如何来实现上述要求?

2018/5/19
articleCard.readMore

How to Push Local Git Repo to Remote Repo in GitHub

There are two basic cases when we push our local repo to remote repo. These two cases differ in their settings. But sometimes, we are easily confused. First scenario # The first case is that you have created a local repo and want to store it on GitHub later. In this case, your usual work flow for local repo is:

2018/5/16
articleCard.readMore

How to Read and Write CSV Files in Python

update log 2022-09-30: change order of read and write section; other small fixes. In this post, I will share the most convenient way to read and write CSV files (with or w/o headers) in Python. Read CSV files # Use the builtin CSV module # Python has a built-in CSV module that deals with CSV files. CSV module provides a CSV reader, which we can use to read CSV files. The CSV reader is an iterable object. We can use the following snippet to read CSV files:

2018/5/13
articleCard.readMore

回忆汶川地震

今天是 5 月 12 日,对于 2008 年以后的中国人来说,这是一个特殊的日子:十年前的今天,四川省汶川县等区域发生了 8 级大地震,造成了重大的生命损失与伤痛。今天也来写一下我个人对地震的记忆与恐惧。

2018/5/12
articleCard.readMore

使用 Microsoft Word 撰写论文常见问题总结

本文总结一些使用 Microsoft Word 2016 撰写论文时遇到的一些问题以及解决办法。 Word 如何插入分节符? # 「分节符」是 Word 中一个非常重要概念,很多设置都会涉及到分节符。分节符,顾名思义,就是把文档从某处分节(节的英语为 section)的标志。常用的分节符类型有「下一页」(即从当前位置的下一页开始新的一节),「连续」(即从当前位置开始新的一节)。具体如何插入分节符见下图(以插入「下一页」分节符为例):

2018/5/10
articleCard.readMore

A Tutorial on Creating GitHub Pull Requests

Today I make my first ever GitHub pull request to the great Hexo theme NexT. I will summarize how to make a pull request in following post. Creating a fork # According to GitHub documentation: If you don’t have write access to the repository where you’d like to create a pull request, you must create a fork, or copy, of the repository first.

2018/5/6
articleCard.readMore

如何在新版 MX 播放器中加入对 AC-3 音频支持

最近在使用 1.9.19 版本的 MX 播放器播放视频的时候,提示不支持 E-AC-3 (全称为 Enhanced Audio Codec 3,是AC-3 的升级版)音频格式。稍微查了一下,原因是由于版权问题,新版的 MX 播放器默认不包含 AC-3 解码器,我们需要自己下载安装解码器。下面简单介绍如何加入对 AC-3 音频的支持。

2018/4/24
articleCard.readMore

读《众病之王:癌症传》有感

刚读完《众病之王:癌症传》(英文名字叫《The emperor of all maladies: a biography of cancer》),“意外”发现这本书是一本的融合科普与历史的精品图书。

2018/4/16
articleCard.readMore

How to Use Putty on Windows

Putty is a powerful and slim ssh tool with rich features. It is widely used to connect to the remote servers. I will summarize some of its settings and usages in this post.

2018/4/12
articleCard.readMore

How to Plot Unicode Characters with Matplotlib

This is a post which follows up my previous post on how to use Chinese characters with Matplotlib.

2018/4/8
articleCard.readMore

Set Default GPU in PyTorch

You can use two ways to set the GPU you want to use by default.

2018/4/2
articleCard.readMore

How to Use Chinese with LaTeX

The original LaTeX do not have good support for Chinese. With the development of LaTeX, we can now easily use Chinese in LaTeX document. In this post, I would like to introduce several ways to work with Chinese in LaTeX.

2018/3/29
articleCard.readMore

全面总结如何在 LaTeX 中使用中文 (2020 最新版)

LaTeX 最初对中文的支持并不友好,只支持 ASCII 字符,后来才逐渐变得好起来,加入了对 Unicode 字符的支持。本文总结一下几种在 LaTeX 中使用中文的方法,以期能够帮助读者快速使用 LaTeX 对中文内容进行排版。

2018/3/29
articleCard.readMore

A Complete Guide on Writing and Building C++ Programs in Sublime Text

In this post, I will show how to write and run simple C++ programs in Sublime Text 3.

2018/3/28
articleCard.readMore

使用 Endnote 为论文每个章节制作单独的参考文献列表

毕业季到了,如果使用 Word 来写毕业论文,论文写作中的参考文献处理也是一个非常重要的问题,在 Word 管理参考的比较好的方式是通过 Endnote。Endnote 是一个非常方便的可视化管理参考文献的工具,本文介绍如何使用 Endnote 结合 Microsoft Word 给每个章节分别设置参考文献列表。

2018/3/24
articleCard.readMore

Set up Sublime Text as Your Ultimate LaTeX Editor

There are a lot of front-end editors for writing LaTeX source, for example, Texmaker, TeXstudio, WinEdt. I have used TeXstudio for a while, but its user interface is a little dull. So I decided to give Sublime Text a shot. In this post, I want to share the configurations necessary to write and compile LaTeX source code and to preview the produced PDF files.

2018/3/10
articleCard.readMore

Set up X11 Forwarding with Git for Windows (git-bash)

As I have posted earlier, Cmder is a better option if you use Windows command line frequently. The full installation of Cmder comes with Git for Windows, which is handy to provide a Linux-like environment. In this post, I will write about how to use Git for Windows to connect to a remote CentOS server and set up X11 forwarding to use the GUI applications on that server.

2018/3/2
articleCard.readMore

Customize Favicon for Hexo Blog in Theme NexT

Favicons are used widely in websites. Since you come to this post purposefully, I assume that you have a basic understanding of what favicon is. With Hexo, we can easily customize the favicon of our blog site. In this post, I will describe how to set up a custom favicon in theme NexT.

2018/2/8
articleCard.readMore

如何从 PowerPoint 幻灯片导出没有多余白边的图像或者 PDF 文件

PowerPoint 是一个方便的绘图工具,可以完成一些简单的绘图工作,并且支持将 slide 导出为图片或者 PDF 格式,方便插入到其他文档中,但是默认导出的图片或者 PDF 文件 通常会有大量冗余的白边。如何设置,才能使得导出的文件中的白边尽可能少呢?本文将 给出一种办法。

2018/2/6
articleCard.readMore

把 Hexo 的评论系统切换为 gitment

好几个月前就知道有人用 GitHub 的 issue 功能为 Hexo 制作了一个评论系统 gitment,决定尝试一下 gitment 。

2018/2/1
articleCard.readMore

Character set, Encoding, Locale, Font and More...

It is almost destined that at some point of our programming years, we will meet the issue of character set, encoding and all the related stuff. There are tons of articles which explains the meaning of Unicode, UTF-8, UTF-16 etc. I am not going to repeat that here. In this post, I will write about what confused me when I tried to understand all this stuff.

2018/1/28
articleCard.readMore

LaTeX Equation Numbering Done Right in Hexo

Recently I plan to transplant one of my old post from other site to this new site (you can find the new post here). The old post contains quite a lot of equations in LaTeX format. With so much equations in one post, I find it really hard to refer to some equations without using proper numbering. So I decide to figure out how to use LaTeX equation numbering properly in my post.

2018/1/25
articleCard.readMore

How To Put Legend outside of Axes Properly in Matplotlib?

When we want to put legend somewhere in a figure using Matplotlib, most of the time, the option loc='best' will produce the desired results. However, sometimes, we may want to have finer control over where the legend should be in the image. For example, we may want to put the legend outside of the axes, which is impossible using loc='best'.

2018/1/23
articleCard.readMore

Working with Fonts in Matplotlib

This post continues my previous post on various tips and tricks collected during the process of using Matplotlib.

2018/1/18
articleCard.readMore

Cmder --- The Ultimate Command Line Tool for Windows

<p align="center"> <img src="https://blog-resource-1257868508.file.myqcloud.com/18-1-1/79824514.jpg" title="A glimpse of Cmder"> </p>

2017/12/29
articleCard.readMore

纯文本做笔记 --- 使用 Pandoc 把 Markdown 转为 PDF 文件

update log 2021-06-27: 补充标题如何生成的说明。 For English version of this post, click here. 本文主要写如何使用 Pandoc 从 Markdown 文件生成格式精美的 PDF 文件,也包含了一些遇到的问题的解决办法。

2017/12/10
articleCard.readMore

Matplotlib Plotting Notes -- Series 1

This post records my collected notes on various tricks in using Matplotlib.

2017/11/16
articleCard.readMore

Notes on PyTorch Tensor Data Types

In PyTorch, Tensor is the primary object that we deal with (Variable is just a thin wrapper class for Tensor). In this post, I will give a summary of pitfalls that we should avoid when using Tensors. Since FloatTensor and LongTensor are the most popular Tensor types in PyTorch, I will focus on these two data types.

2017/11/15
articleCard.readMore

Understanding Computational Graphs in PyTorch

PyTorch is a relatively new deep learning library which support dynamic computation graphs. It has gained a lot of attention after its official release in January. In this post, I want to share what I have learned about the computation graph in PyTorch. Without basic knowledge of computation graph, we can hardly understand what is actually happening under the hood when we are trying to train our landscape-changing neural networks.

2017/11/12
articleCard.readMore

How to Resize, Pad Image to Square Shape and Keep Its Aspect Ratio in Python

When we are using convolutional neural networks, most of the time, we need to fix the input image size to feed it to the network. The usual practice is to resize the input image to the given size (the image aspect ratio is no longer kept) and then crop a fixed size patch randomly from the resized image. This practice may work well for image classification where fine details may not be necessary. But for Image retrieval, we want to keep the image aspect ration unchanged. In this post, I will summarize ways to resize an image to square shape with padding and keep its aspect ratio.

2017/11/6
articleCard.readMore

Similarity Measurement in Image Retrieval

For image retrieval and other similarity-based tasks such as person re-identification, we need to compute the similarity (or distance) between the query image and database images. Then we can rank the database images based on their similarity to the query image. In this post, I want to briefly introduce two measures widely used in image retrieval tasks.

2017/10/24
articleCard.readMore

对 Stack Overflow 的爱与恨

一直以来,在搜索编程、技术相关的问题时,Stack Overflow 上的答案经常高居谷歌返回结果前列,这个网站上有一些质量很高的答案,能够真正解决我的疑问。大约一年以前,我正式注册了 Stack Overflow 的会员,也开始试着回答别人的提问。解答别人的问题也让我受益匪浅,但最近发生的一件事却让我对 Stack Overflow 有了更深的认识。

2017/10/24
articleCard.readMore

Writing Your Own Custom Dataset for Classification in PyTorch

In this post, I’d like to talk about how to create your own dataset, process it and make data batches ready to be fed into your neural networks, with the help of PyTorch.

2017/10/23
articleCard.readMore

Sublime Text Tips and Tricks That Will Make Your Life Easier

In this post I will share some tips on how to use Sublime Text on Windows. These tips are collected over time and will be updated frequently (hopefully).

2017/10/21
articleCard.readMore

几道算法问题解答

记录一下做的几道算法问题的解答。

2017/10/19
articleCard.readMore

Why Doesn't Visdom Work Fine on CentOS?

Today, I came across the open source project visdom and hope to use it in my future PyTorch project. I installed it on my Linux server and met with an issue that I have no way to deal with. I would like to share it in case someone also meet it.

2017/10/16
articleCard.readMore

What Is the Correct Way of Loop Through C++ Vector Using Index?

It might seem naive to ask how to loop through a C++ vector using index. However, it is not: even experienced programmer may write buggy code to loop through a vector.

2017/10/7
articleCard.readMore

Remainder Operator(%) in C++

What is value of a and b in the following statement according to the rules of C++ 11? int a = -5 % 2; int b = 5 % -2; If you can not clearly tell the result, then you should update your knowledge about % operator in C++.

2017/10/7
articleCard.readMore

Hexo 书写 LaTeX 公式时的一些问题及解决方法

在写作博文的时候,有时候需要输入一些数学公式,如果公式过长,我们通常希望把方程分成多行显示,在 LaTeX 中,我们可以使用 aligned 环境来书写多行公式,但是写出来的 Markdown 经过 Hexo 的处理以后显示不正确,原因何在?原来这与 Hexo 的渲染引擎有关系。

2017/10/6
articleCard.readMore

堆排序是如何工作的?

本文将介绍堆 (heap)的概念,进一步介绍如何把普通数组变成最大堆,并在此基础上进行堆排序。

2017/10/6
articleCard.readMore

When Does the Stability of Sorting Algorithms Matter?

In this post, I will write about the stability of sorting algorithms and why it is important.

2017/9/30
articleCard.readMore

1x1 Convolutions Demystified

In the early development of convolutional neural networks (CNNs), convolutions with kernel size \(3\times 3\), \(5\times 5\), \(7\times 7\) or even \(11\times 11\) are often used. In the more recent literature, however, \(1\times 1\) convolutions are becoming prevalent. In this post, I will try to explain what \(1\times 1\) convolutions are and discuss why they are used in CNNs.

2017/9/29
articleCard.readMore

善用佳软---我常用的 Android 应用

本文介绍一些我常用的 Android Apps,希望你也能喜欢。

2017/9/24
articleCard.readMore

小米 2018 校招算法工程师编程之字符串匹配

这是一道小米 2018 校招算法工程师的编程题目,类似与正则表达式匹配,但是该题不能使用 Python,因此需要自己实现这个简单的匹配,题目如下:

2017/9/21
articleCard.readMore

Some Programming Questions Related to Operations with Big Integers

The C++ standard library doesn’t support big integer operations such as addition and multiplication. In this post, I will show how to solve such problems in C++.

2017/9/21
articleCard.readMore

How to Compile and Install Latest Version of GCC on CentOS 7

The default GCC that comes with the CentOS 7.2 is GCC 4.8.5, which does not support the complete C++11 standard, for example, it does not fully support regular expressions. In order to use regular expression functions, we need to install at least GCC 4.9.0. The following installation procedure is applicable to CentOS 7 and are not tested on other Linux systems. Also you have to make sure that you have root privelege.

2017/9/4
articleCard.readMore

Find Longest Subarray Whose Sum Is Divisible by K

The problem is as follows: Given an array $A$ of length $N$, $A[i] \ge 0$ ( $0 \le i \le N-1$) , and a number $K$. Find the longest subarray whose sum is divisible by $K$, if there are no such subarray, return 0;

2017/9/1
articleCard.readMore

从二分搜索实现中的一个 bug 说起

一道二分搜索问题 # 下午做了一道 Leetcode 的编程题目,牵扯出了二分搜索实现中需要特别注意的一个问题,题目如下

2017/8/27
articleCard.readMore

CentOS 7 系统安装 Shadowsocks 并且开启多用户模式指南

据说墙升级了,本来用得很流畅的服务也不行了,时不时断掉,让人很恼火。有必要升级一下梯子了,于是我也研究了一下利用 VPS 自建梯子的方法。本文总结一下安装中遇到的问题和解决办法,只针对 CentOS 7 系统,其他 Linux 系统配置方法是类似的。

2017/8/6
articleCard.readMore

How to Plot Only One Colorbar for Multiple Plot Using Matplotlib

In some situations, we have several subplots and we want to use only one colorbar for all the subplots. How to do this in Matplotlib?

2017/6/11
articleCard.readMore

How to Set the Aspect Ratio of Image (or Axes) in Matplotlib?

In Matplotlib, Axes is the primary place where we put plot elements, such as lines, texts and legends. However, for a long time, I failed to grasp the meaning of aspect ratio in Matplotlib, thus was constantly frustrated by the behavior of Maplotlib every time I attempted to change the aspect ratio of a plot. This post is the result of my attempt to understand it and my findings. Hope it can help you too.

2017/6/3
articleCard.readMore

A Guide on Using Unicode Characters in Matplotlib

A few days ago, I found that Matplotlib can not show some Unicode characters (some Chinese characters) using its default settings. In the rendered output image, Chinese characters are shown as blank boxes. After reading a lot of posts on this issue, I am finally clear about how to use Unicode characters properly in Matplotlib.1

2017/5/13
articleCard.readMore

Install feh Image Viewer from Source on CentOS 7

On my CentOS system, I usually use eog to view images in the console. But I am a little upset by its speed of opening an image. I do not need such functionality besides viewing an image. So I decided to find another lightweight replacement.

2017/5/6
articleCard.readMore

申请香港通行证

这个月中旬,ICME Workshop 的投稿结果公布,我投的论文被接收了,忙完 camera-ready 论文的提交和注册,我开始办理香港签证相关的东西。

2017/4/30
articleCard.readMore

如何使用 Android 文件管理器在电脑与手机之间无线传输文件

最近换了一台新的手机 OnePlus 3T,这个手机简洁是简洁,预装的应用非常少,自带的文件管理功能不是很全,所以我研究了一下 Android 上常用的一些文件管理 APP。

2017/3/26
articleCard.readMore

Sublime Text 3 使用相关问题及解决办法

这篇文章集中写一些在使用 Sublime Text 3 时遇到的问题以及解决办法,某些问题在不 同系统的解决办法可能都是一样的,但是未经测试,所以使用的时候请先验证。

2017/3/19
articleCard.readMore

Some Loss Functions and Their Intuitive Explanations

Loss functions are frequently used in supervised machine learning to minimize the differences between the predicted output of the model and the ground truth labels. In other words, it is used to measure how good our model can predict the true class of a sample from the dataset. Here I would like to list some frequently-used loss functions and give my intuitive explanation.

2017/3/13
articleCard.readMore

Why Did XeLaTeX Suddenly Run Insanely Slow?

Today I found that compiling LaTeX source is insanely slow(took me several minutes to compile a simple file). After a lot of trial and error, I found the reason.

2017/3/6
articleCard.readMore

Sublime Text 3 Markdown 写作设置

引子 # 由于受不了 VSCode 打开文件的龟速,我决定换一个编辑器,以前就大致了解有三款评价不错的编辑器,分别是 GitHub Atom, Sublime Text 3 以及微软的 VSCode。

2017/3/4
articleCard.readMore

An Introduction to Listary: A Blazing Fast Search Tool

I came across this amazing tool called Listary yesterday and found that it is just an amazing piece of software that will change my experience on Windows fundamentally!

2017/3/1
articleCard.readMore

Hexo 使用,博客写作相关问题及解决方法

本文主要总结 Hexo 博客使用,博客写作以及更新 Hexo 和 NexT 主题的内容。关于如何安装配置 Hexo 和 NexT 主题,可以参考这篇文章。

2017/2/26
articleCard.readMore

How to Install Hexo and Theme NexT from Scratch on Windows

In this post, I will describe the complete step to install both Hexo and theme NexT on Windows. Install Hexo and deploy your post # First, we need to install the Hexo framework. The main steps are as follows: Install Node.js and Cmder # We need to install Node.js and git for Windows. You can skip installing git for Windows if you choose to install Cmder(highly recommended on Windows). Choose the Full package if you decide to install Cmder (only the full package contains git for Windows).

2017/2/26
articleCard.readMore

在武汉过春节

1 月 26 日大清早起床赶到北京西站,坐上了早上八点半左右的火车,前往武汉,晚上大约七点半到达武昌火车站。在武汉呆了整整一周,2 月 3 号中午坐车回的北京。谈谈我对武汉的印象。

2017/2/25
articleCard.readMore

A New Start

去年的时候还是前年,在谷歌上搜索东西,看到了很多人的博客都是用 GitHub 托管的,使用 GitHub 提供的 GitHub Pages 功能。我一看就喜欢上这种开源并且简洁的方式,却没有立即行动。

2017/2/24
articleCard.readMore

关于「尊严」

前一段时间和一个同学谈到了尊严,就用 A 来表示吧。A 认为人在弱小的时候,谈不上尊严,你只有放弃自己的尊严,才能活下来,强者才有尊严,或者说强者的尊严比弱者多。A 的话,让我想到了"弱肉强食"这个词:如果你弱小,那么不要谈尊严,你只是别人盘里的菜而已,尊严对你来说太奢侈了。

2017/1/5
articleCard.readMore

关于神经网络优化的一些思考

优化的方法有很多种,在深度学习中,占有绝对主导地位的还是 stochastic gradient optimization (简称 SGD) 以及它的一些变种,如 SGD with momentum,Adam 等。 SGD 是一种基于一阶梯度信息的优化方法,仅从优化的速度上来讲,效率不是最高的,一些利 用二阶信息的优化方法,理论上优化速度更快,但是,SGD 反而是在深度学习的优化中使 用的最多的优化方法,为什么其他类型的优化方法在深度学习中不经常使用呢?它们相比 SGD 有什么缺点?或者说 SGD 有什么优点呢? 这篇文章试图对这个问题给出自己的思考 与总结。

2016/11/25
articleCard.readMore

关于孩子

坐火车回北京,我坐在过道边,过道另一边是一个老人家带着她的孙子,小孩子约一岁,能说模糊不清的字。小孩子一路上都在吵吵闹闹,一刻不停歇,写作此文时候的举动是把前面座位上贴的布给扯掉,扔在地上,他的奶奶似乎无动于衷,也不批评,也不行动,过了一会儿,打扫卫生的人员过来了,把布捡起来,又贴在了原位置。小孩子仍然不满足,继续进行他的游戏,又把布扯掉扔在地上,奶奶似乎也有点不满意了,把布捡起来粘在了原处,然后小孩和他的奶奶重复这个回合若干次,奶奶并未对孩子讲这样做有什么不对,只是寄希望于小孩别再拽掉那块可怜的布了。

2016/9/5
articleCard.readMore

「汉奸走狗」与「关我*事」

公元 2016 年,真是一个多事之年啊,各种事件接踵而至,纷至沓来,仿佛排演好的一般,不断在现实与虚拟空间制造着冲突、对抗,也制造着话题。

2016/7/16
articleCard.readMore

I Am Awaken

你可能不信,人的想法转变可能是一瞬间的。

2016/5/30
articleCard.readMore

我们的焦躁与不安

从乡下搬到市里不到一年,时间不是很长,注意到了两个事情,让我总是想写点什么来说一说。

2016/4/18
articleCard.readMore

从「禁摩限电」说起

<p align="center"> <img src="https://blog-resource-1257868508.file.myqcloud.com/20190528010420.png" width="800"> </p>

2016/4/11
articleCard.readMore

你饿不饿?来吃点东西好吗

想起了一个很好笑的笑话,有人在网上提问:“老婆怀孕了,但是隔壁邻居家里有wifi,我该怎么办,在线等,急!”有人回答:“送邻居一个仙人掌,能防wifi。”生活中,你也经常听到有人对你说,新买的手机必须完全放电,然后才能充满电,必须重复这样几次;还有人对你说,手机电池必须用到快没有电再去充电才行,否则会损伤电池。

2016/3/26
articleCard.readMore

Commonly-used Methods in Python OS Package

In this post I summarize the commonly-used methods in Python os package.

2016/3/17
articleCard.readMore

神经网络中误差反向传播(back propagation)算法的工作原理

神经网络,从大学时期就听说过,后面上课的时候老师也讲过,但是感觉从来没有真正掌握,总是似是而非,比较模糊,好像懂,其实并不懂。 为了搞懂神经网络的运行原理,有必要搞清楚神经网络最核心的算法,也就是误差反向传播算法的工作原理,本文以最简单的全连接神经网络为例,介绍误差反向传播算法的原理。

2016/1/19
articleCard.readMore

Windows 系统下 Python 以及 Pip 的安装和使用

本文主要介绍在 Windows 系统下,如何安装 Python 和 Pip, 以及 Pip 的简单使用。

2015/10/21
articleCard.readMore

LaTeX 中参考文献管理以及注意事项

LaTeX 写作中,参考文献一般单独放在一个 *.bib 文件中,每个文章对应该文件的一个 条目,每个文章有一个独一无二的 Key,在文章中使用 key 来引用对应的文章。 bibtex 可以根据 *.bib 文件产生 LaTeX 可以识别的引用条目,然后我们才可以在 LaTeX 中引用相关的文献。 本文主要写一些和文献管理以及引用相关的注意事项。

2015/10/16
articleCard.readMore

How to Insert LaTeX Equations in Microsoft Office Word and PowerPoint

In this post, I would like to share how to insert beautiful latex equations into Microsoft Office Word and PowerPoint.

2015/10/13
articleCard.readMore

Windows 下 LaTeX 手动安装宏包(package)以及生成帮助文档整套流程

本文简单介绍如何手动安装一个 LaTeX 宏包。 一般来说,下载的 TeX 发行版已经自带了很多宏包,可以满足绝大部分需求,但是偶尔我们也可能碰到需要使用的宏包碰巧没有安装的情况,这时我们就需要自己下载安装宏包了。

2015/9/23
articleCard.readMore

有所恃的与无所恃的

有一句俗话说“两鸟在林不如一鸟在手”,讲的是抓在手里的东西才会让人踏实,如果手里什么也没有,所谓“无所恃”,大多数人就会变的着急,会恐慌;还有一句相对的话叫“恃宠而骄”,范围过于狭窄,应该叫“恃物而骄”,马克思主义哲学的物质观告诉我们,世界是物质的,物质具有客观实在性,因此这物就是广义的了,财富,权力,荣誉……这句话说的是人一旦有所恃,除却个别精神十分平淡的人,其余的人都会有“飘飘乎”而不知自省的状态。

2013/10/22
articleCard.readMore

2013 上半年

大三下学期似乎没有什么大事,平淡中度过。

2013/9/17
articleCard.readMore

当你在玩《三国杀》,你在玩些什么?

我了解《三国杀》这个游戏,还是刚升入大学那会儿,那时我们和隔壁宿舍已有几位熟悉玩法的爱好者。大一初始,隔壁宿舍就是他们厮杀的战场,经常是几个人一玩到深夜。我那时对这个游戏虽有兴趣但又觉得规则、技能太多,难于记忆,便没玩,所以当他们玩的正酣时,我却在宿舍睡觉呢。

2013/7/16
articleCard.readMore

Which Teacher Do You Respect Most?

有一次看到问题,“which teacher do you respect most?”。走在上课的路上,脑子里回味着这个问题,答案却未能蹦出来。

2013/6/19
articleCard.readMore

倏忽一年:2012 下

新学期从暑假开始,热气满盈的培训教室,三国杀乐趣多,《国家干部》、《万历十五年》以及《亲爱的安德烈》,通宵达旦的数模比赛之夜,开学前两周的酱油生活,《那些回不去的年少时光》与《你好旧时光》,又闻桂花香,国庆登岳麓,编程趣味多,二食堂三楼很火呐,酱油的传感和检测实验以及课程,“蹭”了一个学期课的《电机拖动》,勤勉的略带苦口婆心的安老师,缺乏激情、乏味的“现控”课,起于十月中旬的托福单词,讲《误差理论》的认真负责的彭老师,“cut the rope ”一个有趣的游戏,充满智慧的《线性代数》公开课,“倾倾百老汇”成周末习惯,过生日与生日礼物,那些无名烦躁,自习圣地A座414,粉冶自习人,一直坚持的跑步,后湖小区的包子不错,《因为痛所以叫青春》,再读《成长》,练习汇编程序编写,“耿耿于怀”的传感考试,自省,为班级宣传拍视频,某某某乃真屌丝,a crisis in the end of 11,我逃课我喜欢,《肖申克的救赎》为何让我流泪,对外文教材的无来由崇拜,为课设不断看书,《半生缘》与《倾城之恋》,轻松过关的体育测试,干涸了一整个学期的人工河,打酱油于优秀班级答辩,后湖那还不错的杂酱面,我终究没能完成,惭愧的课设,《最美的时光》,坑爹的检测考试,写报告的不眠之夜,雪中漫步,考试前爆满的三教,据说图书馆很火爆,教室的空调能规律点否,元旦吃火锅,考完现控的后悔与令人揪心的微机,本学期网购的书可不算少,重游铁道,激战三国杀,只是“吃饭”的聚餐,托福单词完结,are you a changed man ?

2013/2/18
articleCard.readMore

自嘲与自省

有时候觉得自己对人生的许多道理都懂了,给别人讲的时候都是很有气势,自己遇到了呢?人生中的有些事是不是真的别去想就好了?恐怕不是吧,不去想一些事有时是自信不足的表现,想要像鸵鸟一样把自己蒙蔽起来,不去想,不去看,问题就没了?当然不会的。有时候很害怕去解剖自己,这带来的一个后果就是在意旁人的看法,好像还没有那么强大,可以完全只注意自己的内心,就譬如别人说你很强大或者不行,你就真的是那样了?你会在意别人的看法么?甚至你会不会自嘲一下自己,把自己贬的体无完肤,但是内心确是无比的清醒,知道自己的位置,毫不迷糊茫然?

2012/9/6
articleCard.readMore

2012 上半年

华硕ASUS,严肃的模电老师,模电好困难,不抛弃不放弃,其实张教主挺好(至少无可指摘)的,平和的数电老师,一个陌生女生的信息,胃酸真的挺痛苦,这医生太坑人了!木有听懂自控老师的课啊::>_<:: 自救者天救,初次物理实验的谨慎、认真看来是可笑的,新闻英语与晦涩的英美名篇选读,爱默生的《self-reliance》,社会时事和人生感悟,这个朱老师不一样!鸡肋物理实验and 自控实验,写报告真是一件奇葩的事,拿什么拯救你我们变质的实验?一口湖南话的毛邓老师,干净利索的复变老师,六级单词的完结,选修课老师有点“重口味”^^,自习圣地不再(A座415),忙碌的物联网杰哥,南校操场的跑步,清明岳阳楼之行,学习的观念(《成长》),百里毅行,做收音机,少吃辣椒了,二食堂二楼也不那么难吃的,三楼开始不错唉,后来……偶尔的焦虑与烦躁,人要理智一些!五一“美妙的”月亮岛之行@@,夜爬岳麓山,电工实践有点意思,我跟锋哥的组合天下无敌!读书:《追随智慧》,《联想风云》,《成长》,《中国的新革命》。更能承受了,成长了吗?

2012/7/24
articleCard.readMore

2011 下半年

分班,新班级,二辉诗贤转专业,新班级聚会吃饭,申请奖学金,申请表,被扣德育分(不通人情的辅导员老师),国庆岳麓山,博物馆,电路自习,六级单词(新东方),看《西征记》,金工实习,一波三折的锤子,EC被刷,晚上睡觉很迟,梁中武看电视剧,电子电工实验,网络逃课,概率论乱七八糟,电路陈宁挺好,英语没怎么认真学,逃听力课,奋力去做数据库,漫长的自习(圣地A座415~_~),杰哥的认真学习,一位不曾说过话的自习人,为什么都去图书馆,概率论考试给我打击,bbc 英语,一种内在的焦躁,无聊的马克思,令人发狂的电路,二食堂一楼四楼吃饭,偶尔二楼,跑步没有坚持住,书包丢了,悲催的物理学习(蒋亦民,彭政),新的个性同学,岳麓山越野,宿舍的冷战与对峙,我对某些事的冷静态度,搞笑的人。

2012/1/12
articleCard.readMore

最近的一些感想

心态 # 总是在追逐,在忙碌,却没有停下脚步,问问自己:“你在做什么?”心里不安静,受外物干扰太深,各种念头太多,易激动,易手忙脚乱。为何不能平静地地做事呢?任何时候都尽量不去生气,不去发怒,想办法去解决。一颗平静的心能帮你拨开那层层的雾霭,看见光明。

2011/12/9
articleCard.readMore

尝试积极 -- 国庆节感想

这几天,就是国庆节了,没有去旅游,每天都在宿舍,早上睡到很晚才起来,中午有时磨磨蹭蹭,一阵消磨,真是 kill time。

2011/10/6
articleCard.readMore

No Sane Person Will Ever Do That -- 关于大学傻逼的查寝

来到大学,一年多了,的确看到了许多同学因失去了高中时的严加束缚而整日放浪形骸,好多同学由于玩游戏、不上课导致挂科、重修。可能正是因为辅导员老师经历了许多类似的事,因此才制定了「查寝」的政策,完全可以理解辅导员老师的一片苦心,希望信息院的孩子都能努力学习嘛。刚开始我对此是不屑一顾的,因为我自己肯定是不会躲在宿舍打游戏的,何况我没有电脑。没有自行车,要去新校区,得走二十分钟,好浪费时间;去三教吧,人又那么多,人挤人的学习氛围给人不舒服的心情,所以我就选择了在宿舍自习。在宿舍,一个人,打开一盏台灯,倒一杯开水,氤氲的水汽,给人温馨的感觉。有多少个夜晚,在这样宁静的空间里,静静地思考,累了就听一首歌,或者到阳台上眺望一下校区的夜景,多么理想的自习之地。上个学期,我一直在宿舍自习,期间当然遇到了好多查寝的同学,我也记不清被查到了多少次,那时的我一直是问心无愧的,我只是在宿舍学习而已,有错吗?

2011/9/30
articleCard.readMore

欣赏奇妙的世界2

人的心理真是太微妙了,这是我这些天一直在考虑的问题。在两个人的交往中就可以窥见这种微妙,起初两个人并不熟识,然后突然有一天你很有兴趣跟某个人说话,这种愿望好象是闯入脑子里的,没有任何征兆。回忆一下和你认识的人的交往,其发端似乎都很微小,以致于我难以想起为什么两个人彼此认识了。

2011/1/20
articleCard.readMore

科学家是怎么样炼成的?

我在少年时做过许多梦,其中一个最远大的梦(相信也是许多同学的梦)就是成为一名科学家。小时候对如何做科学家毫无概念,只知道科学家很伟大,可以想做什么就做什么,而且还能享受到极高的荣誉。

2011/1/8
articleCard.readMore

两个世界的碰撞

~~前一阵子,早上起得自以为还挺早,于是每天都能听到在公交车终点站对面有一群人在念英语,一般模式是一个人带头,其他人跟着念,念得很大声,很有激情。

2010/12/10
articleCard.readMore

欣赏奇妙的世界

几天,我在操场上跑步时,不知不觉想到了世界的和谐与奇妙。这个世界如很多人所说,由于技术——无线通讯,互联网——的联通而变小了,但这个世界其实还是很宏大的。想想我们所生活的地球,这个地球上有多少人啊,每个人都在创造属于自己的生活。每一天每个人就那样生活,生活在自己的圈中,而自己或许并未认识到。

2010/12/4
articleCard.readMore

关于郑星

我听说郑星,也是在高二的时候了,记得那时有一次跟师胜锋在一起走路聊天,忽然听师胜锋叫了一句:“郑星!”我停住脚一看,见到一个瘦瘦的,个子中等,留着一头短发,脸上略微有一些雀斑的学生正拿着一沓书往大讲堂走,我一想就明白肯定是去听竞赛课—那大概是我第一次听说有“郑星”这么一个人。

2010/10/16
articleCard.readMore

听舒曼《梦幻曲》

——我是在去年暑假时听到舒曼的《梦幻曲》的,听过之后就再也忘不掉了。我不想说它的只想说它带给我的感觉,因为我可以说是一个乐盲—丝毫不懂音乐知识。

2010/10/9
articleCard.readMore

关于哭

好些天以前,在宿舍里,大家不知不觉就谈到了哭,好像是讨论哪部电视剧使他们感动得哭了。那次讨论使久藏心中的一个话题再一次被激活,可是我终究没能写点什么。现在我觉得有写的必要了,一是因为实在有些抑制不住了;二是因为明天要考语文,就当是练习写作吧1。

2010/10/7
articleCard.readMore

上大学了

长沙的天气确实不留情,算上今天,已经是我第五次在半夜被热醒了……索性下床喝了点水,洗了个脸,然后睡意全没了,那就随便写点什么吧。

2010/9/20
articleCard.readMore

卖饭姑娘

忽然想起了在新校餐厅吃饭时认识的一位卖饭姑娘,其实并不真认识,只是见了认识而已,甚至没说过什么话。不知怎么地,有时就会想起她。

2010/7/21
articleCard.readMore

Privacy Policy

1990/1/1
articleCard.readMore