Skip to content

Instantly share code, notes, and snippets.

View tranchausky's full-sized avatar
🏹
done

chautran tranchausky

🏹
done
View GitHub Profile
@tranchausky
tranchausky / platformio.ini
Last active July 11, 2025 09:26
esp32-c3 (supporer mini) show monotor Serial (hold boot + power first for upload code)
[env:esp32c3]
platform = espressif32
board = esp32-c3-devkitm-1
framework = arduino
monitor_speed = 115200
build_flags =
-DARDUINO_USB_CDC_ON_BOOT=1
-DARDUINO_USB_MODE=1
@tranchausky
tranchausky / export-xlsx-command.php
Last active July 10, 2025 08:53
example use OpenSpout write xlsx php laravel "openspout/openspout": "v4.13.1"
<?php
namespace App\Console\Commands;
use App\Repositories\PriceImportExportRepository;
use Illuminate\Console\Command;
use App\Models\PriceImportExport;
use Illuminate\Support\Facades\DB;
use OpenSpout\Writer\XLSX\Writer;
@tranchausky
tranchausky / domain.php
Created July 2, 2025 08:26
php get domain at
<?php
function get_absolute_root_url_my($with_scheme = true)
{
$url = '';
if ($with_scheme)
{
$host = '';
if (isset($_SERVER['HTTP_X_FORWARDED_HOST'])) {
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Email Validation Strict Demo</title>
<style>
input {
width: 320px;
padding: 8px;
font-size: 16px;
@tranchausky
tranchausky / readme-mailhog-docker.md
Last active June 3, 2025 04:14
Document build mailhog for docker and test

1. Install docker 1

docker-compose.yml

services:
  mailhog:
    image: mailhog/mailhog
    container_name: mailhog
    ports:
@tranchausky
tranchausky / blockDevtool.js
Created May 14, 2025 02:05
block dev tool
//nq57.mst.gov.vn
function isDeveloperToolsShortcut(e) {
const isF12 = e.key === "F12";
const isCtrlShiftKeyCombo = (e.ctrlKey || e.metaKey) && e.shiftKey && ["I", "J", "C"].includes(e.key);
const isCtrlU = (e.ctrlKey || e.metaKey) && e.keyCode === 85;
return isF12 || isCtrlShiftKeyCombo || isCtrlU;
}
@tranchausky
tranchausky / when close.js
Created April 8, 2025 09:17
javascript call when close tab current
window.addEventListener('beforeunload', function (e) {
console.log('Tab is about to be closed');
// Optionally show a confirmation dialog (not supported in all browsers)
e.preventDefault();
e.returnValue = '';
});
@tranchausky
tranchausky / for_login.php
Last active May 13, 2025 10:22
login logout php basic
<?php
session_start();
//$php_main = 'admin.php';
$host = $_SERVER['HTTP_HOST'];
$scriptName = $_SERVER['SCRIPT_NAME'];
$atinput_linkUrl = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http");
$atinput_linkUrl .= "://$host".$scriptName;

Test cross

tranc@DESKTOP-SBDJJJT MINGW64 ~
$ curl -i -X OPTIONS http://192.168.1.33:21680/completed/704_59_0/2025/03/1742835485.ts
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0HTTP/1.1 200 OK
Date: Tue, 25 Mar 2025 11:41:19 GMT
Server: Apache/2.4.62 (CentOS Stream)
@tranchausky
tranchausky / cookie.css
Created March 18, 2025 04:02
cookie basic