Skip to content

Instantly share code, notes, and snippets.

View phuthuycoding's full-sized avatar

Quyền phuthuycoding

View GitHub Profile
@phuthuycoding
phuthuycoding / bot-detection.conf
Created October 10, 2025 10:15
bot-detection.conf
# ════════════════════════════════════════════════════════
# Bot Detection Configuration
# Include in http block of nginx.conf
# ════════════════════════════════════════════════════════
# ════════════════════════════════════════════════════════
# Map User-Agent to Bot Type
# ════════════════════════════════════════════════════════
map $http_user_agent $bot_type {
default "user";
@phuthuycoding
phuthuycoding / MailJet Node Send.js
Created March 5, 2025 06:36 — forked from caco0516/MailJet Node Send.js
A little example of how to send emails with MailJet Node.js module.
// This calls sends an email to one recipient.
var mailjet = require ('node-mailjet')
.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)
var request = mailjet
.post("send")
.request({
"FromEmail": "caco0516@gmail.com",
"FromName": "noreply@growposapp.com",
"Subject": "Bienvenido a Grow POS",
"MJ-TemplateID": "103446",
@phuthuycoding
phuthuycoding / image2ascii_art.py
Last active February 10, 2025 13:57
convert image to ascii art
from PIL import Image
import numpy as np
# Load the uploaded image
image_path = "/mnt/data/1.png"
img = Image.open(image_path)
# Convert image to grayscale
img_gray = img.convert("L")
@phuthuycoding
phuthuycoding / setup_clear_mysql_bin_log.sh
Created October 29, 2024 12:27
Thêm 1 crontab để tự động clear bin log cũ hơn 7 ngày cho vps mới
#!/bin/bash
# Yêu cầu nhập mật khẩu MySQL root
read -sp "Enter MySQL root password: " MYSQL_ROOT_PASSWORD
echo ""
# Tạo file .my.cnf nếu chưa tồn tại
MY_CNF_PATH="/root/.my.cnf"
if [ ! -f "$MY_CNF_PATH" ]; then
echo "Creating .my.cnf file..."
@phuthuycoding
phuthuycoding / HttpClient.ts
Created October 15, 2024 05:41
Simple Signleton HttpClient using typescript and fetch
/**
* Interface for the HttpClient class, defining the structure of HTTP client methods.
*/
interface IHttpClient {
setBaseUrl(baseUrl: string): this
get<T>(url: string): Promise<T>
post<T>(url: string, body?: Record<string, unknown>, options?: RequestInit): Promise<T>
@phuthuycoding
phuthuycoding / clone-repo.sh
Last active October 15, 2024 05:43
Clone all repo of Azure devops from project with PAT token
#!/bin/bash
# Replace these with your own organization and PAT
ORGANIZATION="YOUR_ORGANIZATION"
PAT="YOUR_PAT_TOKEN"
# Prompt for the project name
read -p "Enter your Azure DevOps project name: " PROJECT
# Prompt for the target folder