# 2018， 在路上

2018年，一直在路上，特别是在I-71。I-71是一条跨州的高速公路，从南端肯塔基州的路易斯维尔(Louisville, Kentucky)东北延向俄亥俄州的克里夫兰(Cleveland, Ohio)，全长约345迈。之前每逢夏天，便约上几个好友沿着I-71开车到克里夫兰，或是参观艺术博物馆，或是听音乐会，又或是去那个不甚似国家公园的国家公园骑自行车。到了今年，那些个好友也已经有好几个毕业离开了。虽然少了好友一起在I-71路上寻找悠闲，但是I-71对我来说有了它新的意义：它变成了李之仪的长江。

# Simple Grid Detection for Sudoku

Sudoku is a very interesting puzzle, and it is very easy to get familiar with the rules of the game. I always like to compare sudoku with number theory, they are easy to be understood but can be hard to solve. Fermat's Last Theorem, an easily understood problem even by middle school students, took mathematians 358 years to solve it completely. Solving sudoku puzzles can take even longer: it is proven that solving sudoku puzzels is an NP-complete problem! However, classical 9x9 sudoku puzzles are still feasible using backtracking algorithm. We are not going to talk about how to solve sudoku puzzles here though, we are trying to sovle another problem: detect grids in images containing sudoku puzzles.

To make the problem more concrete, let's make some assumption on the image that contains a sudoku puzzle:

1. The image only contains one sudoku puzzle
2. The sudoku puzzle is the largest block in the image
3. There is no/little distorsion/rotation of the sudoku puzzle grid

Also in this article, we focus on only simple solutions without heavy image processing. We will use Pillow to read images and convert them to gray scale images, and we use Numpy to manipulate images as arrays. For visualization, we use Matplotlib.

# Pytorch on RaspberryPi

Finally, I successfully installed Pytorch on my RaspberryPi 3B. I followed the instructions on How to install PyTorch v0.3.1 on RaspberryPi 3B and a blog post (in Chinese) 在 RaspberryPi 上编译 PyTorch. I am running latest raspian image 2018-04-18-raspbian-stretch and a self-compiled Python 3.6.5. If you are interested in compile Python 3.6.5 or above on your own, check out Installing Python 3.6 on Raspbian. In this post, I will write down steps to my successful installation, and share my compiled wheel file at the end.

# Chapi

I recently built a flask app that run on my raspberry pi. Then I turned it down. Why? In order to access the app from outside the home internet, I had to expose my pi to public. After only one day of exposure, my pi received several attack attempts and the flask app then always replied 301. Here are some attack logs:

139.162.83.10 - "GET / HTTP/1.1" 404 -
45.33.115.189 - "GET / HTTP/1.0" 404 -
79.55.11.21 - "GET / HTTP/1.0" 404 -
123.151.42.61 - "GET http://www.baidu.com/ HTTP/1.1" 404 -
158.85.81.116 - "GET / HTTP/1.1" 404 -


To be more precise, the flask app was still running, but the home router seemed not forwarding the requests to my pi. Anyway, I have no idea of what have happened. I just shut the app down, flashed a fresh new image to my pi.

I want a way to communicate with my pi without exposing it. That is the motivation I start the project chapi, which means "chat with pi".

# 一个“朴素”的推荐系统

## Introduction

$$P(like|aritcle)$$

$$P(like|aritcle) = \frac{P(article|like)P(like)}{P(article|like)P(like)+P(article|dislike)P(dislike)}$$