+- RPi -------+
+---+ 192.168.1.2 | +- Laptop ----+
| | WLAN AP +-))) (((-+ WLAN Client |
| | 192.168.3.1 | | 192.168.3.2 |
| +-------------+ +-------------+
+- Router ----+ |
| Firewall | | +- PC#1 ------+
(Internet)---WAN-+ DHCP server +-LAN-+---+ 192.168.1.3 |
| 192.168.1.1 | | +-------------+
+-------------+ |
| +- PC#2 ------+
+---+ 192.168.1.4 |
+-------------+
Tính thời gian thực thi thực sự trong C++
#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;
}
Cách viết khác ngắn hơn:
#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;
}
Bắt đầu với GStreamer - Dòng lệnh
Bài vết này là về GStreamer riêng trên Linux.
[Đọc tiếp][Linux] Đánh số trang cho file PDF từ terminal
Chú ý: Link trong file PDF (hyperlink, internal-link) sẽ bị mất nếu làm theo cách này
Tạo một file numbered.tex với nội dung như sau:
[Đọc tiếp]Hiển thị tab Firefox trên nhiều dòng
- Truy cập about:config, bật tùy chọn
toolkit.legacyUserProfileCustomizations.stylesheets
. - Truy cập about:support >
Profile Directory
>Open Directory
. Cửa sổ thư mục profile sẽ bật ra. - Trong thư mục profile, tạo thư mục
chrome
nếu chưa tồn tại. - Trong thư mục
chrome
, tạo fileuserChrome.css
. - Copy nội dung từ file multi-row_tabs.css
vào file
userChrome.css
. - Khởi động lại Firefox.
Bật Application Launcher trên Latte Dock bằng phím tắt Window
- Bấm chuột phải vào dock > Layouts > Configure…
- Trong cửa sổ Settings, chuyển tới tab Preferences
- Trong mục Actions > Chọn Press ⌘ to activate Application Launcher
Hoặc
-
Mở file ~/.config/kwinrc lên và thêm đoạn sau:
... [ModifierOnlyShortcuts] Meta=org.kde.lattedock,/Latte,org.kde.LatteDock,activateLauncherMenu ...
-
Reload KWin:
$ qdbus org.kde.KWin /KWin reconfigure
Tạo GPG key với text file
Tạo 1 file text tên là gpg_gen_key với đầy đủ thông tin cho việc tạo 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
Tiến hành tạo key từ file text trên:
gpg --batch --gen-key gpg_gen_key
NGINX Basic Authentication
Gói yêu cầu
-
Trên Debian:
apache2-utils
.sudo apt-get install apache2-utils
-
Trên Fedora:
httpd-tools
.sudo dnf install httpd-tools
Tạo file lưu trữ user:password
Tạo file /etc/nginx/.htpasswd
là file chứa thông tin về người dùng và mật khẩu.
sudo htpasswd -c /etc/nginx/.htpasswd user1
Tùy chọn -c
chỉ nên dùng nếu file chưa tồn tại nếu không nó sẽ ghi đè file đã có.
Để thêm người dùng khác, ta chạy lệnh giống như trên nhưng bỏ tùy chọn -c
.
sudo htpasswd /etc/nginx/.htpasswd user2
Bắt đầu với Mosh
Mosh là gì
Mosh là một công cụ thay thế cho SSH terminal.
Mosh không lắng nghe trên network port hay xác thực người dùng. Mosh client đăng nhập máy chủ thông qua SSH sau đó khởi chạy mosh-server trên máy chủ và kết nối với nó thông qua UDP.
[Đọc tiếp]Useful Firefox Add-ons - History AutoDelete
Add-ons: History AutoDelete
Tính năng:
-
Tự động xóa lịch sử cũ. Ví dự như những lịch sử cũ hơn 30 ngày chẳng hạn.
-
Tự động xóa một trang web khỏi lịch sử trình duyệt.