Skip to content

Instantly share code, notes, and snippets.

View QZLin's full-sized avatar

Q.Z.Lin QZLin

View GitHub Profile
$l=(Get-ChildItem C:\Programs\Python39\Lib -Name)
Get-ChildItem -Exclude .\site-packages\ | Where-Object {!($_.Name -in $l)} | Move-Item -Destination .\site-packages\ -Force
New-ItemProperty -Path "HKLM:\SOFTWARE\OpenSSH" -Name DefaultShell -Value "C:\Program Files\PowerShell\7\pwsh.exe" -PropertyType String -Force
@QZLin
QZLin / stellaris_saved_event_target.txt
Created May 7, 2023 12:46
stellaris sav event_target
(saved_event_target={(?:.*\s){0,3})(id=549)((?:.*\s){0,3}})
replace to:
$1id=469$3
# $1 id=469 $3
@QZLin
QZLin / winsw-alpha.json
Last active March 12, 2024 00:58
Scoop app manifests used to install pre-release version of winsw
{
"version": "v3.0.0-alpha.11",
"description": "A wrapper executable that can be used to host any executable as a Windows service",
"homepage": "https://github.com/winsw/winsw",
"license": "MIT",
"architecture": {
"64bit": {
"url": "https://github.com/winsw/winsw/releases/download/v3.0.0-alpha.11/WinSW-x64.exe#/WinSW.exe",
"hash": "a2daa6a33a9c2b791ae31d9092e7935c339d1e03e89bfb747618ce2f4e819e20"
},

Regex

replace (WeaponUpgrades.json ... etc) ("itemDataAsset":\s*"DA_ItemBase'/.*/Rare_Resources/.*'",\s*\n\s+"amount":\s*)\d+ to $10 (its '$1'+'0')

1 .. 10 | ForEach-Object {
$n = "$(if ("$_".Length -eq 1) { "0$_" }else { "$_" })" + ".mp4"
Write-Output $n
ffmpeg -i $n -c copy $n.Replace(".mp4", "_.mp4")
Move-Item $n _del
}
"AppState"
{
"appid" "1245620"
"name" "Eldenring"
"installdir" "Eldenring"
}
@QZLin
QZLin / stellaris.regex.md
Created June 1, 2022 19:44
useful regex snippets for stellaris

find a fleet

(?\d+)={\s*name=".*"\s*fleet_template=(\d+)

val stream = ByteArrayOutputStream()
bitmap.compress(Bitmap.CompressFormat.PNG, 100, stream)
val byteArray: ByteArray = stream.toByteArray()
import socket
ip_port = ('', 9999)
server = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
server.bind(ip_port)
while True:
data, addr = server.recvfrom(1024)
print('Received:', data.decode())