Tuesday, October 20, 2020

Signal Desktop on Arch Linux

As I mentioned earlier I am using Manjaro Linux on my old laptop, and the repo of the distro it based on, Arch Linux, actually has Signal Desktop. However, it is not up-to-date, which is understandable because it is not "officially" released by Signal. Well, there is always the option to compile from source. I saw the package.json and I know it gotta be using npm. Did a npm install but apparently I also need to install yarn first. Then I just followed the steps in this post:
npm install yarn
yarn install
yarn generate
./release/linux-unpacked/signal-desktop

Wednesday, October 07, 2020

東坡和盼盼

 今早一時興起搜尋一下永遇樂這個詞牌的名作,最有名的自然是辛棄疾的《京口北固亭懷古》(千古江山),李清照的《落日熔金》寫元宵亦是佳品,對我來說,back story最有趣的自然是東坡的《彭城夜宿燕子樓》,燕子樓曾是唐朝名歌妓關盼盼的居所,是關的情人、大官張愔為她所建。張愔死後,關盼盼一直獨居燕子樓,可見兩人感情之深。張的友人張仲素寫了以下的這首詩描述關對張愔思念之情:

 樓上殘燈伴曉霜,獨眠人起合歡床。 相思一夜情多少,地角天涯未是長。

白居易則作此詩唱和:

 滿床明月滿簾霜,被冷燈殘拂臥床。 燕子樓中霜月夜,秋來只為一人長。

(又有傳說指關盼盼後來自盡,皆因為讀了白居易此詩《感故張僕射諸妓》:

黃金不惜買蛾眉,揀得如花三四枝。歌舞教成心力盡,一朝身去不相隨。

不過已有不少學者網民為白平反,因為張僕射指的是張愔之父,詳情請參閱此文,有空會寫寫此故事)

蘇東坡作為一代文學宗匠,也是風流才子,留宿燕子樓自然夢到盼盼,醒後有感而發,作詞一首《永遇樂》(節錄):

 天涯倦客,山中歸路,望斷故園心眼。燕子樓空,佳人何在,空鎖樓中燕。古今如夢,何曾夢覺,但有舊歡新怨。異時對,黃樓夜景,為余浩嘆。

感嘆世人在俗世浮沉,迷失於紅塵中,其實最終要認識到人生無常,一切只是過眼雲煙;蘇東坡時人會在燕子樓為關盼盼感嘆,而後人又會在黃樓為蘇東坡感嘆吧!

傳聞蘇東坡本人也有一位名盼盼的心愛歌妓,此女姓馬不姓關,坊間也流傳一個馬盼盼和黃樓的故事!話說蘇東坡被派往徐州做官,解決了洪水之災,為紀念此事及以「土尅水」,建了一座黃樓(此文有圖),其弟蘇轍作了一篇《黃樓賦》(原文)由也是大書法家的蘇東坡書寫後刻碑,東坡寫到一半走開了,頑皮的馬盼盼接著寫了「山川開闔」四字,原來她一直練習蘇體,寫得似模似樣,之後也被保留下來。

究竟那四字寫成怎樣?在網上完全找不到圖片,而原碑早已被毀,據報導政府在1988年重修,碑文也根據拓片重刻,希望有心的網友有機會看到拍張照片上傳過來吧。

Saturday, October 03, 2020

中環佩搖

今日翻書偶然看到一首元曲《憑欄人.客有吳郎吹洞簫》,曲詞最後四字為本帖題目,令我聯想起的竟然是火炭麗琪(FYI,有一位YouTuber好認真的分析該曲歌詞,值得一看)

言歸正傳,全曲如下:
客有吳郎吹洞簫,明月沈江春霧曉。湘靈不可招, 水雲中環佩搖。
(由書法字典集字而成)



是著名畫家倪瓚贈友人吳國良之作,吳郎既擅長製墨,又精於吹簫,本曲用江月春霧的美景讚他的演奏餘音繚繞。湘靈的典故是指傳說中舜的妃子娥皇、女英, 她們死後成為了湘水女神;吳的簫聲雖然未能令她們現身,但水雲交織的迷濛中隱約可聽到她們飾物搖動之聲。詞簡淺得來意境高,我十分欣賞。

此外,我也在網上找到有作曲家為此曲譜了(元代的版本應該失傳了吧?),有機會的話吹給大家聽聽。

Monday, September 28, 2020

One Note Samba

If you came here for the song, please go to YouTube.  This is my one note for fixing my SAMBA-related issue on my Manjaro box. Basically gio mount gave me the following error:

