PicoBf: A brainf**k lang REPL environment for Pico Pi


I heard that Pico Pi @Raspberry_Pi only has MicroPython REPL at the moment, so I had some fun writing a brainf**k REPL in C++17 for Pico Pi XDDDDD (btw, the output image is also written in bf lang!)

The brainf**k interpreter is adapted from a previous project, you can find it in this post, Brainfuck Interpreter in C++17——A Modern Approach to Kill Your Brain.

Source code on GitHub, https://github.com/BlueCocoa/pico-bf

My Virtualization Setup

This post mainly demonstrates my personal virtualization setup. The configuration of my computer (along with some peripherals) is listed below.

  • AMD Ryzen 3900XT 12 cores 24 threads
  • 64GB DDR4
  • Samsung 860 Pro 512G NVMe
  • Intel 760p 2TB NVMe
  • NVIDIA RTX 3090
  • NVIDIA RTX 2070 Super
  • Dell TypeC-Ethernet Dongle

I tried to use unRAID to fulfil my purpose, but I could not do a PCIe passthrough for the Intel 760p drive because there were some glitches with the SM2271 controller. Also, the specific motherboard I used is kind of cheap, so there are only 2 m.2 sockets (x4.CPU + x4.Chipset) and 3 PCIe sockets. The layout is shown in the figure below.

As the manual says that PCIEX1 and PCEIX16_2 share bandwidth and the maximum bandwidth for PCEIX16_2 is PCIe [email protected] PCIEX16_1 can reach up to PCIe [email protected] So I'm going to plug in my RTX 3090 in PCIEX16_1 and plug in 2070 Super in PCIEX16_2. The PCIEX1 will not be used.

Then, of course, we need to switch on IOMMU in UEFI. This is part of what I get when I check the IOMMU grouping. There are literally a bunch of devices in IOMMU Group 15 (I guess that came from the B550M Chipset). But as you can see, the RTX 2070 Super GPU is one of the devices in IOMMU group 15. I cannot do PCIe passthrough for this GPU. (Next time I perhaps will buy a better motherboard and a better CPU with more PCIe lanes).

IOMMU Group 15:
 02:00.0 USB controller [0c03]: Advanced Micro Devices, Inc. [AMD] Device [1022:43ee]
 02:00.1 SATA controller [0106]: Advanced Micro Devices, Inc. [AMD] Device [1022:43eb]
 02:00.2 PCI bridge [0604]: Advanced Micro Devices, Inc. [AMD] Device [1022:43e9]
 03:00.0 PCI bridge [0604]: Advanced Micro Devices, Inc. [AMD] Device [1022:43ea]
 03:04.0 PCI bridge [0604]: Advanced Micro Devices, Inc. [AMD] Device [1022:43ea]
 03:08.0 PCI bridge [0604]: Advanced Micro Devices, Inc. [AMD] Device [1022:43ea]
 03:09.0 PCI bridge [0604]: Advanced Micro Devices, Inc. [AMD] Device [1022:43ea]
 04:00.0 VGA compatible controller [0300]: NVIDIA Corporation TU104 [GeForce RTX 2070 SUPER] [10de:1e84] (rev a1)
 04:00.1 Audio device [0403]: NVIDIA Corporation TU104 HD Audio Controller [10de:10f8] (rev a1)
 04:00.2 USB controller [0c03]: NVIDIA Corporation TU104 USB 3.1 Host Controller [10de:1ad8] (rev a1)
 04:00.3 Serial bus controller [0c80]: NVIDIA Corporation TU104 USB Type-C UCSI Controller [10de:1ad9] (rev a1)
 05:00.0 Non-Volatile memory controller [0108]: Samsung Electronics Co Ltd NVMe SSD Controller SM981/PM981/PM983 [144d:a808]
 06:00.0 Network controller [0280]: Intel Corporation Wi-Fi 6 AX200 [8086:2723] (rev 1a)
 07:00.0 Ethernet controller [0200]: Realtek Semiconductor Co., Ltd. RTL8125 2.5GbE Controller [10ec:8125] (rev 04) 

Alright, I cannot use unRAID or just passthrough my RTX 2070 Super. But it's not that bad. Because I only use Windows for games at my free time. I can just unbind RTX 3090 from nvidia kernel driver and bind it to the vfio-pci one if I want to use Windows, and vice-versa if I need to run Tensorflow or PyTorch. And most importantly, with unRAID, I need to shut down my Ubuntu, add/remove the RTX 3090 to/in it and then power it on. Now I can use my Ubuntu without interrupting.

Continue reading My Virtualization Setup


