Showing posts with label tech. Show all posts
Showing posts with label tech. Show all posts

Wednesday, September 29, 2021

Fixing Ubuntu with kernel 5.11

I previously mentioned the kernel 5.11 image was completely unusable. Well, these 2 were definitely missing and I need to install manually:
sudo apt-get install linux-headers-5.11.0-36-generic
sudo apt-get install linux-modules-extra-5.11.0-36-generic
The above took care of the networking unavailable issue for me. 

Now to get the display working with proper resolutions (no 640x480 please!)
sudo apt purge nvidia* libnvidia*
This removed my previously manually installed Nvidia display driver and after reboot it shows clearly it uses the X.Org open source driver instead of "Continue using a manually uninstalled driver" 


I hope this becomes stable for another few months. Keeping my fingers crossed.

Credits go to: Nvidia's official website (the post for fixing nvidia-smi >> Failed to initialize NVML: Driver/library version mismatch) 
This seems useful for installing Nvidia driver but I did not need to follow it. 

Ubuntu and GRUB default image

My Manjaro experiment has kinda failed because it would hang from time to time. Well, with Linux you always have workarounds, in this case, use the most "mainstream" distro: Ubuntu. I actually use a less resource intensive variant of Ubuntu called Ubuntu Mate. However, one of the updates must have broken compatibility with some existing drivers (e.g. NVIDIA Driver Version: 390.138) and I ended up always going back to the oldest kernel image which I choose manually from the Boot menu of GRUB. This is the guide to change the default so no more manual intervention is needed! (BTW, I was so worried that the Wifi driver is broken for some reason even in that image. It turns out the Wifi-disabled issue went away after hitting the "hardware" Wifi button on my machine a few times. Whew!)

Friday, March 05, 2021

CD Ripper for Ubuntu

When was the last time you need to rip tracks from CD? For me, I needed to rip a half-dozen of CDs in the past month. My only computer that still have a builtin CD-ROM drive runs Linux (Ubuntu.) It actually comes with RhythmBox that has the capability to rip (and play, of course) However, its default CD info database is MusicBrainz, which has trouble recognizing quite a few of my CDs. It does have a CDDB plugin (which I am too lazy to figure out how to install) Then I installed RipperX but got an error 22. Finally, I found that fre:ac works! And it came as a ApplImage so I didn't have to install anything. And it rips quicker than RhythmBox anyway. So, we have a winner! 

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

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. 

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



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:



Thursday, April 16, 2020

Canon MX880 Scanner ADF 黑線問題已解決

這部Printer/Scanner已用了很多年,今天有一疊樂譜要掃描備份,從document feeder放進,發覺掃描出來的文件有一條黑色直線,但用Flatbed去掃描則無此問題!原來兩者分別用兩塊不同的「玻璃」。後者是大那塊,前者則是左方那狹窄長條;我用抹眼鏡布(輕微弄濕)了狂抹那長條及四邊接著膠片的位置,第一次清潔後發現黑線變幼,再清潔一次就解決了問題,希望此帖對其他用家有所幫助。

Monday, January 20, 2020

Functional programming with Clojure

I took a course on Scala for Data Science. It is a very cool language with lots of non-trivial features. And you can do functional programming with it, which reminded me of another cool language, my old friend LISP! Of course, their popularity these days are not comparable. Even after Scala dropped out of Top 20 (see this article for details), it is still way ahead of LISP. However, one "dialect" of LISP, Clojure, is still getting quite a bit of attentions. Here is a guide on basic web dev with Clojure. And I found some pointers to hosting such app on the web (with low cost.) The IDE I use is Cursive (user guide) and this csv library is an example of the code that the community has contributed. Check out this post about a pet project done with ClojureScript on front end and Clojure on back end! 

Tuesday, January 07, 2020

電腦中文字體

我想我也算是早期中文電腦使用者,中學年代用過DOS上的「外掛」系統,大學時代會在Unix裝中文字體,用瀏覽器看中文網站,那時要手動選character encoding呢,今時今日大家看我這個中文帖無需任何額外設定,和當年差太遠了。接觸過中文字體的朋友,相信都會聽過所謂宋體和明體,後者又以細明體(MingLiu)最有代表性。直到今天讀了此文才明白宋體明體的由來:中港台稱為宋體的字其實源自明朝,明代刻書工匠就是用這種字體,他們以為自己的字體源自宋朝,但其實宋朝刻書字體是學歐顏柳的楷書,康熙一錘定音稱之為宋體,日本人則正名為明體;後人仿「真宋朝」造出的字體就是所謂「仿宋體」了。

在這幾套「主流」字體之外,設計師會選擇的字體更多姿多彩了,早一陣子朋友派對菜單就用了「凌慧體」,範例:
這是一套手寫出來的字體,相信大家也會覺得很接近。

在搜尋此字體來歷時發現此文,雖然讀完也不知名字中那位凌慧其實是那一位,但就喜歡了文中提到的「囍宴體」,範例:

Tuesday, May 21, 2019

WhatsApp Stickers