Failed to mount Windows share: Software caused connection abort

Fortunately I found this post, in my case, I created a new smb.conf file as root and added the global protocol line to it. 

Thursday, September 24, 2020

Manjaro

三個月前的今天剛裝了Elementary OS,可是陳年60GB HD那個partition已極速爆滿,是時候換新SSD,今次買的240GB比當年那個60GB還要便宜!

 因為新鮮感已失,加上日本語輸入法使用甚不方便,所以打算「從新出發」,在新SSD上裝一個未用過的Linux Distro, 讀了好幾篇關於Linux Distro的文章,決定先試以前曾有不俗經驗的Arch Linux, 見有一個甚獲好評名為EndeavourOS的新Arch Linux-based Distro, 於是下載了ISO, 用dd抄了去USB手指,boot時到BIOS指定用USB即成,在Live env試了一會就裝,由於HD是全新,所以安裝沒有甚麼特別選擇,完成後reboot,循例update了所有packages, 然後再reboot就只有白紅藍全營幕輪流出現!再重裝一次又是如此。 

為確定不是HD問題,於是用dd把舊HD複製到新HD,保留了原本所有boot records/partitions/OS, 可進入原來的Elementary OS了,再下一步是玩玩GParted: 複製後新HD有180GB左右的Unallocated space, 有甚麼方法加到Elementary OS那個爆滿的Partition呢?首先,我消滅了兩者之間的小小swap partition,原來還要把這個Unallocated space「撥入」Elementary OS那個Partition的parent才可以resize, reboot時GRUB就找不到Boot record了,看了此文,估計名字變動了,即管試試set prefix,果然全中!於是update-grub and grub-install. 有了可用的installation,又再心癢試新事物,今次是另一個Arch Linux based Distro: Manjaro, 難題是要和Elementary OS的Partition共存,所以徵用那個已廢的Ubuntu partition,不過Installer認為無free space而安裝失敗,於是我再用GParted把那個partition recreated, 今次Manjaro installer沒問題了。 

裝好Manjaro之後,為證明比Elementary OS優勝,「試題」是再裝倉頡日本語一較高下。「解題」用了四個小時,不過「答案」的確更好。閒話少講,關鍵是跟此君要用pamac安裝ibus, ibus-table-chinese, ibus-mozc(這個需要在機上build, 失敗了三次才成功,浪費了不少時間)然後setup IBUS加Japanese-MOZC, Chinese-Cangjie3 最後一步是找個file to force autostart, 又找了好一會,答案是:

cat .xprofile 
export GTK_IM_MODULE=ibus
export XMODIFIERS=@im=ibus
export QT_IM_MODULE=ibus

ibus-daemon -drx

各位網友晚安! 

後記:分享一個師兄教路在Xfce "Dock"加App的方法(其實是他舉出Xfce如何難用的例子)

Thursday, September 10, 2020

PDF to Image solution

I wrote about using Mac OS X Automator for converting a PDF to images. How about Linux? I found this solution: At command line,  execute 

pdftoppm -jpeg <pdf file name> <prefix of jpg files to be created>

It might be already installed in your Linux box. If not, it is part of poppler-util. 

Thursday, September 03, 2020

Linux screen recording for Mac

The title mentions both Linux and Mac and that's not a typo: I have a requirement to record my screen on my Linux box and then put that video into iMovie on Mac for editing. (Yes, I could have used a Linux video editor but that's a different story)

I installed a simple screencasting tool called Kazam on my Linux box, record and save the movie in H264 format, which is the same encoding as QuickTime (Mac)

However, QuickTime refused to open my file! It turns out the pixel format is the culprit:

ffmpeg -i 'Screencast 2020-09-03 13:59:50.mp4' -pix_fmt yuv420p -f mov output.mov

I have to convert from "Planar 4:4:4 YUV" to yuv420p for QuickTime. 

Bonus: Next I needed to record the screen from my Mac, which I could use QuickTime. However, I have too many icons on my desktop and it'd look better if I hide them. Turns out it's easy in command line:

defaults write com.apple.finder CreateDesktop false
killall Finder
And if you need to show them again, revert it: 
defaults write com.apple.finder CreateDesktop true
killall Finder

Friday, August 28, 2020

Mac OS的Automator

 昨天和老同學討論Mac vs Windows, 當然火花十足,事實上我也算不上蘋果忠粉,用的日子也不長,所以至今天才發現Automator這個「新」功能,今天要和各位網友分享。

