Wessell's site logo Wessell's ☺️site

Tech Demo ☺️🧑‍💻

posted on 2024-05-08 🔸 updated on 2024-07-02 demo

This is just a little playground to test if I can get what I want to use for my blog working.

Twemoji 🗨🐦

I’ve set up Twemoji injection a long while ago, but here it is:

☺️:people_hugging:‼️

PS: I’ve also set up remark-emoji to make typing emoji less of a pain. 🫂 :people_hugging: doesn’t work right now and I’ll look into it when I’m free.

PPS: It’s caused by emojilib. There’s progress made by people far smarter than me done at Issue muan/emojilib#194 and Pull Request muan/emojilib#226 and it’s quite encouraging.

LaTeX ☝️🤓

Here’s the (in)famous Euler’s formula written using remark-math and rehype-katex.

ejθ=cosθ+jsinθe^{j \theta} = \cos \theta + j \sin \theta

PS on 2024-07-01: I’ve removed KaTeX CSS and opted to just use MathML with an increased font size. KaTeX’s CSS bundle is quite large and since I’d probably write very little math on this website, it’s best to keep it lightweight.

Syntax Highlighting 🖊️ & Image support 🖼️ (It’s there but I wanted to add some CSS)

Python code snippet with line numbers and highlighting 🐍

Here’s a code snippet I wrote for my assignment for EIE3331 Communication Fundamentals:

#!/usr/bin/env python3

from numpy import pi, cos, linspace
import matplotlib.pyplot as p

ABCD = 5227 # last four digits of student ID to be sent

t = linspace(start=0, stop=10**-4, num=10**4) # time range = [0, 10^-4]

f_c = 10**6 # carrier frequency 10^6 Hz

v_ct = 1000 * cos(2 * pi * f_c * t) # carrier signal v_c(t)

f_m = 10**4 # message frequency 10^4 Hz
mt = ABCD/1000 * cos(2 * pi * f_m * t) # message signal m(t)

v_at = mt * v_ct # DSB-SC signal v_a(t)

p.plot(t, v_at, color='k', linewidth=.5, clip_on=False)

p.ticklabel_format(style='scientific', axis='both', scilimits=(0,0), useMathText=True) # make the tick labels look less ugly
p.grid(visible=True, alpha=.5)
p.margins(0)

p.title('Waveform of DSB-SC signal $v_a(t)$ for $abcd = 5227$')
p.xlabel('$t$')
p.ylabel('Amplitude Level')

p.savefig('q1.eps', bbox_inches='tight')
p.savefig('dsb-sc.svg', bbox_inches='tight')
p.show()

A DSB-SC Waveform

Console output without line numbers 🐧

Here’s a console output without line numbers:

tim@x13 ~> echo ☺️🫂‼️ | cowsay
 _______
< ☺️🫂‼️ >
 -------
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||

Weather Cards 🏙️🌦️

I wrote some code to fetch weather data from the Hong Kong Observatory a while ago dynamically. Since this website ships no JavaScript to the client, it’s only rendered on the server and not updated client-side. Just keep that in mind.

PS on 2024-07-02: I originally planned to do this, but this would mean the website would no longer be statically generated, which is not something I would to forgo. Sad!

Jyutping 🇭🇰🗣️

Some Jyutping injection! No JavaScript needed! Powered by @CanCLID/to-jyutping.

tai2dak1ming4ge3waa2tung4ngo5gong2☺️‼️la1

sik1ze2📆zong1zau1👴mung6💭wai4wu4dip6🦋heoi2heoi2jin4wu4dip6🦋jaa5bat1zi1🤷zau1👴jaa5ngo4jin4gaau3😲zak1keoi4keoi4jin4🥴zau1jaa5👴bat1zi1🤷zau1👴zi1mung6💭wai4wu4dip6🦋jyu5wu4dip6🦋zi1mung6💭wai4zau1👴jyu5

Note that the result is not perfect. For example, 與 was rendered as jyu5, but which should have been jyu4 in the literary/archaic sense.