RSS

Posts in 2021

  • Custom hugo RSS template

    Last Update: 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

    Last Update: 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

    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

    Last Update: 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

    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 Golang

    Last Update: 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 Connection Ciphers TLS Version and Certificate with OpenSSL Command Line

    Last Update: in Security

    Use OpenSSL command line to test and check TLS/SSL server connectivity, cipher suites, TLS/SSL version, check server certificate etc. TLS 1.2 and TLS 1.3 test support. Force TLS 1.2, Force TLS 1.3. STARTTLS test. openssl s_client example commands with detail output. Works on Linux, windows and Mac OS X.

    Introduction openssl s_client is an SSL/TLS client program that can be used to test TLS server connectivity, TLS/SSL version support, check cipher suites, and verify server certificate. It is a very useful diagnostic tool for SSL servers. Usage: …

    Read more

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

    Last Update: 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 is a socket option can be used in setsockopt() to bind a socket to network interface. e.g. #include <sys/types.h>#include <sys/socket.h> const char *interface_name = "eth0"; …

    Read more

  • Find 3rd party gems global variables in ruby

    in Rails

    Find 3rd party gems global variables in ruby

    Why Need Find Global Variables In rails, if you want to use puma as rails server, you need make sure your app is thread safe, not only your app code itself, also 3rd party gems should also thread safe. One of requirement for thread safe is avoid …

    Read more

  • Troubleshooting Splunk Search Performance by Search Job Inspector

    Last Update: in Splunk

    How to use Splunk Search Job Inspector to troubleshooting search performance issue, understand how search was processed and where splunk spent time.

    What is Search Job Inspector The Search Job Inspector and the Job Details dashboard are tools that let you take a closer look at what your search is doing and see where the Splunk software is spending most of its time. Search Job Inspector allows you …

    Read more