Skip to content

Instantly share code, notes, and snippets.

@saosangmo
saosangmo / install-LEMP-on-ubuntu-20.04-minimal.md
Last active December 23, 2021 11:10 — forked from nd3w/install-nginx-mariadb-phpfpm-on-ubuntu-20.04.md
Install LEMP on Ubuntu 20.04 with Let Encrypts

How to Install Nginx, MariaDB, PHP-FPM on Ubuntu 20.04 Minimal

This is a way to install and set up Nginx, MariaDB and PHP 8.1 (mode PHP-FPM), Certbot on Ubuntu 20.04.

$ sudo apt update

Nginx

$ sudo apt install nginx -y
//php
if(isset($_FILES["upload"])){
$ext = ".".end((explode(".", $_FILES["upload"]["name"])));
$filename="test";
$file_public_addr =yourlocaladdr.$filename.$ext;
$success=move_uploaded_file($_FILES["upload"]["tmp_name"],SYS_EXT.$file_public_addr);
if( $success){
$json["uploaded"]=true;
@saosangmo
saosangmo / purge_cf.php
Created December 30, 2021 20:36 — forked from Greg-Boggs/purge_cf.php
PHP code to Purge Cloudflare Cache
<?php
// Replace EMAIL/API_KEY/ZONE_ID with your details.
// Zone ID is on the dashboard for the domain in the bottom right.
// Api keys are generated from the account settings. You must give cache purge permissions
// Place this script on your webserver and point a Github Webhook at it, and you'll clear
// the Cloudflare cache every time you do a push to GH.
try {
$head = [];
$head[] = 'Content-Type: application/json';
@saosangmo
saosangmo / ConvertVie.js
Created June 5, 2022 19:21 — forked from hu2di/ConvertVie.js
JavaScript: Chuyển tiếng Việt có dấu sang không dấu
function removeVietnameseTones(str) {
str = str.replace(/à|á|ạ|ả|ã|â|ầ|ấ|ậ|ẩ|ẫ|ă|ằ|ắ|ặ|ẳ|ẵ/g,"a");
str = str.replace(/è|é|ẹ|ẻ|ẽ|ê|ề|ế|ệ|ể|ễ/g,"e");
str = str.replace(/ì|í|ị|ỉ|ĩ/g,"i");
str = str.replace(/ò|ó|ọ|ỏ|õ|ô|ồ|ố|ộ|ổ|ỗ|ơ|ờ|ớ|ợ|ở|ỡ/g,"o");
str = str.replace(/ù|ú|ụ|ủ|ũ|ư|ừ|ứ|ự|ử|ữ/g,"u");
str = str.replace(/ỳ|ý|ỵ|ỷ|ỹ/g,"y");
str = str.replace(/đ/g,"d");
str = str.replace(/À|Á|Ạ|Ả|Ã|Â|Ầ|Ấ|Ậ|Ẩ|Ẫ|Ă|Ằ|Ắ|Ặ|Ẳ|Ẵ/g, "A");
str = str.replace(/È|É|Ẹ|Ẻ|Ẽ|Ê|Ề|Ế|Ệ|Ể|Ễ/g, "E");