Skip to content

Instantly share code, notes, and snippets.

View yidas's full-sized avatar

Nick Tsai yidas

View GitHub Profile
@subfuzion
subfuzion / curl.md
Last active April 23, 2024 14:44
curl POST examples

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.

@AveYo
AveYo / .. MediaCreationTool.bat ..md
Last active April 23, 2024 04:51
Universal MediaCreationTool wrapper for all MCT Windows 10 versions - MOVED TO github.com/AveYo/MediaCreationTool.bat
@yidas
yidas / codeiginter-server-config.md
Last active March 1, 2024 01:30
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:

@aliang
aliang / Mac SSH Autocomplete
Created June 14, 2011 07:14
Add auto complete to your ssh, put into your .bash_profile
_complete_ssh_hosts ()
{
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
comp_ssh_hosts=`cat ~/.ssh/known_hosts | \
cut -f 1 -d ' ' | \
sed -e s/,.*//g | \
grep -v ^# | \
uniq | \
grep -v "\[" ;
@ikhsanalatsary
ikhsanalatsary / setup_cmder_wsl.md
Last active January 17, 2024 16:31
Setup cmder with WSL 2

Using WSL 2

  1. Open cmder
  2. On the menu, open Settings option and then select Startup > Tasks from the menu tree (or just hit Win + Alt + T)
  3. Click the “+” button to add a new task and fill in the fields as follow:
  4. Name: {zsh::home}
  5. Task Parameters:
    /icon "%CMDER_ROOT%\icons\cmder.ico"
    
@yidas
yidas / csr.conf.md
Last active December 13, 2023 10:35
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

@jaxbot
jaxbot / gist:5748513
Created June 10, 2013 12:58
Block nginx from serving .git directories
location ~ /\.git {
deny all;
}
# or, all . directories/files in general (including .htaccess, etc)
location ~ /\. {
deny all;
}
@rkuzsma
rkuzsma / docker-bash-completion.md
Last active November 18, 2023 09:11
How to configure Bash Completion on Mac for Docker and Docker-Compose

How to configure Bash Completion on Mac for Docker and Docker-Compose

Copied from the official Docker-for-mac documentation (thanks Brett for the updated doc pointer):

Install shell completion

Docker Desktop for Mac comes with scripts to enable completion for the docker, docker-machine, and docker-compose commands. The completion scripts may be found inside Docker.app, in the Contents/Resources/etc/ directory and can be installed both in Bash and Zsh.

Bash

Bash has built-in support for completion To activate completion for Docker commands, these files need to be copied or symlinked to your bash_completion.d/ directory. For example, if you installed bash via Homebrew:

@yidas
yidas / js-nl2br-br2nl.md
Last active September 29, 2023 05:26
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 / laravel-server-config.md
Last active September 21, 2023 03:49
Laravel Server Configuration for Nginx & Apache (Subdirectory)

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: