Posts

Showing posts from January, 2023

Yet another advice to kids

Sharon posted some advice to the youth (although she herself is young). She suggested being independent, with no fear of failure, which is excellent advice. I'd like to give some more "concrete" tips to kids or myself in childhood (if I have the chance to tell that me). First things first, the following suggestions can't make you more competitive than your peers or perform better in exams. or win the girl make you fascinated. They make your everyday life more exciting and fancy even if you're not rich or powerful. They're neither expensive (so you can achieve these goals even if not born into a rich family) nor painful. What you need is to know them, and keep doing them. OK, here we go. 1. Find a sport, enjoy it, and be good at it. Sport is a way to talk with your body, with the physical world, express yourself, and communicate with people. 2. Be honest, especially to yourself. Living honestly in Chinese society looks stupid and clumsy. Never mind. Being hones...

Display "Real" Image in Terminal

When studying the data visualization tool `Gnuplot` these days, I found an interesting technology: sixel. Simply put, it's about how to display a bitmap in the terminal. You may wonder, how could it be possible to display a bitmap in the terminal, since the definition of "terminal" is a character display device? Exactly. I have to apologize that it's just a convenient way to describe sixel as "bitmap in terminal". Strictly speaking, sixel is a technology about displays bitmap in a terminal emulator, rather than a terminal. You may ask, why make things more confused with another jargon? Well, there's a little quirk here, but trust me, it's not complicated. Let me explain. When you click the "CMD" icon on Windows, mac, or Linux desktop, the application appeared is a "terminal emulator". The REPL (read, evaluate, print loop) process running inside the terminal emulator is a "terminal". In the viewpoint of a terminal, there...

2023: On the Road

There're so many dramas happened in the past 3 years. People say there'll be more in the coming 2023. Basically, I agree with this. But no matter what happens in the physical world, we need to concentrate on something really important and interesting. In the past 2022, my most profound change was, that I started thinking seriously about the future living style. My family and friends mostly live like plants, fixed by our roots, and change ourselves to adapt to the environment. We are where we are, proud of its history and culture, and contained by it. It'll not be the case anymore. In 2022, I learned, read, listened, wrote, and spoke in second languages, especially English and Japanese. They bring me a new world. I also read several books on Chinese and middle east histories. The world before me is fusing as a whole sphere. China and Chinese people are a part, and the most familiar part for me, the starting point of my exploration. It gives me enough confidence as a foreig...

Reped: A REPL-Centered Workflow for Data Science

Nowadays workflow for data science is editor-based. No matter vim, emacs, or IDE are all central parts when data scientists develop algorithms, or engineers develop new applications. People write scripts in the editors, copy them into the interactive shell (often called REPL, an acronym for Read, Evaluate, Print Loop), and execute the codes there. For better interactivity, people invent a bunch of tools, such as linter, auto-completion, and syntax highlighting, until LSP (language server protocol). However, all these tools are not free lunches. The editors are becoming more and more swollen and clumsy. We spend time and (sometimes) money to make ourselves skillful in VS Code or PyCharm. However, when we enjoy the fancy functions provided by these tools, we are bound with them, like an assembly line worker, rather than a free-minded, joyful coder. Some say, even though this is a fair argument in some way, most programmers nowadays do use IDEs. Yes, but with a historical reason. Today de...

Book Review of Country Driving

 Country Driving: A Chinese Road Trip, is Peter Hessler's book published by Harper in 2010. The version I read is its Chinese version, published in 2011. The book is composed of 3 stories: driving along the Great Wall from Beijing to northwest provinces; living in the Sancha (三岔), a small village in HuaiRou (怀柔) district of Beijing; factories, bosses, and workers in LiJiang (丽江), a city in Zhejiang (浙江) province. IMHO, these stories represent three worlds of modern China: The first represents the forgotten and vanishing villages and towns; The second represents villagers' struggle to modernize; The last represents the development of eastern cities and the workers living in them. It's not difficult for readers of this book to discover that Hessler is an acute and insightful reporter and observer, like a sophisticated surgeon, while his patient is a society and its cells, instead of a human being. But the most significant impression after reading this book is the openness and...

Interpretable AI Series (1): overview

Machine learning and artificial intelligence are hype words today. Companies, universities, institutions, and governments are all busy making their products, services, and themselves more "smart". Recently the hottest topic in lunchtime talks is how to use chatGPT to write source codes for us programmers. However, as we become more powerful and intelligent with the help of AI products, there's always more or less dubiousness in our hearts. Is AI reliable? Should I take its suggestion or conclusion even disagreed with my intuition? How to challenge AI's decision when it's surely wrong? Ajay Thampi's book, "Interpretable AI", published by Manning last year, was trying to answer these questions. The first chapter gave an overview of the interpretability and explainability of AI products. Simply put, data scientists and engineers concern mainly about "interpretability": why my model emits such a classification result on this sample? Which featu...

Merge Python and shell in xonsh

xonsh , pronounced conch , is a wonderful shell-Python mixed execution environment, where you can execute shell commands and Python codes equally and interchangeably. Installation xonsh can be installed at system-level with /usr/bin/pip3 install 'xonsh[full]' . If there’s no system-level pip ( /usr/bin/pip3 ) installed, you can install it with apt install python3-pip on Debain-based Linux. However, for support of some critical tools (such as fzf, autojump) are still not mature, system-level Python is not a good idea in most cases. The recommended way is used as a on-site REPL and script-execution engine in a Python project. You can embed it into you Poetry defined project as follows: pipx install poetry poetry new <my-project-name> cd <my-project-name> poetry env use <python-name/path> poetry add 'xonsh[full]' poetry run xonsh Configurations Prompt, Aliases and Plugins In most cases, the path of your user-level rc file (run control file) is ~/....