01 November 2025

cssUniversal.html

<style>
    body {
        margin: 0;
        background-color: rgba(0, 0, 0, 0.09);
        color: rgba(0, 0, 0, 0.6);
        font-family: sans-serif;
    }

    div.container {
        display: flex;
        justify-content: center;
        min-height: 100vh;
        padding: 1rem;
    }

    div.card {
        background-color: rgba(255, 255, 255, 1);
        max-width: 585px;
        width: 100%;
        box-shadow:
            0 4px 8px 0 rgba(0, 0, 0, 0.2),
            0 6px 20px 0 rgba(0, 0, 0, 0.19);
        padding: 1rem;
        border-radius: 4px;
    }

    h1,
    h2,
    h3 {
        margin: 1.5rem 0 0.75rem 0;
    }

    div.card {
        padding-bottom: 3rem;
    }

    .contact {
        text-align: center;
    }

    table {
        font-family: Arial, Helvetica, sans-serif;
        border-collapse: collapse;
        width: 100%;
    }
    
    td, th {
        border: 1px solid #ddd;
        padding: 8px;
    }
    
    tr:nth-child(even){background-color: #f2f2f2;}
    
    tr:hover {background-color: #ddd;}
    
    th {
        padding-top: 12px;
        padding-bottom: 12px;
        text-align: left;
        background-color: #04AA6D;
        color: white;
    }

    @media print {
        body {
            background: white !important;
        }

        .container {
            display: block;
            min-height: auto;
            padding: 0;
            margin: 0;
        }

        .card {
            box-shadow: none !important;
            border: none;
            background: white !important;
            max-width: 100%;
            padding: 1in;
        }

        body, p, li, h1, h2, h3 {
            color: black; !important;
            font-family: "Arial", sans-serif;
        }

        nav, footer, .no-print {
            display: none !important;
        }

        a {
            color: black;
            text-decoration: none;
        }
    }
</style>

<body>
    <div class="container">
        <div class="card">
            <div class="contact">...</div>
            ...
        </div>
    </div>
</body>

28 October 2025

Beautiful Letter with Shadow

<style>
    body {
        margin: 0;
        background-color: rgba(0, 0, 0, 0.09);
        color: rgba(0, 0, 0, 0.6);
        font-family: sans-serif;
    }

    div.container {
        display: flex;
        justify-content: center;
        min-height: 100vh;
        padding: 1rem;
    }

    div.card {
        background-color: rgba(255, 255, 255, 1);
        max-width: 585px;
        width: 100%;
        box-shadow:
            0 4px 8px 0 rgba(0, 0, 0, 0.2),
            0 6px 20px 0 rgba(0, 0, 0, 0.19);
        padding: 1rem;
        border-radius: 4px;
    }

    h1,
    h2,
    h3 {
        margin: 1.5rem 0 0 0;
    }

    div.card {
        padding-bottom: 3rem;
    }

    .contact {
        text-align: center;
    }

    @media print {
        body {
            background: white !important;
        }

        .container {
            display: block;
            min-height: auto;
            padding: 0;
            margin: 0;
        }

        .card {
            box-shadow: none !important;
            border: none;
            background: white !important;
            max-width: 100%;
            padding: 1in;
        }

        body, p, li, h1, h2, h3 {
            color: black; !important;
            font-family: "Arial", sans-serif;
        }

        nav, footer, .no-print {
            display: none !important;
        }

        a {
            color: black;
            text-decoration: none;
        }
    }
</style>

<body>
    <div class="container">
        <div class="card">
            <div class="contact">...</div>
            ...
        </div>
    </div>
</body>

21 October 2025

'Job systemd-networkd-wait-online.service/start running' takes a long time

The following method worked for me -
$ ip add

Find the name of your network interface, e.g. wlp3s0

Open the file -

$ sudo systemctl disable systemd-networkd-wait-online.service

or 

$ sudo vi /usr/lib/systemd/system/systemd-networkd-wait-online.service

Edit the line -

ExecStart=/usr/lib/systemd/systemd-networkd-wait-online

into -

ExecStart=/usr/lib/systemd/systemd-networkd-wait-online --interface=wlp3s0

Then run the command below -

$ sudo systemctl daemon-reload

Reboot your computer.


08 September 2025

How to Transform or Say Convert Different Format of Files Such as .md, .rst, .html, .docx, .pdf, etc.?

Install 'pandoc' software

How to install pandoc?

$ sudo apt update
$ sudo apt install pandoc

 

How to use pandoc?

$ tldr pandoc 

How to Install and Use Prettier on Ubuntu?

# npm install -g prettier
 
How to make html and css and javaScript files
prettier?
 
$ prettier --write --tab-width 4 test.html 

01 September 2025

It always asks for Recovery Key when I boot to Windows, after I set up dual boot (Windows + Ubuntu)

1. To boot into Windows 

Press F12 to enter boot menu. Choose Windows.

 

2. To boot into Ubuntu

(1) Do NOT press F12. Simply wait, and choose 'Ubuntu'. 

Explanation: To boot into Windows, use Windows Boot Manager; to boot into Ubuntu, use GRUB. 

(2) Press F12 to enter boot menu. Choose Ubuntu.

How to extract texts from an image on ubuntu?

To extract English texts - 
$ sudo apt install tesseract-ocr
$ tesseract your_image_name.png extracted_text.txt 

 

To extract Simplified Chinese texts -

$ sudo apt install tesseract-ocr tesseract-ocr-chi-sim

$ tesseract your_image.tiff output_text.txt -l chi_sim

 

To extract Traditional Chinese texts -

$ sudo apt install tesseract-ocr tesseract-ocr-chi-tra

$ tesseract your_image.tiff output_text.txt -l chi_tra

 

To extract multiple languages, e.g. English and Simplified Chinese, and Traditional Chinese texts -

$ tesseract your_image.tiff output_text.txt -l eng+chi_sim+chi_tra

28 August 2025

Can not Print Documents from MS OneDrive on MacBooks to Sharp Printers

(On the screen of the physical printer, enable 'MS OneDrive'.)

On user's MacBook. Open a document from MS OneDrive. File > Print.

'More Settings' > 'Printe using system dialog' > 'Printer Options' > 'Job Handling' > 'Authentication' > 'User Number'. Re-enter your password. (Password for cloud and password for local are different)

'More Settings' > 'Print Using System Dialog' > 'Presets'. Choose 'SharpBP70C45 1'. 'Save Current Settings as Preset...'.

... 'Presets' > 'Edit Preset List...'. Select 'SharpBP70C45' > '-' > 'OK'.

27 August 2025

Can not print black and white on MacBook to Sharp BP-70C45 multi-function printer

Normally, in 'Printer Options', there are 6 options, including 'Image Quality'. In 'Image Quality', there are 3 options - 'Automatic', 'Colour', and 'Black and White'.

If there are only 2 options (or fewer than 6 options) in 'Printer Options', and there is not 'Image Quality' option, 

Choose Apple menu > System Settings, then click Printers & Scanners in the sidebar. (You may have to scroll down.)

Click the printer in the Printers list on the right, click the Options & Supplies button, select (or de-select) the Use Generic Printer Features checkbox, then click OK.

05 March 2025

How To Search And Replace String Across Multiple Files in Vim

https://irian.to/blogs/how-to-search-and-replace-string-across-multiple-files-in-vim

 

Perform substitution with macros and repeat it

While recording a macro, perform substitution on one file, and repeat the macros across all args.

Assuming the same folder structure and args, here is how it is done:

qq                                          // start macro in q register
%s/stringToBeReplaced/replacementString/ge  // the e flag tells vim to not throw an error if there is no match
:wnext                                      //important. This is similar to `:next`, but it also writes the current file
q                                           // stop macro
999@q                                       //repeat this macros either 999 times or to remaining files.

That's it!