Skip to content

Instantly share code, notes, and snippets.

View eddiezato's full-sized avatar

eddie.zato eddiezato

  • Toha Heavy Industries
  • Tanelorn
View GitHub Profile
@eddiezato
eddiezato / genloss.ps1
Last active April 30, 2024 08:36
Generation loss (cjpeg, cjpegli, cjxl)
param (
[Alias('f')][string] $File = '0.png',
[Alias('i')][switch] $Images,
[Alias('v')][switch] $Video
)
function Start-Gen {
param ([string] $Encoder, [string] $InFile, [long] $TargetSize, [string[]] $ExOptions = @(), [string] $Title, [string] $Font, [string] $Color)
$MergeFile = $InFile -replace '\.png$', '_.png'
switch ($Encoder) { 'cjpeg' { $OutExt = '.jpg' }; 'cjpegli' { $OutExt = '.jpg' }; 'avifenc' { $OutExt = '.avif' }; 'cjxl' { $OutExt = '.jxl' }}
$OutFile = $InFile -replace '\.png$', $OutExt
@eddiezato
eddiezato / qbt.sh
Created December 13, 2023 16:16
Build qBittorrent in msys2/clang64
#!/bin/bash
while getopts 'cbd' flag ; do
case "${flag}" in
c) CLNFL=1 ;; # remove folder
b) BLD=1 ;; # build
d) DPL=1 ;; # deploy
esac
done
set -e
@eddiezato
eddiezato / yacr.sh
Last active December 13, 2023 16:16
Build yacreader without yaclibrary in msys2/clang64
#!/bin/bash
while getopts 'csajpyd' flag ; do
case "${flag}" in
c) CLR=1 ;; # remove clang folder
s) DSRC=1 ;; # download source-code
a) BAVIF=1 ;; # build libavif
j) BJXL=1 ;; # build libjxl
p) BPLGS=1 ;; # build plugins
y) BYACR=1 ;; # build yacreader
d) DYACR=1 ;; # deploy yacreader
@eddiezato
eddiezato / qimgv.sh
Last active December 13, 2023 16:16
Build qimgv in msys2/ucrt64
#!/bin/bash
while getopts 'csajpeoqd' flag ; do
case "${flag}" in
c) CLR=1 ;; # remove ucrt folder
s) DSRC=1 ;; # download source-code
a) BAVIF=1 ;; # build libavif
j) BJXL=1 ;; # build libjxl
p) BPLGS=1 ;; # build plugins
e) BEXIV=1 ;; # build exiv2
o) BOPCV=1 ;; # build opencv
@eddiezato
eddiezato / gen_lnk.ps1
Last active March 21, 2022 06:12
Generate .lnk for Google Chrome
$shell = New-Object -comObject WScript.Shell
$shortcut = $shell.CreateShortcut("$PSScriptRoot\chrome.lnk")
$shortcut.TargetPath = "$PSScriptRoot\App\chrome.exe"
$shortcut.WorkingDirectory = "$PSScriptRoot\App"
$shortcut.Arguments = (
'--user-data-dir=..\UserData',
'--disk-cache-size=104857600',
'--disable-component-update',
'--disable-default-apps',
'--disable-sync',
@eddiezato
eddiezato / toast.ps1
Created February 8, 2022 05:10
Toast Notification for PowerShell 5.1
$null = [Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime]
$null = [Windows.Data.Xml.Dom.XmlDocument, Windows.Data.Xml.Dom.XmlDocument, ContentType = WindowsRuntime]
$Title = "Test"
$Message = "Test"
$XmlString = @"
<toast>
<visual>
<binding template="ToastGeneric">
@eddiezato
eddiezato / ssdwrites.ps1
Created January 9, 2022 05:17
Monitor SSD total lbas writes
Set-Location $PSScriptRoot
$tJson = .\smartctl.exe -j -A /dev/sda | ConvertFrom-Json
$totallba = ($tJson.ata_smart_attributes.table | where { $_.id -eq 241 }).raw.value
$lasttlba = Get-Content -Path "last"
$inGB = ([Math]::Round($totallba * 512 / 1GB, 2)).ToString("0.00")
$diff = ([Math]::Round(($totallba - $lasttlba) * 512 / 1MB, 2)).ToString("0.00")
$curDT = (Get-Date -Format "yyyy/MM/dd HH:mm:ss")
@eddiezato
eddiezato / realesrgan_all.ps1
Created November 30, 2021 05:42
PowerShell script to process images in the current folder using realesrgan
param (
[string[]] $Filter = @("*.jpg","*.jpeg")
)
Get-ChildItem -Path * -File -Include $Filter | Foreach-Object {
$i = 0
Write-Progress -Activity $_.Name -Status " $i%" -PercentComplete $i
$job = Start-Job -ArgumentList $_.Name,"temp.png","$($_.Basename)_new.png" -ScriptBlock {
realesrgan -i $args[0] -o $args[1] *>&1
magick $args[1] -resize x3056 $args[2] *>&1
}
@eddiezato
eddiezato / GetChrome.ps1
Last active February 8, 2022 04:21
Get Google Chrome Offline Installer URLs [Windows x64] [PowerShell]
$request_json = @"
{
"request": {
"protocol": "3.1",
"dedup": "cr",
"ismachine": 1,
"hw": {
"physmemory": "16",
"sse3": "1",
"avx": "1"
@eddiezato
eddiezato / _vscupdate.ps1
Last active November 5, 2021 03:46
Powershell script to update VS Code
$downloadpath = "D:\Downloads"
$curversion = (Get-Content -Path "resources\app\package.json" | ConvertFrom-Json).version
$newversion = (Invoke-WebRequest -Uri "https://api.github.com/repos/microsoft/vscode/releases/latest" | ConvertFrom-Json).tag_name
Write-Host "Visual Studio Code - Updater" -ForegroundColor Cyan
Write-Host "Current version: " -NoNewLine
Write-Host $curversion -ForegroundColor Yellow
Write-Host "New version: " -NoNewLine
Write-Host $newversion -ForegroundColor Green
$choice = Read-Host -Prompt "Type 'y' or 'yes' to update current version"
If (-not ($choice.ToLower() -in @("y", "yes"))) { exit }