Get actual elapse time in CPP
Posted on October 13, 2021
• Other languages: Tiếng Việt
#include <chrono>
int main() {
std::chrono::time_point <std::chrono::system_clock, std::chrono::duration<double, std::milli>> then = std::chrono::high_resolution_clock::now();;
// ... do something ...
std::chrono::time_point <std::chrono::system_clock, std::chrono::duration<double, std::milli>> now = std::chrono::high_resolution_clock::now();;
double elapseTimeInMS = (now - then).count();
return 0;
}
Shorter:
#include <chrono>
using namespace std;
int main() {
auto then = chrono::high_resolution_clock::now();
// ... do something ...
auto now = chrono::high_resolution_clock::now();
double elapseTimeInMS = chrono::duration<double, milli>(now - then).count();
return 0;
}
Get started with GStreamer - Command line
Posted on October 10, 2021
• Other languages: Tiếng Việt
This is about GStreamer on Linux.
[Read More]
[Linux] Adding page number to PDF file in terminal
Posted on September 29, 2021
• Other languages: Tiếng Việt
Note: You will lose all the links (hyperlink, internal-link) in PDF with this way
Create latex file numbered.tex:
[Read More]
Firefox tabs in multiple rows
Posted on August 9, 2021
• Other languages: Tiếng Việt

- Go to about:config, enable config
toolkit.legacyUserProfileCustomizations.stylesheets
.
- Go to about:support >
Profile Directory
> Open Directory
.
Firefox profile directory will be openned in new window.
- In your profile directory, create folder
chrome
if not exist.
- Go to folder
chrome
, create file userChrome.css
.
- Copy content from multi-row_tabs.css
into
userChrome.css
.
- Restart Firefox.
Active Application Launcher on Latte Dock by Super button
Posted on May 29, 2020
• Other languages: Tiếng Việt
- Right click on the dock > Layouts > Configure…
- In Settings window, go to Preferences tab
- In Actions section > Tick Press ⌘ to activate Application Launcher

Or
Generate GPG key non-interactively
Posted on January 31, 2020
• Other languages: Tiếng Việt
Put information for gen key in a text file, eg. gpg_gen_key:
Key-Type: 1
Key-Length: 2048
Subkey-Type: 1
Subkey-Length: 2048
Name-Real: My Name
Name-Email: [email protected]
Expire-Date: 0
Passphrase: secretpass
Gen key with above text file:
gpg --batch --gen-key gpg_gen_key
NGINX Basic Authentication
Posted on January 30, 2020
• Other languages: Tiếng Việt
Required package
Create password file
Run with -c
option if /etc/nginx/.htpasswd
does not exist:
sudo htpasswd -c /etc/nginx/.htpasswd user1
If .htpasswd
already exists, don’t use -c
option or file will be overwritten.
To add more user to password file.
sudo htpasswd /etc/nginx/.htpasswd user2
[Read More]
Get started with Mosh
Posted on January 20, 2020
• Other languages: Tiếng Việt
What is Mosh
Mosh is a replacement for interactive SSH terminals.
Mosh doesn’t listen on network ports or authenticate users. The mosh client logs in to the server via SSH, and users present the same credentials (e.g., password, public key) as before. Then Mosh runs the mosh-server remotely and connects to it over UDP.
[Read More]
Useful Firefox Add-ons - History AutoDelete
Posted on November 29, 2019
• Other languages: Tiếng Việt
Add-ons: History AutoDelete
Features:
-
Auto delete expired history. For example, you don’t want to keep history since 30 days ago.
-
Auto delete a specific domain’s history. There are obvious websites we don’t want to keep in our history 🙈.
[Read More]
Setup NVIDIA Optimus on Fedora
Posted on November 5, 2019
• Other languages: Tiếng Việt
Uninstall bumblebee and nvidia driver from rpmfusion if installed.
$ sudo dnf remove *nvidia* akmod-bbswitch bumblebee primus
[Read More]