Skip to content

Instantly share code, notes, and snippets.

View vinhjaxt's full-sized avatar
🏠
Working from home

vinhjaxt

🏠
Working from home
View GitHub Profile
@vinhjaxt
vinhjaxt / zig-build.cmd
Last active June 17, 2023 16:47
Zig Build
rem zig build-exe main.zig -O ReleaseSmall --strip --single-threaded -target x86_64-windows
rem https://ziglang.org/download/0.8.0/release-notes.html#Support-Table
rem https://ziglang.org/documentation/master/#Targets
zig targets
rem https://ziglang.org/documentation/master/#Build-Mode
set "BUILD_MODE=-Doptimize=ReleaseSafe"
@vinhjaxt
vinhjaxt / Windows 10 100percent Disk.cmd
Created May 30, 2023 15:43
Windows 10 100% Disk SysMain
sc stop "SysMain" & sc config "SysMain" start=disabled
@vinhjaxt
vinhjaxt / clear-winevt-log.cmd
Last active May 30, 2023 13:14
Clear WinEVT Log
@echo off
WEVTUTIL EL > .\LOGLIST.TXT
for /f %%a in ( .\LOGLIST.TXT ) do WEVTUTIL CL "%%a"
del .\LOGLIST.TXT
timeout 30
@vinhjaxt
vinhjaxt / RunChromePortable.cmd
Created May 3, 2023 12:57
RunChromePortable.cmd
@if (1==1) @if(1==0) @ELSE
@echo off&setlocal DisableDelayedExpansion
cscript //E:JScript //nologo "%~f0"
@goto :EOF
@end @ELSE
var scriptDir = WScript.ScriptFullName.substring(0,WScript.ScriptFullName.lastIndexOf(WScript.ScriptName)-1)
@vinhjaxt
vinhjaxt / cf-worker-email.md
Created April 13, 2023 07:47 — forked from stonking/cf-worker-email.md
Send email from Cloudflare Workers via MailChannels

Send email from Cloudflare Workers via MailChannels

Cloudflare announced a partnership with MailChannels that allows you to send free email via workers.

The example code that MailChannels supplied wasn't working so I fixed it here to make testing easy.

  1. Add include:relay.mailchannels.net to your domain's SPF record.
  2. Update the code below with your email addresses
  3. Create worker, paste code, save and deploy and test
@vinhjaxt
vinhjaxt / vi2en.js
Created March 23, 2023 09:33
Vi 2 en
function vi2en(str) {
const charMap = {
// Nokia
'́': '', '̀': '', '̉': '', '̃': '', '̣': '',
// Latin
'À': 'A', 'Á': 'A', 'Â': 'A', 'Ã': 'A', 'Ä': 'A', 'Å': 'A', 'Æ': 'AE', 'Ç': 'C',
'È': 'E', 'É': 'E', 'Ê': 'E', 'Ë': 'E', 'Ì': 'I', 'Í': 'I', 'Î': 'I', 'Ï': 'I',
'Ð': 'D', 'Ñ': 'N', 'Ò': 'O', 'Ó': 'O', 'Ô': 'O', 'Õ': 'O', 'Ö': 'O', 'Ő': 'O',
'Ø': 'O', 'Ù': 'U', 'Ú': 'U', 'Û': 'U', 'Ü': 'U', 'Ű': 'U', 'Ý': 'Y', 'Þ': 'TH',
You are ChatGPT, a large language model trained by OpenAI. Follow the user's instructions carefully!
@vinhjaxt
vinhjaxt / github-release-workflow.yml
Created March 18, 2023 06:11
Github release workflow
name: Build
on:
issues:
types: [opened, reopened, closed]
issue_comment:
types: [created, edited, deleted]
jobs:
build:
@vinhjaxt
vinhjaxt / disable-windows-update.ps1
Created March 15, 2023 02:46 — forked from mikebranstein/disable-windows-update.ps1
Disables Windows Update with PowerShell
# set the Windows Update service to "disabled"
sc.exe config wuauserv start=disabled
# display the status of the service
sc.exe query wuauserv
# stop the service, in case it is running
sc.exe stop wuauserv
# display the status again, because we're paranoid
@vinhjaxt
vinhjaxt / spawnProcess.js
Created March 7, 2023 11:48
spawnProcess nodejs threads
async function spawnProcess(maxTask, getTask, taskHandler, errorHandler) {
let free = maxTask
let waitFinish = false
while (true) {
if (waitFinish) {
// no more task, wait all task done
await delay(150)
if (free == maxTask) return
continue