Skip to content

Instantly share code, notes, and snippets.

View tranchausky's full-sized avatar
🏹
done

chautran tranchausky

🏹
done
  • Ha Noi, Nghe An
View GitHub Profile
@tranchausky
tranchausky / get last record no empty of file big.php
Created August 21, 2024 15:41
file lớn, đọc ngược từ cuối file, đọc theo khối dữ liệu
<?php
function getLastNonEmptyLine($file) {
$fp = fopen($file, 'r');
$pos = -1;
$line = '';
$block = '';
if ($fp === false) {
#include <WiFi.h>
#include <NTPClient.h>
#include <WiFiUdp.h>
#include <TimeLib.h>
// Replace with your network credentials
const char* ssid = "your_SSID";
const char* password = "your_PASSWORD";
// NTP Server settings
<?php
// Define the timezone identifier for California
$timezoneIdentifier = 'America/Los_Angeles';
// Create a DateTimeZone object with the specified timezone
$timezone = new DateTimeZone($timezoneIdentifier);
// Get the timezone offset in seconds
$offset = $timezone->getOffset(new DateTime('now', $timezone));
@tranchausky
tranchausky / log.php
Created July 25, 2024 04:43
php function log file \logs\idkey\2024-07.txt
<?php
$folderLog= 'logs/';
$key = 'idkey';
$str = 'this is message to file';
logFile($folderLog, $key, $str);
function logFile($folderLog, $keyFolder, $stringToAppend, $formatFile =''){
if(!file_exists($folderLog)){
@tranchausky
tranchausky / run.bat
Created July 24, 2024 22:24
win auto open more software one click
@echo off
start "" "C:\Users\tranc\AppData\Local\GitHubDesktop\GitHubDesktop.exe"
start "" "C:\Program Files\Notepad++\notepad++.exe"
start "" "C:\Users\tranc\AppData\Local\Programs\Microsoft VS Code\Code.exe"
start "" "C:\Program Files\Google\Chrome\Application\chrome.exe" --profile-directory="Default""
@tranchausky
tranchausky / input-suggest.html
Created July 24, 2024 04:16
javascript input suggest when keypress
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Input Suggestions with Keyboard Navigation</title>
<style>
/* Basic styling for suggestions */
.suggestions-container {
border: 1px solid #ccc;
@tranchausky
tranchausky / different.js
Last active June 14, 2024 06:27
jquery send ajax json
var settings = {
"url": "https://website.local:8443/api/event-checkin",
"method": "POST",
"timeout": 0,
"headers": {
"username": "usename",
"password": "password",
"Content-Type": "application/json"
},
"data": JSON.stringify({
@tranchausky
tranchausky / laravel-demo-upset.sql
Last active June 3, 2024 04:23
demo laravel upset (update/insert) need catalog_id is unique
insert into `subModel` (`catalog_id`, `name`) values ('1', 'CCC'), ('2', 'GS'), ('3', 'SX'), ('4', 'GL'), ('10', 'Home,cc') on duplicate key update `catalog_id` = values(`catalog_id`), `name` = values(`name`)
@tranchausky
tranchausky / doc.txt
Created May 20, 2024 03:45
How to extract text from a PSD file?
npm install -g psd-cli
You can then use it by typing in your terminal
psd myfile.psd -t
This will create myfile.txt, containing all text extracted from each PSD layer with the layer structure attached.
https://nodejs.org/en/
https://www.npmjs.com/package/psd-cli