Skip to content

Instantly share code, notes, and snippets.

View QZLin's full-sized avatar

Q.Z.Lin QZLin

View GitHub Profile
@QZLin
QZLin / addthis2path.cmd
Created August 29, 2021 16:01
Put this to target dir, drag this file to cmd window and call it, done!
rem cd /d %~dp0
echo %~dp0
set path=%~dp0;%path%
@QZLin
QZLin / factorioStringPathAccessNode.lua
Last active August 29, 2021 16:06
Access factorio data by folder/file path liked string
local function split(inputstr, sep)
if sep == nil then sep = "%s" end
local result_table = {}
for str in string.gmatch(inputstr, "([^" .. sep .. "]+)") do
table.insert(result_table, str)
end
return result_table
end
function Ptable(table_, path)
@QZLin
QZLin / clean.ps1
Created October 10, 2021 03:47
clean all files accord to file type list in dir and subdir
# example: c/c++ build clean
$clean_types = 'o', 'obj', 'res', 'gch', 'pch', 'exe', 'out'
Write-Output "Clean $clean_types"
# Remove `–Recurse` if subdir not need clean
Get-ChildItem –Recurse | ForEach-Object {
$file = $_
try {
foreach ($type in $clean_types) {
### !!!Warning!!! Check match parttern carefully, removed file will not be recover simply
if ($file -match "\.$type`$") {
@QZLin
QZLin / extract-git-folder-with-history.md
Created October 14, 2021 05:05 — forked from cyberang3l/extract-git-folder-with-history.md
GIT: How to extract a specific folder from a git repository branch, including the folder's related git history only

GIT: How to extract a specific folder from a git repository branch, including the folder's related git history only

NOTE: If you want to keep the history for a specific folder in the master branch, just skip steps in lines 3,4,5,6,7

git clone <git-repository-url>
cd <git-repository-dir>

git checkout <branch-name>              # line 3; Checkout the branch of interest
git merge --strategy=ours master        # line 4; keep the content of this branch only and record a merge
git checkout master                     # line 5; Go back to the master branch
@QZLin
QZLin / fck_tpm.cmd
Created October 24, 2021 02:02
bypass f*cking tpm limit of windows11 update
cd C:\$WINDOWS.~BT\Sources
:st
echo. > AppraiserRes.dll
goto st
@QZLin
QZLin / start_fck_tencent.cmd
Last active November 7, 2021 11:50
**Run as Admin** Change tim/qq path to your qq/tim path.After finished use, press enter in console it will kill tencent "protect" services
@cd /d C:\Program Files (x86)\Common Files\Tencent\QQProtect\Bin
move QQProtect.exe.block QQProtect.exe
net start QPCore
start "" "C:\Program Files (x86)\Tencent\TIM\Bin\TIM.exe"
@echo Press Enter Stop TIM
@pause
taskkill /f /im TIM.exe
@QZLin
QZLin / stellaris_rbt_darg.ahk
Created January 6, 2022 08:54
Stellaris Right Button Drag
#Requires AutoHotkey v2.0-beta.3
#SingleInstance force
x:=-1
y:=-1
x1:=-1
x2:=-1
#HotIf WinActive("ahk_exe stellaris.exe")
RButton::{
@QZLin
QZLin / GeForceExperiencePatch.ps1
Created January 6, 2022 08:57
GeForce Experience without login
Set-Location "C:\Program Files\NVIDIA Corporation\NVIDIA GeForce Experience\www"
Copy-Item app.js app.js.bak
$js = Get-Content app.js
$js = $js -replace "`"choose`"===\w\.nvActiveAuthView[\D]*\)\}", `
'"choose"===this.nvActiveAuthView)};this.handleLoggedIn({sessionToken:"",userToken:"",user: {core:{displayName:"Anonymous",primaryEmailVerified: true}}});'
$js = $js -replace "\w\.selectView\(\)\},\w\.selectView=function\(\)\{", "return;"
$js > app.js
@QZLin
QZLin / udp_client.py
Created January 6, 2022 10:48
Simple Python Udp Client
from socket import *
addr = ('127.0.0.1', 8000)
s = socket(AF_INET, SOCK_DGRAM)
s.sendto('testmsg'.encode(encoding='utf-8'), addr)
s.close()
@QZLin
QZLin / powershell_reload_path.ps1
Created March 14, 2022 15:39
Reload the path in PowerShell
$env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User")