Nota Rawak

nota segera seakan-seakan Wiki

  1. ScreenCast

    Screencast the desktop with either [1] RecordMyDesktop or [2] FFmpeg:-
    • RecordMyDesktop

      Run the below command for fullscreen desktop recording:-
      recordmydesktop --no-sound

      Sound/audio should also be able to be recorded however, I could not find any solution to the ‘Broken pipe: Overrun occurred.’ issue when running screencasting with ALSA enabled. I am only left with the --no-sound option, producing a silent video which is saved as [3] out.ogv by default.

      Sound/audio can be enabled with [4] JACK.

      recordmydesktop --use-jack system:capture_1 --v_bitrate 2000000

    • FFmpeg

      FFmpeg in accordance to its [homepage] is a complete, cross-platform solution to record, convert and stream audio and video. It includes libavcodec - the leading audio/video codec library.

      1. Record the Desktop

        With Audio enabled. Run the following command:-
        ffmpeg -f x11grab -s 1366x768 -i $DISPLAY -f alsa -i default -c:v libx264 out.mp4
        For a silent video, run the following command:-
        ffmpeg -f x11grab -s 1366x768 -i $DISPLAY -c:v libx264 out.mp4
      2. Convert .ogv to .mp4

        To convert an .ogv file (desktop recording using RecordMyDesktop), run the following command:-
        ffmpeg -i out.ogv out.mp4
      3. Convert .mp4 to .webm
        ffmpeg -i out.mp4 -c:v libvpx -qmin 0 -qmax 50 -crf 5 -b:v 1M -c:a libvorbis out.webm
      4. Video Cutting

        Run command as follows:-
        ffmpeg -i out.mp4 -ss 0001 -t 0000 out1.mp4

        -ss: The start time of the video
        -t: The time where the video should end

  2. JACK

    I use a GUI app to activate JACK because it is easier to manage (start and stop the process) and it allows me to play multiple sounds via the default ALSA configuration I initially have by stopping jackd.

    Packages I installed thus are:-

    1. jack2;
    2. alsa-plugins; &
    3. qjackctl (the GUI app).

    • Starting and Stopping JACK with qjackctl

      1. From the 'Setup' option:
      2. Click 'Start' and monitor progresses through 'Connections' and 'Messages' (for logs) options. If everything is fine, recording the desktop should now work with RecordMyDesktop app running for pro-audio video tutorials;
      3. When jack is no longer needed to run, simply clik 'Stop' and the default ALSA config will now take place (able to play videos from browsers, Youtube etc).
    KHUSUS UNTUK RAKAMAN BERSAMA CIRI AUDIO: Sila rujuk kepada pos [Rekod Paparan Muka Bersama Audio].
  3. Insert Font Awesome/Unicode Characters into Neovim & URxvt

    1. Install the font from [AUR: ttf-font-awesome] or [its official website];
    2. By referring to the [Cheatsheet], run the following:-
      • in vim/nvim (while in insert mode): Press 'Ctrl+v, uf004';
      • in URxvt: while holding 'Ctrl+Shift', type f004.
    Please note that the method to key in unicode characters in URxvt will not work if keycap picture insert mode is disactivated/disabled with URxvt.iso14755 & URxvt.iso14755_52 configured in .Xresources file.

    Reference: Iconic fonts in the status bar
  4. Combining/Merging Pictures with [ImageMagick]

    • Left-to-Right:
      convert +append -background black image1.jpg image2.jpg output.jpg
    • Top-to-Bottom:
      convert -append -background black image1.jpg image2.jpg output.jpg
    • EXAMPLE of merging photos with borders and centered position:-
      convert +append -background black -border 1 -bordercolor white -gravity center image1.jpg image2.jpg output.jpg
  5. Convert A .txt File to PDF with Enscript & GhostScript

    1. First of all, convert a .txt file to .ps with [5] enscript by running the following command:-
      enscript -p input.txt
    2. And then convert the .ps file to .pdf with [6] GhostScript:-
      ps2pdf output.pdf
    Reference: How to convert a text file to PDF format on Linux
  6. Hide/Show Elements with Jquery

    Provided below are the codes with a demonstration:-
    <script type="text/javascript">
    function hideshow(which){
    if (!document.getElementById)
    if ("block")"none"
    <div class="hideshow-demo">
    <center><b>Demo</b> <a href="javascript:hideshow(document.getElementById('demo'))" style="font-size:82.5%">[Hide/Show]</a></center>
    <div id="demo" style="display: block">
    <li style="margin-top:.5em">Content-1</li>
    .hideshow-demo {
        margin-top: 1.5em;
        width: auto;
        display: inline-block;
        font-size: 87.5%;
        border: 1px solid #ccc;
        background: #072024;
        padding: .5em;
        border-radius: 3px;
    Demo [Hide/Show]

    1. Content-1
    2. Content-2

    Reference: Hiding/showing elements
  7. Properly Disconnect & Reconnect to WiFi with wpa_supplicant

    This is somehow a primitive method for connecting to a wireless network but I just prefer doing it this way.
    • Connect to A Different Network

      To disconnect from current connection and connect to a different network, disconnect properly by:
      1. Setting the wireless device down first:
        sudo ip link set dev wlp2s0 down
      2. Releasing dhcpcd (otherwise, the initial DHCP client daemon lease will keep running in background. As such, we will encounter an error when connecting to a different network):
        sudo dhcpcd -k wlp2s0
      3. Totally kill the wpa_supplicant process (this step is important to prevent any issues later):
        sudo killall wpa_supplicant
      4. Setting the device up again:
        sudo ip link set dev wlp2s0 up
      5. Connecting to a different network by running wpa_supplicant command with the path to the new network config file:
        sudo wpa_supplicant -B -i wlp2s0 -c /etc/wpa_supplicant/wpa_supplicant.conf
      6. And lastly, restarting dhcpcd:
        sudo dhcpcd wlp2s0
      Provided below is an example of a valid wpa_supplicant.conf file:-
    • Reconnect to The Same Network

      If there is a need to disconnect from current connection and later we need to reconnect to the same network, just run the below commands:

      1. Disconnect:
        sudo ip link set dev wlp2s0 down
      2. Reconnect:
        sudo ip link set dev wlp2s0 up
      Since DHCP client daemon lease has been running in background and we are reconnecting to the same network, there is no need to release / restart dhcpcd.

    Reference: dhcpcd from archwiki

  8. Displaying Codes Behind A Symbol In Pygments

    The good thing about syntax highlighting with Pygments is that we do not have to use HTML Escape in order to display a character/symbol in our codes.
    However, I believe that there may be times when we need to present the code behind such character/symbol in our highlighted codes. So, here is the tip to have this purpose done:
    Let’s say we need to have this ‘’ character code shown in our highlighted codes. All we need to do is to replace the <&> symbol with its HTML escape which is <&amp;>. In this case, the code behind the symbol used in this example is <&#8984;>. So in our code writing, we should type it this way; <&amp;#8984;>.
  9. Install Hugo from Source

    Since I am not developing any program with go, I prefer the binary installation. I am keeping this note as a reference only.

    The required packages are:-

    Add 'export PATH and GOPATH' into the shell config file, in my case it is .zshrc:
    export PATH="$HOME/go/bin"
    export GOPATH="$HOME/go"

    The installation processes are:-

    go get
    govendor get
    go get -v

    The final executable hugo will be found resided in $HOME/go/bin folder.

    Sila rujuk kepada pautan berikut:-
    Install Hugo > Source
  10. Vim, Vimtex and Zathura

    Related post: Vimtex and Zathura

    As I decided to have Vim back as the default editor, some things need to be done in order for synctex search to work.

    • open .tex file with the below command:-
      vim --servername VIM
    • OR place this line in .zshrc file:-
      alias vim="vim --servername VIM"
    • Also, to make it work when opening .tex files from ranger, add this line to the .config/ranger/rifle.conf file:-

    Additional Notes
    • The additional configuration above is not needed for gvim as it works out of the box.
    • The compiled .tex document has to be closed first and reopened in order to clean auxiliary files with '\lC' key mapping.

    Reference: Synctex with Zathura (linux, easy)

  11. Multiple SSH Key Pairs Generation

    I need to create two SSH key pairs for projects hosted in GitLab:-

    Explained below are the steps taken to generate those keys:-

    With a passphrase
    1. Generate the key:-
      ssh-keygen -t rsa -C "" -b 4096
      and enter a passphrase when prompted.
    2. Save it in e.g. ~/.ssh/id_rsa file (default).
    3. Then, run the following commands:-
      eval $(ssh-agent -s)

      ssh-add ~/.ssh/id_rsa
    Without a passphrase
    1. Generate the key:-
      ssh-keygen -t rsa -C "" -b 4096
      and press Return or Enter without keying in any passphrase when prompted.
    2. Save it in e.g. ~/.ssh/id_rsa_theme file.
    3. Repeat step number iii above. Replace ssh-add ~/.ssh/id_rsa with:-
      ssh-add ~/.ssh/id_rsa_theme

    Retain the above settings in a configuration file saved as ~/.ssh/config

    # server
    RSAAuthentication yes
    IdentityFile ~/.ssh/id_rsa
    # server
    RSAAuthentication yes
    IdentityFile ~/.ssh/id_rsa_theme

    Reference: Working with non-default SSH key pair paths

    KAEDAH YANG LEBIH BAIK DICEDOK DARI [Using Multiple SSH Keys with Github]

    1. Jana kekunci SSH seperti contoh di bawah:-
      - untuk repositori
      ssh-keygen -f ~/.ssh/
      - untuk repositori (web):
      ssh-keygen -f ~/.ssh/id_rsa.web
    2. Daripada kekunci SSH yang telah dicipta di atas, buat satu fail konfigurasi yang disimpan sebagai ~/.ssh/config dan mengandungi butiran-butiran seperti berikut:-
      # account for the blog repo on github
          User saya
          IdentitiesOnly yes
          IdentityFile ~/.ssh/
      # account for the web repo on github
          User saya
          IdentitiesOnly yes
          IdentityFile ~/.ssh/id_rsa.web
    3. Sunting parameter URL di bahagian [remote “origin”] yang terkandung di dalam fail tempatan .git/config, sebagai contoh daripada tetapan di atas:-
      url =
      url =

      Beri perhatian kepada alias hos nama -blog dan -web yang ada pada fail ~/.ssh/config serta .git/config. Lihat juga pada bahagian IdentitiesOnly yes yang terkandung di dalam fail ~/.ssh/config. Baris ini adalah amat penting dalam memastikan bahawa SSH benar-benar menggunakan Fail Identiti seperti yang telah dinyatakan mengikut bahagian masing-masing.

    Kaedah ini juga berfungsi untuk GitLab.
  12. Additional Config for Ranger Files

      class empty(Command):
          Empties the trash directory ~/.Trash
          def execute(self):
    "sudo rm -rf /home/raihan/.Trash/.*")
    "sudo rm -rf /home/raihan/.Trash/*")
    • rc.conf
      map DD shell mv -t /home/raihan/.Trash %s
    • rifle.conf
      # Personal Settings
      #ext mp4|mpeg|avi|flv,       has mpv,      X, flag f = mpv --fs -- "$@"
      ext mp4|mpeg|avi|flv,       has mpv,      X, flag f = mpv -- "$@"
      ext 7z|ace|ar|arc|bz2?|cab|cpio|cpt|deb|dgc|dmg|gz,  has 7z = 7z x -oarchives -- "$@"
      ext iso|jar|msi|pkg|rar|shar|tar|tgz|xar|xpi|xz|zip, has 7z = 7z x -oarchives -- "$@"
      #ext x?html?, has firefox,        X, flag f = firefox -- "$@"
      ext tex, has vim = vim --servername VIM "$@"
  13. Packages To Be Installed for Complete Function of Fcitx

    Fcitx packages that allow full function to applications such as Vim / NeoVim, LibreOffice and Chromium for different language inputs e.g. Japanese:-
  14. Completely Kill A Process/Program

    • To kill a process e.g. cmus, find out the pid number with the following command first:-
      pidof cmus
    • And then kill it by running the below command:-
      kill <the-pid-number-obtained-by-the-above-command>
  15. Grub2 Menuentry for Chainloading FreeBSD-UEFI

    menuentry 'FreeBSD 11.1' {
        insmod ufs2
        set root=(hd0,gpt10)
        chainloader /boot/boot1.efi

    Reference: fighting with grub2

  16. Penukaran Penyusun untuk Latexmk

    Untuk penggunaan meluas bahasa asing lain seperti bahasa Arab, Jepun dan Korea dalam penghasilan dokumen dengan LaTeX, hamba tukarkan penyusun pdflatex kepada xelatex.

    Hamba tambahkan baris-baris di bawah ke dalam fail konfigurasi .vimrc.local (untuk ‘plugin’ vimtex):-

    let &rtp  = '~/.vim/bundle/vimtex,' . &rtp
    let &rtp .= ',~/.vim/bundle/vimtex/after'

    Dan kemudiannya hamba kemas kini fail-fail konfigurasi yang berikut:-

    • Fail .vimrc.local
      Baris <let g:vimtex_latexmk_options=“-pdf -pdflatex=‘pdflatex -file-line-error -shell-escape -synctex=1’”> ditukarkan kepada:
      let g:vimtex_latexmk_options="-pdf -pdflatex='xelatex -file-line-error -synctex=1 -interaction=nonstopmode -shell-escape %S %O -verbose'"
    • Fail .latexmkrc
      Baris <$pdflatex = ‘pdflatex -file-line-error -synctex=1 -interaction=nonstopmode -shell-escape %O %S’;> digantikan kepada:
      $pdflatex = 'xelatex -file-line-error -synctex=1 -interaction=nonstopmode -shell-escape %S %O -verbose';

    Rujukan: latexmk compile fail with xelatex

  17. Perubahan Hari Kepada Kalendar Hijrah

    Ada masanya hari pada Kalendar Hijrah akan berubah kerana pengiraan dibuat berdasarkan kemunculan bulan atau dalam istilah Inggerisnya dipanggil ‘lunar calendar’. Jadi akan ada keperluan untuk menyunting dua fail ini; satu untuk dipamerkan pada [i] conky dengan konfigurasi dalam bahasa python dan satu lagi untuk dipamerkan di weblog ini melalui [ii] skripjava.

    1. Suntingan pada fail dari pakej umalqurra:-
    2. Suntingan pada fail moment-hijri.js:-
  18. Mengatasi Kegagalan Git Ketika Menambah Submodule

    Saya terima ralat ketika cuba menambah submodule public untuk git melalui baris perintah berikut, ie.:-
    git submodule add -b master public
    Ralat yang diterima adalah:-
    Cloning into '/home/saya/hugo/blog/public'...
    Enter passphrase for key '/home/saya/.ssh/id_rsa.web': 
    warning: You appear to have cloned an empty repository.
    fatal: 'origin/master' is not a commit and a branch 'master' cannot be created from it
    Unable to checkout submodule 'public'

    Jadi saya berjaya selesaikan masalah ini melalui pembacaan di [halaman ini].

    Langkah-langkah yang perlu dibuat adalah:-

    1. Periksa sekiranya origin ada ditetapkan dengan menjalankan baris perintah seperti di bawah:-
      git remote -v
      Jika tiada apa-apa input yang keluar, tinggalkan langkah kedua dan teruskan dengan langkah ketiga diikuti langkah-langkah berikutnya.
      Jika mendapat keputusan seperti ini,
      origin (fetch)
      origin (push)
      teruskan dengan langkah kedua sehingga akhir.
    2. Singkirkan tetapan remote yang lama dengan baris perintah berikut:-
      git remote remove origin
    3. Kemudian bolehlah menambah remote yang betul dengan:-
      git remote add origin
    4. Dan akhir sekali, tambahkan submodule:-
      git submodule add -b master public
      Maklum balas yang sepatutnya diterima adalah seperti ini:-
      Adding existing repo at 'public' to the index
  19. Tip Hosting dengan Netlify Melalui GitLab

    • Netlify tidak mampu memproses git clone untuk memasang tema. Jalan terbaik untuk mengatasinya adalah dengan memadam subdirektori .git yang ada di dalam direktori tema ataupun dengan menambah git submodule.
    • Konfigurasi tambahan diperlukan untuk Hugo versi 0.20 dan ke atas. Caranya adalah dengan membuat fail netlify.toml seperti contoh pada imej di bawah ini:-
  20. Nota Pendek

    1. nftables to replace iptables.

Kali terakhir halaman ini dikemaskini/disemak semula adalah pada .