話說我製作蘇子曰YouTube頻道的錄像時,在資料搜集期間,用Google Slides最為方便,不過錄影時如果要同時控制Presentation的話難免分心,所以會在錄影完畢後,在iMovies的Main track逐張Slide的圖像加上去,再在Main Track之上加上有「 人頭」的部份作Picture-in-picture.

問題來了:在Google Slides入面只能逐個Slide「手動」Export為圖像檔!如果多Slides的話頗費時。其他可Export的格式包括PowerPoint及PDF等,而這些格式又能否「一次過」轉為多張圖像呢?答案是可以的!特別鳴謝兩位網友(Link1, Link2)

我在此簡單描述一下步驟:

  1. (在Spotlight)打開Automator
  2. File->New->Choose "Application"
  3. 在左邊Library選PDFs,把Render PDF Pages as images拖到右邊。
  4. 再在左邊Library選Files & Folders,把Move Finder Items拖到右邊。(不然會找不到之前一步的檔案)
  5. Save(為此Automator Application改個易記的名字)
  6. 在Finder把PDF拖到這個新Application即可把它轉為多張圖像
不知Windows有沒有對應的內置功能?


Monday, August 17, 2020

Free web hosting and free SSL cert

Back in the days most of us (with some tech backgrounds) have played with creating a personal website by writing our own HTML that has our bio and some pictures embedded. And most of us used free web hosting (why pay for it anyway? :P) Then FB got popular and the rest is history. Fast forward 2 decades and the most popular free "site builders" like Wix and Google don't serve raw HTML page you write anymore, which is understandable because it's harder to secure things they don't control. Long story short, I needed to serve a page, and using the HTTPS protocol. And InfinityFree came to rescue!

I created a new (free) account and provided it a domain name I purchased from GoDaddy years ago (for fun and good luck mainly :P) By doing so I needed to change the namesever records to point to the ones used by InfinityFree/Epizy. Then I clicked on the "Free SSL certificates tab" which listed 4 steps:

1. Add CNAME records (which is done on the InfinityFree/Epizy side because of the nameserver change) This took a few hours to become effective. 

2. Request a new (free) SSL cert. Not sure how long it took between request and issue.

3. Install the new cert. This is done via copy-and-paste the key and the cert under the SSL/TLS in cPanel. 

4. Check for validity of your cert. You can use SSLShopper.com and simply type in your www.<domain name>

Any html you want it to serve can be uploaded via FTP or File Manager under the htdocs dir. For those who used Apache back in the days of course knows about htdocs. Nginx use the same dir too. The good thing is InfinityFree/Epizy created a new user for such purpose that is separated from your InfinityFree logon.  

The only downside of free SSL cert is that it usually expires soon. I setup reminder on the InfinityFree side for renewal. Let's see if that works. Anyway, I think it has done a good job already for such free services.

Thursday, August 06, 2020

My Clojure experience

 As I mentioned in this post, I found that Cursive IDE is the recommended way to go and that's what I tried. To be honest, the whole process is not exactly what I would call intuitive. I think the guides I mentioned in my previous post did a pretty good job. Let me summarize a few key features:

1) CursiveIDE is based on IntelliJ so the latter is the one you start. The type of project to add is Clojure->Leiningen (FYI, Leiningen is a build automation tool. I think the name comes from the short story "Leiningen Versus the Ants" Of course, ant refers to the "other" famous tool)


The project name must be all lowercase.

The IDE automatically creates a bunch of files for you. The most important one is probably project.clj. If your code requires importing external modules, you specify the dependency in this file. I found that the REPL that is already running would not "take in" the new dependency so the safest thing to do is to kill the existing REPL and start a new one.

2) The Right-click menu of project.clj has a choice to start your REPL. By default the namespace is <your project name>.core. In fact, Cursive also automatically creates a core.clj file for you.


3) If you want to have code in another <file name>.clj file, you add New Clojure Namespace with <file name>, the namespace would be <project name>.<file name>

4) You can load your current .clj file into the REPL using the right-click menu and then REPL.


5) However, Cursive does not switch namespace automatically. Use the same menu to switch. 

6) You can send a statement in your .clj file to the REPL for execution. Alternatively you can type the statement in the lower REPL window and hit ENTER after the closing ')' (or hit CTRL-ENTER)

BTW, this is the fun project I worked on: calculation of hours of sunlight based on the coordinates of the city and the date. 

