Posts in 2022
-
Python: How to print literal curly brace { or } in f-string and format string
in Python
How to print literal curly brace “{” or “}” in f-string and format string. how to escape brace properly in python.
Formatted string literals or f-string introduced in Python 3.6. A formatted string literal or f-string is a string literal that is prefixed with ‘f’ or ‘F’. These strings may contain replacement fields, which are expressions …
-
Linux how to restart service automatically to avoid server downtime
Last Update: in Linux
Have a linux service running for a long time but quit accidentally due to crash, signal, kill etc. Want to restart it automatically to avoid/reduce service downtime, use
systemd
servicerestart
policy to control it easily.Symptom I have nginx server running for months, suddenly got a alarm from monitor service indicate the nginx server is not providing service. I can ssh to server, so server is still online. Then check nginx server status use systemctl status nginx, I …
-
Troubleshooting: loading carthage framework error: dyld: Library not loaded: @rpath/...
Last Update: in iOS
Troubleshooting: loading carthage framework error: dyld: Library not loaded: @rpath. How to locate which carthage framework missing dependence?
Symptom iOS project use carthage frameworks, compile successfully. However crash at run time with “Library not loaded” error. For example: dyld: Library not loaded: libswiftXCTest.dylib Referenced from: …
-
NGINX access_log log the real client IP from X-Forwarded-For/X-Real-IP instead of the proxy IP
Last Update: in nginx
Have a nginx server receive requests from proxy or behind CDN, how to get client user’s real IP instead of proxy/CDN servers IP in access log? This article provide two solutions based on
log_format
and nginxrealip
module.access_log log format The nginx access_log default use predefined combined format for log format, the log looks like: 91.92.94.95 - - [03/Jan/2022:07:21:59 -0300] "GET /foo HTTP/1.1" 200 13831 "https://duckduckgo.com/" …
Posts in 2021
-
Calculate file crypto hash (sha1, sha256, sha384 and sha512) in Flutter
Last Update: in Flutter
How to calculate to generate file sha1, sha256, sha384 and sha512 crypto hash in Flutter.
Introduce crypto and ChunkedStreamReader crypto Flutter crypto package provides a set of cryptographic hashing functions implemented in pure Dart. The following hashing algorithms are supported: SHA-1 SHA-224 SHA-256 SHA-384 SHA-512 SHA-512/224 …
-
testssl.sh examples command line tool check server TLS/SSL (weak) ciphers and detect TLS/SSL vulnerabilities
Last Update: in Security
Want to use command line to test server TLS/SSL config properly, find weak ciphers, scan TLS/SSL server vulnerabilities, run in CI? Try testssl.sh.
If you want to test server TLS/SSL and have following Want to use command line to test server TLS/SSL config properly, scan TLS/SSL vulnerabilities. Want to run TLS/SSL test in CI (Continue Integration) environment. Want to output result as …
-
Add comments to Static blog like Hugo, Jekyll with Isso
Last Update: in Hugo
How to add comments in Hugo with Isso commenting server? The setup should work with other static blog system like Jekyll, next.js, Gatsby, Nuxt, Hexo, Slate, Docusaurus, VuePress, Docsify, MkDocs etc. in similar way. Get to know more depth about Isso API and database schema.
Isso Introduction Isso is a Disqus alternative commenting server for static web sites. It is a lightweight commenting server written in Python and JavaScript. It aims to be a drop-in replacement for Disqus. The benefits of Isso compare to Disqus: …
-
Fix Slow Wi-Fi on Mac OS X by Reset Wi-Fi configuration and Advanced Wireless Troubleshooting
in Mac
Fix Slow Wi-Fi on Mac OS X by Reset Wi-Fi configuration and Advanced Wireless Troubleshooting. After use Mac OS X for a long time or OS upgrade, the signal indicate the wifi connection is in good state, however the Wifi connection speed became very slow, with speed test result less than 1MB/s in very good router signal coverage.
Slow Wi-Fi Symptom After use Mac OS X for a long time or OS upgrade, the signal indicate the wifi connection is in good state, however the Wifi connection speed became very slow, with speed test result less than 1MB/s in very good router signal …
-
Troubleshooting ProtonVPN Linux cli EnableIPv6LeakProtectionError: Unable to add IPv6 leak protection connection/interface
in Linux
protonvpn-cli connect
report An unknown error has occured. Please ensure that you have internet connectivity. If the issue persists, please contact support.protonvpn-cli.log
show error protonvpn_nm_lib.exceptions.EnableIPv6LeakProtectionError: Unable to add IPv6 leak protection connection/interfaceprotonvpn.log
show Error: Failed to add ‘pvpn-ipv6leak-protection’ connection: Insufficient privileges.Environment Linux OS: Debian 10 Buster 64 bit (Fresh install with default options). $ uname -a Linux debian10 4.19.0-17-amd64 #1 SMP Debian 4.19.194-3 (2021-07-18) x86_64 GNU/Linux $ protonvpn-cli -v ProtonVPN CLI v3.8.0 (protonvpn-nm-lib v3.3.2; …
-
Tips on Hugo SEO
Last Update: in Hugo
Tips on Hugo SEO (Search Engine Optimization). Add describe
metadata
, link build, handle external link, lighthouse SEO checklist etc.Hugo is one of the most popular open-source static site generators. With its amazing speed and flexibility, Hugo makes building websites fun again. However the default hugo template does not take too much consideration on SEO. Here are some tips to …