Skip to content

Instantly share code, notes, and snippets.

View yidas's full-sized avatar

Nick Tsai yidas

View GitHub Profile
@yidas
yidas / csr.conf.md
Last active July 18, 2026 19:24
Certificate(CSR) configuration file

Openssl commands:

openssl genrsa -out self-ssl.key
openssl req -new -key self-ssl.key -out self-ssl.csr -config csr.conf
openssl x509 -req -days 365 -in self-ssl.csr -signkey self-ssl.key -out self-ssl.crt -extensions req_ext -extfile csr.conf

Sign from Root CA: openssl x509 -req -days 365 -extensions req_ext -extfile csr.conf -CA RootCA.crt -CAkey RootCA.key -in self-ssl.csr -out self-ssl.crt

@yidas
yidas / js-nl2br-br2nl.md
Last active April 18, 2026 21:48
JavaScript nl2br & br2nl functions

JavaScript nl2br & br2nl functions

The exchange of new line & br HTML tag could refer to PHP - nl2br() function, which uses to inserts HTML line breaks before all newlines in a string.

These JavaScript functions consider whether to use insert or replace to handle the swap.

nl2br

@yidas
yidas / js-encode-decode.md
Last active November 26, 2025 21:18
JavaScript HTML Entities Encode & Decode
@yidas
yidas / composer-install-vcs.md
Last active October 27, 2025 05:52
Composer install package via VCS such as GitLab (Private package requirement)

Composer install package via VCS such as GitLab

(Private package requirement)

1. Create composer.json:

{
    "repositories": [                                             
        {                                                         
 "type": "vcs", 
@yidas
yidas / curl-timeout-error-handling.md
Last active July 12, 2025 16:49
CURL timeout error handling (Connection/Operation timed out)

CURL timeout error handling (Connection/Operation timed out)

CURL parameter --max-time includes --connect-timeout to separate the timeout of the handshake phase.

CURL - Timeouts · Everything curl

In addition, CURL can distinguish timeout errors at different stages: "connection timeout" and "operation timeout".

For example, CURL command with 5 second connection timeout and 25 second maximum timeout setting:

@yidas
yidas / codeiginter-server-config.md
Last active March 8, 2025 15:25
Codeigniter 3 server configuration for Nginx & Apache

Codeigniter 3 server configuration for Nginx & Apache

Web Server Site Configuration

Recommended Apache Configuration

Use the following configuration in Apache's httpd.conf file or within a virtual host configuration. Note that you should set DocumentRoot and ServerName fit to your environment:

@yidas
yidas / mysql-change-sqlmode.md
Last active November 5, 2024 10:53
[MySQL] Permanently change SQL Mode in MySQL (disable_strict_mode)

[MySQL] Permanently change SQL Mode in MySQL (disable_strict_mode)

Set into [mysqld] of MySQL config, for Ubuntu your could create a file /etc/mysql/conf.d/disable_strict_mode.cnf:

[mysqld]
sql_mode=NO_ENGINE_SUBSTITUTION

SQL mode example: STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION

@yidas
yidas / line-pay-sample-codes.md
Last active June 6, 2024 05:32
LINE Pay API (v3) sample codes in multi-languages
@yidas
yidas / java-http-client-samples.md
Last active April 24, 2024 10:32
JAVA HTTP Client Sample codes

JAVA HTTP Client Sample codes

HttpURLConnection

/**
 * @see https://docs.oracle.com/javase/8/docs/api/java/net/URLConnection.html
 * @see https://docs.oracle.com/javase/8/docs/api/java/net/HttpURLConnection.html
 * @see https://www.baeldung.com/java-http-request
 * @see https://www.baeldung.com/httpurlconnection-post
@yidas
yidas / deep-link_app_examples.md
Last active November 24, 2023 23:21
Mobile App Deep Link Table (URL Scheme | App link | Universal link)