RSS

Posts in 2021

  • Troubleshooting ProtonVPN Linux cli EnableIPv6LeakProtectionError: Unable to add IPv6 leak protection connection/interface

    August 13, 2021 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/interface protonvpn.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; …

    Read more

  • Tips on Hugo SEO

    May 06, 2021 in Hugo

    Tips on Hugo SEO (Search Engine Optimization).

    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 …

    Read more

  • Custom hugo RSS template

    May 05, 2021 in Hugo

    Custom hugo RSS content. Add lastBuildDate to show the page last modification time. Make a custom description like adding image, use description field instead of summary or content.

    Hugo ships with its own RSS 2.0 template, it generated the RSS feed file as index.xml and embedded into index.html header. e.g. {{ range .AlternativeOutputFormats -}} {{ printf `<link rel="%s" type="%s" href="%s" >` .Rel …

    Read more

  • Hugo troubleshooting: execute of template failed: can't give argument to non-function

    May 04, 2021 in Hugo

    render of “page” failed: execute of template failed: can’t give argument to non-function …

    Symptom After upgrade hugo from 0.62.2 to 0.79.1 and run hugo build got following error: $ HUGO_ENV="production" hugo Start building sites … ERROR 2021/05/05 15:01:35 render of "page" failed: execute of template failed: template: …

    Read more

  • Android OkHttp change User-Agent header

    April 18, 2021 in Android

    Android OkHttp addHeader(“User-Agent”) does not work troubleshooting.

    Symptom Use OkHttpClient.Builder() to add User-Agent header. val okHttpClient = OkHttpClient.Builder() .addNetworkInterceptor { chain -> val requestBuilder = chain.request().newBuilder() .addHeader("User-Agent", userAgent) With this code, …

    Read more

  • Various ways to load PDF in Android webview

    April 16, 2021 in Android

    Android webview can not load PDF file by default. Luckily, there are various ways to how to load PDF file in Android webview, like use google service, pdf.js etc.

    Android webview can not load PDF file by default. :( Luckily, there are various ways to how to load PDF file in Android webview. Open Intent with startActivity If your requirement does not need use embedded webview to show PDF, you can just use …

    Read more

  • Weird Android junit test failure java.lang.NoClassDefFoundError: android/content/Context

    April 15, 2021 in Android

    Symptom Have a Android project run junit test fine, suddenly it failed to run unit test with following error: xxxxTest initializationError java.lang.NoClassDefFoundError: android/content/Context at java.lang.Class.getDeclaredMethods0(Native Method) …

    Read more

  • ECDSA signature verify in kotlin and Go

    January 16, 2021 in Security

    How to verify ECDSA signature generated by kotlin and verify it in Go?

    Introduction Elliptic Curve Digital Signature Algorithm (ECDSA) offers a variant of the Digital Signature Algorithm (DSA) which uses elliptic curve cryptography. ECDSA keys and signatures are shorter than in RSA for the same security level. A 256-bit …

    Read more

Posts in 2020

  • Test TLS Connectivity with OpenSSL Command Line

    December 13, 2020 in Security

    Use OpenSSL command line to test TLS server connectivity, check server certificate.

    Introduction openssl s_client is a SSL/TLS client program can be used to test TLS server connectivity, check server certificate. usage: s_client args -4 - Force IPv4 -6 - Force IPv6 -host host - use -connect instead -port port - use -connect instead …

    Read more

  • Linux SO_BINDTODEVICE and mac IP_BOUND_IF to bind socket to a network interface

    September 18, 2020 in Linux

    Use Linux SO_BINDTODEVICE and mac IP_BOUND_IF / IPV6_BOUND_IF to bind socket to a network interface

    SO_BINDTODEVICE on Linux In Linux, SO_BINDTODEVICE can be used to bind a socket to network interface. e.g. #include <sys/types.h>#include <sys/socket.h> const char *interface_name = "eth0"; setsockopt(socket_fd, SOL_SOCKET, …

    Read more