看完2019版倚天實在太沉迷了,從此帖找到以下WhatsApp stickers
敏敏1:https://whatsticker.online/p/161842McomUyB/HK
敏敏2:https://whatsticker.online/p/16269930dMmZX/US/zh
芷若:https://whatsticker.online/p/161859EdMi7Bw/US/zh
並根據此文學了自製WhatsApp stickers! 如果已有PNG格式的檔案,基本上只需下載一個app: 'Personal Stickers for WhatsApp' 在使用此app時建議先把特別要來做stickers的PNG檔放在同一檔案夾,在加進WhatsApp時只加這組stickers就可以摒除不想要的圖了。

Monday, March 18, 2019

Suunto watch

I have been a long-time Garmin user who has spent several years on Vivoactive and Forerunner tracking my biking and hiking activities (some running and swimming too) I can't say I am a big fan: the sync mechanism is not always reliable. Need 3rd party app (dwMap) for GPS navigation on the Vivoactive and it kills the battery fast (no more than 5 hours) My original Garmin HR belt that came with the Forerunner died finally so I figured it's time to try out a wrist-based HR fitness watch and I decided to go with Suunto this time. It is known for its long battery life and somewhat accurate wrist HR (with the slimmer Spartan Trainer model)

Obviously there is a huge learning curve when it comes to switching brand, which I can still handle for now (not sure about several years down the road :P) Here were a few things I ran into during the first week of using it:
1) The software running on the watch itself requires update right away. Otherwise it won't sync with the Suunto App on your phone via Bluetooth.
And the way to update is via a piece of software called SuuntoLink on your PC/Mac (and the USB cable) SuuntoLink syncs to Suunto's own portal: Movescount.com.
The odd thing is that Suunto App and Movescount use separate login!
And the latter is supposed to be obsoleted by the development of the former so they are NOT entirely compatible (see the point about sports mode later.)
Sounds complicated? Oh well.

2) I previously paired a Wahoo RPM Cadence sensor to my Garmin via ANT+. This Suunto watch does not support ANT+. Fortunately the Wahoo also works with Bluetooth. On the Suunto this is under Bluetooth and "Bike POD"

3) It can display the moonphase on one of the watch face. I am obsessed with this feature even though I have absolutely no use for it.

4) I had a whole bunch of my own routes saved on MapMyFitness. And I rely on it to search for interesting routes done by others. It's relatively easy to sync those routes to my watch. I just need to export the route in the GPX or KML format and then import to Movescount and sync the watch via my PC.
This link explains GPX vs KML

5) I got WhatsApp notification displayed on my Suunto ONCE (oh yeah, it can display Chinese unlike the Garmin) but no more.
I think it has to do with running the app in background but too much trouble to figure it out.
I gave up on this feature for now.

6) Even after I paired my Wahoo RPM Cadence sensor as a Bike POD on the Suunto via Bluetooth, the cadence is not shown while riding with both existing biking "sports mode". After sync-ing the exercises to the phone, the cadence is not shown in the app either. Turns out only Movescount.com shows it. However, one can create a brand new Sports mode and customize the fields displayed on the watch. So I created a "custom biking" mode with several screens of cadence and other stuff I care (like the current time! I haven't figure out how to see the current time while using a "sports mode" to record my exercise yet) It is capable of showing more fields than my old Garmins for sure.
However, I do need to warn that once you created Sports mode on your Suunto App on your phone, you cannot create Sports mode on Movescount anymore. I am not ready to give up this yet (I am an old schooler who prefers using computers to phones)

7) The biggest selling point to me is the long battery life while using the watch's GPS for navigation. Of course that's one of the first feature I tried! I found there are 2 ways to get into the navigation "mode": simply choosing navigation from the main menu (this will NOT record your exercise). Alternatively, while recording your exercise (say with the "custom biking" sports mode), one of the automatically displayed screen is the navigation screen, which has a menu that you can open using the bottom right button. You can choose an existing route using the menu option.
This is a route I uploaded and rode:

Compared to the Vivoactive and the Forerunner, the Suunto Spartan Trainer certainly looks cooler (less dorky) The UI is intuitive enough (once I got used to it since it's very different from Garmin) I need to do a really long ride to test its navigation capability. So stay tuned for my next review.


Monday, November 19, 2018

How China works?

今天無意中看了探索頻道這個節目的一集"Network Nation",老實說,作為矽谷IT人的我對中國大陸科網發展的認識不算深,這個節目真令我大開眼界。節目中提到福州一家NetDragon以網上遊戲起家,掌舵人眼光遠大把業務擴展,應用全息視像技術(hologram)於教育,例如把霍金「帶到」四家國內大學演講。另一項更令人驚嘆的,是靠著貼在腦袋的感應器探測並解讀腦電波的技術,中風的病人可經腦電波控制電極從而令已癱瘓的半身活動!節目又介紹了國內把無人機應用在農地勘察以至耕作,絕不是航拍過癮玩玩而已。當然也有應用在玩樂的科技,就是虛擬現實,我想比北美更為普及。最後想提的是國內網上直播內容的多樣化,節目中介紹了果殻網直播科學實驗的解說,可見在中國對這類題材深感興趣的民眾實在不少。

Wednesday, October 10, 2018

Home data center

My coworker presented his latest project and described the data center setup. I cannot understand most of the equipments he planned to use but I was thinking it would be (figuratively) cool (and nerdy) to have a rack at home. I think most homes can use some reliable network storage. Check out some guys' setup.