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 / updateFar.ps1
Last active November 5, 2024 06:59
PowerShell: script to update FAR Manager
function Select-Button {
param(
[string]$Prompt,
[string[]]$Buttons,
[uint]$Position
)
"$Prompt " | Write-Host -NoNewline -ForegroundColor Magenta
$cursor = $Host.UI.RawUI.CursorPosition
$Panel = {
$panel_ = ''
@eddiezato
eddiezato / jpgopt.ps1
Last active November 5, 2024 07:01
PowerShell: script to optimize JPEG files with mozjpegtran
Clear-Host
$host.ui.RawUI.WindowTitle = "JPEG Optimizer"
[Console]::CursorVisible = $false
$Host.PrivateData.ProgressBackgroundColor = "Gray"
$Host.PrivateData.ProgressForegroundColor = "Black"
Class ResultItem {
[string]$Name
[string]$Files_processed
[string]$Size_MB
@eddiezato
eddiezato / taktest.ps1
Last active November 5, 2024 07:01
PowerShell: script to test takc 2.3.0 and 2.3.1
[CmdletBinding()]
param (
[Parameter(Mandatory, ValueFromPipeline, Position = 0)]
[ValidatePattern('\.wav$', ErrorMessage = "You should specify .wav files")]
[string[]]$Input,
[Parameter(Position = 1)][Alias('p')]
[uint]$Passes = 10
)
process {
Class Result {
@eddiezato
eddiezato / EdgeCheck.ps1
Last active November 5, 2024 07:02
PowerShell [5.1+]: script to get Microsoft Edge Offline Installers (can be extracted with 7zip)
# params
[CmdletBinding(DefaultParameterSetName="Casual")]
param (
[Alias("c")]
[Parameter(ParameterSetName = "Pro", Mandatory = $true)]
[ValidateSet("stable", "beta", "dev", "canary")]
[string]$Channel,
[Alias("v")]
[Parameter(ParameterSetName = "Pro", Mandatory = $true)]
[ValidateNotNullOrEmpty()]
@eddiezato
eddiezato / _vscupdate.ps1
Last active November 5, 2024 07:02
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 }
@eddiezato
eddiezato / ssdwrites.ps1
Last active November 5, 2024 07:03
PowerShell: script to 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 / toast.ps1
Last active November 5, 2024 07:03
PowerShell [5.1]: Toast Notification
$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 / gen_lnk.ps1
Last active November 5, 2024 07:04
PowerShell: script to generate .lnk for Google Chrome
$shell = New-Object -comObject WScript.Shell
$shortcut = $shell.CreateShortcut("$PSScriptRoot\Google Chrome.lnk")
$shortcut.TargetPath = "$PSScriptRoot\app\chrome.exe"
$shortcut.WorkingDirectory = "$PSScriptRoot\app"
$shortcut.Arguments = (
'--user-data-dir=Z:\ChromeData',
'--disk-cache-size=104857600',
'--disable-component-update',
'--disable-default-apps',
'--disable-sync',
@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 / 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