Skip to content

Instantly share code, notes, and snippets.

Avatar

Nick Tsai yidas

View GitHub Profile
@yidas
yidas / js-encode-decode.md
Last active Dec 5, 2021
JavaScript HTML Entities Encode & Decode
View js-encode-decode.md
@yidas
yidas / js-nl2br-br2nl.md
Last active Dec 5, 2021
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

@AveYo
AveYo / .. MediaCreationTool.bat ..md
Last active Dec 7, 2021
Universal MediaCreationTool wrapper for all MCT Windows 10 versions from 1507 to 21H1 with business (Enterprise) edition support
View .. MediaCreationTool.bat ..md

We did it! We broke gist.github.com ;) So head over to the new home! Thank you all!
2021.10.20: https://github.com/AveYo/MediaCreationTool.bat now open for interaction

  • new update introducing no 11 setup checks on boot in VirtualBox

Not just an Universal MediaCreationTool wrapper script with ingenious support for business editions,
Preview
A powerful yet simple windows 10 / 11 deployment automation tool as well!

configure via set vars, commandline parameters or rename script like iso 21H2 Pro MediaCreationTool.bat
recommended windows setup options with the least amount of issues on upgrades set via auto.cmd

@yidas
yidas / laravel-server-config.md
Last active Nov 17, 2019
Laravel Server Configuration for Nginx & Apache (Subdirectory)
View laravel-server-config.md

Laravel Server Configuration for Nginx & Apache (Subdirectory)

It's easy to configurate a Laravel server site with directory protection:

Laravel Web Server Configuration

Sub Directory Site Application

Laravel smartly detects the current base url so that you don't need to set the base url for subdirectoy:

@yidas
yidas / csr.conf.md
Last active Dec 2, 2021
Certificate(CSR) configuration file
View csr.conf.md

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 / codeiginter-server-config.md
Last active Nov 11, 2021
Codeigniter 3 server configuration for Nginx & Apache
View codeiginter-server-config.md

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 / yii2-migrate-by-web-controller.md
Last active Jul 6, 2018
Yii2 Migrate command called by Web controller
View yii2-migrate-by-web-controller.md
public function actionMigrate()
{
    // Keep current application
    $oldApp = \Yii::$app;
    // Load Console Application config
    $config = require \Yii::getAlias('@app'). '/config/console.php';
    new \yii\console\Application($config);
    $result = \Yii::$app->runAction('migrate', ['migrationPath' => '@app/migrations/', 'interactive' => false]);
    // Revert application
View result.txt
$ php some-bench.php
strtotime: 0.15609812736511
datetime: 0.31521701812744
datetime without instanciation: 0.11794400215149
custom: 0.70522284507751
@subfuzion
subfuzion / curl.md
Last active Dec 7, 2021
curl POST examples
View curl.md

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@bryanhunter
bryanhunter / MonokaiSW.md
Last active Oct 15, 2021
Mapping colors of the Monokai color scheme to their nearest Sherwin-Williams paint color
View MonokaiSW.md