Tuesday, July 14, 2020

停雲、陶淵明、辛棄疾

最近在玩師兄介紹的Elementary OS,他亦推薦其中一張寫著中文書法「停雲館」的Wallpaper,引發了一場關於「停雲」的討論。



首先找到的是辛棄疾詞《賀新郎·甚矣吾衰矣》,其中有一句:

一尊搔首東窗里。想淵明《停雲》詩就,此時風味。

詞中更出名那一句是:

我見青山多嫵媚,料青山見我應如是。

照字面解作詞人顯得相當有自信,其實根據上文下理自嘲成份較重。全詞充滿抗金壯志未能酬,志同道合之士日少的感慨。根據詞序,辛棄疾作詞時正獨坐於一個叫「停雲」的堂館,而停雲也是陶淵明一首詩的名稱,以下摘自網上文章:

《停雲》是晉宋之際詩人陶淵明的作品。此詩分四章,其主旨正如序中所言,“思親友也。”詩中運用比興的手法和覆沓的章法,通過對自然環境的烘托描寫,和不能與好友飲酒暢談的感慨,充分抒发了詩人對好友的深切思念之情。同時,詩中“八表同昏”“平路伊阻”“平陸成江”等詩句也暗含了作者對時世的擔憂。

可見情感和辛棄疾想表達的相當類似。之後辛棄疾亦諷刺當時想在酒中求名的文人(蘇東坡乎?)辛認為酒的真正「功能」是解愁罷了。

想對這兩首作品有更深入認識的朋友,建議參考文1,2,3

Wednesday, June 24, 2020

Elementary OS Cangjie input

作為電腦玩家,最興奮的事莫過於有新電腦用;不過換腦是數年一度的「盛事」,退而求其次就是拿舊電腦翻新。幾天前電腦界師兄推薦Elementary OS, 我的實驗用Linux box又剛好boot不起,正是裝新OS的好機會了。

玩了一會才有需要打中文,記得使用Ubuntu的話,這只是在System settings(-> Language -> Input Method加倉頡**)就可以攪定的簡單動作,不過在Elementary OS就試了大半小時也無功而還!結果找到這篇教裝FCITX的帖文 。不同的是我要裝倉頡Version 3:
sudo apt install fcitx-table-cangjie3 im-config

Reboot後還有一步(參考此帖文):
fcitx-configtool 
在此工具內加入Cangjie3,之後Ctrl-Space即可toggle英文和倉頡。(用慣Mac OS X的CapsLock作toggle會很不慣,但也沒辦法了,留意CapsLock時即使已選倉頡也打不到中文的)

註**:
以上方法是使用FCITX,另一個「老字號」系統是IBus,其實只改System settings的話,只差這一步就能用IBus的倉頡:
im-config
由default改為IBus



Tuesday, June 16, 2020

自古紅顏多薄命

標題這一句相信大家都聽過,但出處到底是那裏?首先提供一個錯的答案:蘇東坡有一首名為「薄命佳人」的詩:
雙頰凝酥發抹漆,眼光入簾珠的皪。 
故將白練作仙衣,不許紅膏汙天質。 
吳音嬌軟帶兒癡,無限閑愁總未知。 
自古佳人多命薄,閉門春盡楊花落。

根據這本《蘇東坡新傳》,此詩是描寫風塵界的美女,好景總是短暫。(至於我第一次見到此詩,是來自一本《蘇東坡》小說,當中虛構情節有東坡為其已出家為尼之情人寫下此詩)其實即使良家婦女,美貌又何嘗能長久保持呢?

標題那一句其實出自吳承恩名著,無人不識的小說《西遊記》,正正是孫悟空見到朱紫國皇后金聖娘娘後的感想:
自古紅顏多薄命,懨懨無語對東風

意思是自古以來美女的命運總是充滿不幸,令人唏噓感概。

Monday, June 08, 2020

Video editing and Animation

You don't have to try too hard if what you want to do all day long is watching videos on the web. Yes, we just take it for granted but it does take some skills to put together a presentable video! Editing home video is one of my hobbies started before the days of YouTube. I bought a copy of Adobe Creative Suite with my student discount when I was taking Graphic design classes. Adobe Premiere Pro is still one of the top choice for this task. Of course, 17 years have gone by one would think there must be lots of free/open source alternatives to Adobe Premiere. For those using Mac, PCWorld recommends iMovie 10. And there are many choices for Open Source cross-platform (i.e. Linux too!) software, for example, the UI of OpenShot would look familiar if you have used iMovie before.

