MySQL Pretty Print in Command Line

Introduction By default, the output of mysql in the console may be ugly when the screen is too small or the count of fields are large in the table. see the figure. There are 2 alternative to prettify the output in the console. 1. Display Records Vertically use \G option rather than ;. SELECL * FROM user\G 2. Using Pager pager less -SFX SELECL * FROM user; Advanced Mysql provides user-specifc options file which allows mysql client read user's default configuration when connecting to mysql server.

Read More

Mycli - productive mysql command line client

As I know there are two MySQL client: MySQL workbench is a GUI client which is developed by official. mycli is a terminal client which is an open source & developed by python. There are two reasons why I choose mycli as my primary MySQL client: I prefer to use command line interface mycli supports auto-completion and syntax highlighting Brief Usage $ mycli --help Usage: mycli [OPTIONS] [DATABASE] A MySQL terminal client with auto-completion and syntax highlighting.

Read More

Redis Notes

Installation brew install redis Redis-cli redis-cli is the Redis command line interface which allow you interact with redis server see on offcial site connect to server redis-cli -h yourHost -p yourPort # enable cluster mode redis-cli -c -h yourHost -p yourPort all usage Usage: redis-cli [OPTIONS] [cmd [arg [arg ...]]] -h <hostname> Server hostname (default: 127.0.0.1) -p <port> Server port (default: 6379) -s <socket> Server socket (overrides hostname and port) -a <password> Password to use when connecting to the server -r <repeat> Execute specified command N times -i <interval> When -r is used, waits <interval> seconds per command.

Read More

Download File via Curl in Mac OS

在GNU環境裡常用的下載檔案軟體為 Wget, 例如: wget http://testssl.sh/testssl.sh 我的開發環境是 mac os, mac 的預設裡面並沒有安裝 Wget, 需要透過 homebrew 另外下載安裝 但小妹又很懶得在電腦裡面多裝一套件,於是尋找是否有了不需要透過 Wget 的做法 原來透過 curl 我們就可以達到下載檔案的目標了! 使用 curl 下載檔案的方法非常的簡單 curl http(s)://example.com/filename.suffix -o "output.suffix"` 所以 把剛剛的指令改成以下就可以囉! curl http://testssl.sh/testssl.sh -o "testssl.sh" Reference GNU Wget - https://www.gnu.org/software/wget/ curl manpage - https://curl.haxx.se/docs/manpage.html

Read More

Useful Zsh Plugin

1. Auto Suggestion # install via homebrew brew install zsh-autosuggestions # add the following at the end of .zshrc /usr/local/share/zsh-autosuggestions/zsh-autosuggestions.zsh # force reload .zshrc source ~/.zshrc 2. Syntax Highlighting # install via homebrew brew install zsh-syntax-highlighting # add the following at the end of .zshrc /usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh # force reload .zshrc source ~/.zshrc

Read More

Add Google Analytics in Hugo

This is an example for tracking the pageview of Hugo blog which theme is hugo tale Getting Started add tracking code in config.toml googleAnalytics = "UA-XXX-X" for home page, add Hugo's interanl google analytics template in layouts/partials/index/introduction.html mkdir layouts && cd layouts mkdir partials && cd partials mkdir index && cd index echo "{{ template \"_internal/google_analytics_async.html\" . }}" > introduction.html for post page, add Hugo's interanl google analytics template in layouts/partials/single/header.

Read More

Build A Blog Using Hugo

This is my first blog built by Hugo. The reason why I get started to build this blog is one day my colleague said hey! Anna, do you have an interest in writing the blog? I told my colleague, why not :p? If you have an interest in built blog by Hugo, you can refer to official's getting started.

Read More