Last summer I had some fun with FiveYellowMice playing a doodle game. The game is quite simple, just 2 people both think of 3 different words and then draw whatever the first word the other one said to you. When the first round is done, swap your drawings and then draw the second word the other one thought. Finally, swap your drawings again and draw the last word you heard from the other one.

Here are some interesting doodles we drew.

Continue reading Doodles

Hardware UART communication between Raspberry Pi 4 and Arduino Micro

作りましょう 作りましょう


始めましょう 始めましょう


OK, let's start from communicating between Raspberry Pi 4 and Arduino Micro with hardware UART. For Raspberry Pi, GPIO pin 14 and 15 are the TX and RX pin of UART correspondingly.

1. Physical Connection

The first thing to note is that all GPIO pins on Raspberry Pi are 3.3v tolerance and Arduino Micro runs at 5v. If we connect Raspberry Pi with Arduino Micro directly, chances are that your Raspberry Pi can be damaged. Thus we need a bi-directional logic level converter.

But unfortunately, the one I brought came with separate headers that I needed to solder them onto the converter board by myself.

Well, the solder work may look just so so, but it works. That's what matters most. XD

The image below is my Arduino Micro and we can see that from right to left on the top bank, the third and fourth pin are the TX and RX pin.

Next, we need to connect them as the image demonstrates below.

Now we have done the physical part, time to move on to the software part.

Continue reading Hardware UART communication between Raspberry Pi 4 and Arduino Micro

unfold 2021

轉眼間 2020 就要過完了,前半年因為疫情幾乎都在家裡,後來 5 月去了上海,見到了一些人,離開了一些人;也有幸進到了一家金融領域公司,到了 9 月之後從公司離職去了目前所在的學校,現在轉瞬就到了選畢業論文題目的時間了。

說實話感覺 2020 過得很不真實,對於「自己的生活」幾乎沒有什麼特別的印象,一整年各種想法都被疫情所限制。大概整個讓我覺得有些許欣慰的只有幾件事吧~

Continue reading unfold 2021

OK Google, set Telegram as my YouTube music player!

To play music on YouTube in background on a mobile device requires YouTube Premium. Let's just set Telegram as our YouTube music player!

The idea is simple and straightforward. Firstly, apply a telegram bot and secure its token. Secondly, write a bot program that accepts one YouTube URL at a time from telegram user. Next, invoke youtube-dl to get the download URL of the best quality audio. Finally, send the downloaded audio file to corresponding telegram user.

The project is on my GitHub: https://github.com/BlueCocoa/youtube-music-bot

Continue reading OK Google, set Telegram as my YouTube music player!

Record YouTube Live Stream

最近不知不覺踩進了 hololive 這個兔子洞,其實真的蠻羨慕她們的,可以做自己喜歡的事,雖然其中也有不少人抱怨過休息的時間太少⋯⋯也許自己更羨慕的一點是可以有幾乎隨時一起嬉笑的朋友吧w

那麼雖然大多數 live stream 都會自動存檔,但是其中一部分 streamer 會選擇對某些直播不存檔,於是錯過直播的話,就只能等 clip 之類的了_(:3」∠)_ 因此就有了這個類似於電視錄影機一樣的想法~

项目放在了 GitHub 上 https://github.com/YouVCR/YouVCR~ 设置好 config.yaml 就可以使用了w

Continue reading Record YouTube Live Stream

可能隨時咕咕咕掉的 NLP 項目(1)—— 抓取 YouTube Live Chat

最近一邊想著畢業論文要寫什麼,一邊想著先做點有趣的東西~因為最近偶爾會看一下 YouTube 上烤肉 man 們剪輯的 hololive 的精華,所以暫且想要做個 NLP 相關的項目!不過倒不是自動翻譯這樣的功能,但具體是什麼自己還沒有完全想好(心裡有幾個點子,但是先寫出來又做不出來的話就太丟人了www),AAAAAAA~

那就總之先做一個抓取 YouTube Live Chat 的程式好了~其實小糾結了一下用什麼語言最方便,畢竟是抓取內容,而不是用 YouTube 官方的 API,所以也許 Python 是一個還不錯的選擇。

在寫這個工具的時候(2020 年 12 月 19 日,後文中的「目前」均指此日期),YouTube 上 Live Chat 回放的 API 是 https://www.youtube.com/live_chat_replay. 不過正如上面提到的,這個工具是直接爬取 Live Chat 的內容的,所以當你看到這篇博文的時候,很有可能 YouTube 已經更改了 API 或者內部的資料結構。

Continue reading 可能隨時咕咕咕掉的 NLP 項目(1)—— 抓取 YouTube Live Chat