Skip to content

Instantly share code, notes, and snippets.

Avatar

Nick Tsai yidas

View GitHub Profile
@yidas
yidas / ssl_cipher.md
Last active Aug 26, 2022
Web Server TLS/SSL Cipher Suite Setting - Best Practice
View ssl_cipher.md

Web Server TLS/SSL Cipher Suite Setting - Best Practice

nginx seting:

ssl_prefer_server_ciphers on;
ssl_ciphers 'ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-CHACHA20-POLY1305:ECDHE-ARIA256-GCM-SHA384:DHE-RSA-ARIA256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:ECDHE-ARIA128-GCM-SHA256:DHE-RSA-ARIA128-GCM-SHA256:DHE-RSA-AES256-CCM8:DHE-RSA-AES256-CCM:DHE-RSA-AES128-CCM8:DHE-RSA-AES128-CCM';

@yidas
yidas / zip-slip-php.md
Last active Aug 7, 2021
ZIP Slip - File Generation Sample Code by PHP
View zip-slip-php.md

ZIP Slip - File Generation Sample Code by PHP

Sample Code

<?php

$zip = new ZipArchive();
$filename = "./zip-slip-test.zip";
@yidas
yidas / java-http-client-samples.md
Last active Oct 14, 2021
JAVA HTTP Client Sample codes
View java-http-client-samples.md

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
 */
@yidas
yidas / deep-link_app_examples.md
Last active May 13, 2022
Mobile App Deep Link Table (URL Scheme | App link | Universal link)
View deep-link_app_examples.md
@yidas
yidas / curl-timeout-error-handling.md
Last active Aug 20, 2019
CURL timeout error handling (Connection/Operation timed out)
View curl-timeout-error-handling.md

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 / public-key-fingerprint-formula.md
Last active Aug 22, 2019
Public key's fingerprint formula
View public-key-fingerprint-formula.md

Public key's fingerprint formula

The public key file (key.pub) contains the binary key that is packaged into a base64 string.

Formula

The public key's fingerprint formula:

# SHA256
@yidas
yidas / line-pay-sample-codes.md
Last active Nov 15, 2022
LINE Pay API (v3) sample codes in multi-languages
View line-pay-sample-codes.md
@yidas
yidas / yii2-app-basic-env-switch.md
Created Jan 3, 2019
Yii2 App Basic Environment Setting Switch for WEB & Console
View yii2-app-basic-env-switch.md

Yii2 App Basic Environment Setting Switch for WEB & Console

Server Variable Solution

Add server variable condition for ./web/index.php & ./yii:

if (isset($_SERVER['APP_ENV']) && $_SERVER['APP_ENV']=='production') {
@yidas
yidas / js-encode-decode.md
Last active Apr 6, 2022
JavaScript HTML Entities Encode & Decode
View js-encode-decode.md
@yidas
yidas / js-nl2br-br2nl.md
Last active Sep 15, 2022
JavaScript nl2br & br2nl functions
View js-nl2br-br2nl.md

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