Similar to video, animation is everywhere. You would remember Adobe Flash if you did animation "back in the days" In fact, some scammers still try to trick people to download malware disguised as Flash installer now that Adobe doesn't even call their animation tool Flash anymore. The company has adapted to the current HTML5-based standard (instead of needing a proprietary browser plug-in) and calling their tool simply Adobe Animation. If you cannot afford a license or just want to use other freeware, check out this video:



Tuesday, June 02, 2020

潮汕說唱

早前看網上直播有潮汕女主播在rap潮州話,方知有潮汕說唱的文化,除了女主播當日翻唱的Tizzy T,重要人物還有AFinger壹指團體(那是潮州版大懶堂了),以下是一條介紹潮汕hiphop的紀錄片:
葉子說到潮汕人祖先去馬來西亞謀生那段特別有feel, 我也從中認識了汕頭這個感覺上很親切但從未去過的地方。

Thursday, May 28, 2020

祇·祗·衹·袛

近幾年一直學習草書,有幾個字是比較欠缺標準,亦對名家寫法難以理解,其中一個是孫過庭書的:


在我收藏的集于右任字書唐詩有這個「底」字:



讀了劉東芹《草書字法解析》才明白以上兩字的寫法:
寫法明白之後,才再考究一下字義:p

孫過庭寫那個應該是「祇」,而草書的「衹」也是同樣寫法(要看上文下理), 知道「只是」有人有時會寫成「祇是」(示部那個),亦有「神祇」這個詞語。我以前見過有底下一畫的「祗」,原來也有「袛」這個字!

到底這四個字各有甚麼意思?請看咬文嚼字的博客的祇·祗·衹·袛一文。

Tuesday, May 19, 2020

The coolest museums in USA

This website has been sending junk mails to me for a few weeks but I finally found one articles I read there that is worthy of sharing. It introduces one cool museum per state in US. For a country with people who in general supports museums in their community (at least that is my impression), I can imagine there is gotta be one cool museum in each state. Still, it is a big task to know all of them! I haven't been to all 50 states myself. And for the states I visited, there are still lots of interesting museums that I am unaware of. For example, who would know there is a musical instrument museum in Phoenix? Speaking of musical instrument, I did have fond memories playing with some at the EMP museums in Seattle (of course not the Kurt Cobain guitars on display there) Now it has been renamed to the Museum of Pop Culture. Another music related museum on the list that I have been to is the Rock and Roll Hall of Fame in Cleveland, Ohio. 

Monday, May 11, 2020

When your cleat came loose from your bike shoe

... and it is clipped to the pedal, it would be a challenge to get it out. And it happened to me last week! Thanks to the video in this link, I was able to take it out, though not as easy as the dude in the video. Lesson learned: even after tightening your screws on the cleats multiple time and it still comes loose, it’s time to get a new cleat (and maybe shoes) In fact, I do have a pair of bike shoe with cleats that I have worn only a few times that I bought for my Big Island trip years ago. I was just too lazy to take them out of the box :p

Monday, May 04, 2020

爨寶子碑

作為書法愛好者,見到爨寶子碑如此奇特的字,當然會有興趣認識此碑,這位網友指出該碑有三大奇處:首先,文中提及大亨四年,其實晉安帝這個年號只用了三年!作者認為原因是爨將軍居於雲南離京城太遠,消息不靈通。其次,由曹魏至當時東晉,朝廷一直禁止立碑,爨家可能山高皇帝遠,所以無視禁令。最後,字體反映隸書「過渡到」楷書的演化,既非如隸書般扁形,卻又保留隸書的磔筆,實在罕見。有趣的是,此碑被發現後,學者才驚覺書聖王羲之的年代原來隸書才是主流,甚至開始懷疑古往今來第一行書蘭亭序是假的!

Monday, April 27, 2020

Nat King Cole的South of the Border

《國境之南,太陽之西》算是村上春樹最不奇幻的小說之一,當愛情小說讀也可以,書名前半是指South of the Border這首美國歌曲,很多著名歌手都唱過,不過書中提到的Nat King Cole版卻從未有過錄音,雖然Google有一個搜尋結果是YouTube 片,不過那是「造」出來的,那就不連結了, 另一位爵士歌手Fats Domino倒真是有錄音傳世,而純器樂版本我推薦Benny Goodman Big Band的。其實我一直誤會書名是指East of the Sun (and west of the moon) 這首我更喜歡的Jazz standard!