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 / 7zip_multiextract.ps1
Created September 24, 2020 07:31
7zip extract
Write-Host "Extracting:"
$start = (Get-Date)
For ($i = 0; $i -lt $Args.Count; $i++) {
If (Test-Path -LiteralPath $Args[$i] -PathType Leaf) {
$name = (Get-Item -LiteralPath $Args[$i]).Name
$parent = (Get-Item -LiteralPath $Args[$i]).Directory.FullName
$current = ($i + 1).ToString().PadLeft($Args.Count.ToString().Length, "0")
Write-Host "[$($current)/$($Args.Count)] archive " -NoNewLine
Write-Host "$($name)" -ForegroundColor magenta
$archiveroot = (7z l "$($Args[$i])" -x!*\* | Select-Object -Last 1)
@eddiezato
eddiezato / 7zip_multipack.ps1
Created September 24, 2020 07:32
7zip pack
Write-Host "Archiving:"
$start = (Get-Date)
For ($i = 0; $i -lt $Args.Count; $i++) {
$source = $Args[$i]
$type = "file"
If (Test-Path -LiteralPath $source -PathType Container) {
$source += "\\*"
$type = "folder"
}
$name = (Get-Item -LiteralPath $Args[$i]).Name
@eddiezato
eddiezato / _updateFar.ps1
Last active November 8, 2021 05:38
Update FAR Manager script
$farpath = Get-Location
Write-Host "Script for update Far Manager" -ForegroundColor Blue
$others = @("changelog", "Far.exe.example.ini", "Addons", "Documentation", "Encyclopedia",
"PluginSDK", "SaveOldPluginSettings.cmd", "RestoreOldPluginSettings.cmd",
"*bel.hlf", "*bel.lng", "*cze.hlf", "*cze.lng", "*ger.hlf", "*ger.lng", "*hun.hlf",
"*hun.lng", "*ita.hlf", "*ita.lng", "*lit.hlf", "*lit.lng", "*pol.hlf", "*pol.lng",
"*sky.hlf", "*sky.lng", "*spa.hlf", "*spa.lng", "*ukr.hlf", "*ukr.lng")
$ver = (Test-Path -Path "File_id.diz") ? (Get-Content -Path "File_id.diz")[0] : "undefined"
Write-Host "Current version: " -NoNewLine
Write-Host $ver -ForegroundColor Magenta
@eddiezato
eddiezato / sevenzipsharp.ps1
Last active October 27, 2020 12:57
Sample pwsh script for extract with sevenzipsharp
Add-Type -Path "$PSScriptRoot\SevenZipSharp.dll"
[SevenZip.SevenZipBase]::SetLibraryPath("$Env:UserProfile\Portable\Console\7z.dll")
$zipfile = New-Object SevenZip.SevenZipExtractor("$PSScriptRoot\armando_huerta.zip")
$temp = ($zipfile.ArchiveFileNames | Where-Object { -not $_.Contains("\") })
$null = Register-ObjectEvent -InputObject $zipfile -EventName "Extracting" -SourceIdentifier "Extracting" -Action {
Write-Progress -Activity "armando_huerta.zip" -Status "Extracting" -PercentComplete $EventArgs.PercentDone
}
$null = Register-ObjectEvent -InputObject $zipfile -EventName "ExtractionFinished" -SourceIdentifier "ExtractionFinished" -Action {
Stop-Job -Name "Extracting"
@eddiezato
eddiezato / jpgopt.ps1
Created March 29, 2021 09:24
Optimizing 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 May 8, 2022 11:20
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 February 10, 2024 08:10
Get Microsoft Edge Offline Installer (can be extracted with 7zip) [PowerShell 5.1+]
# 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 / c2jxl.ps1
Last active November 23, 2021 08:36
Powershell script for encoding image folders to JXL
param (
[Parameter(Mandatory, ParameterSetName="folders")]
[string[]] $F, # folders by comma
[Parameter(Mandatory, ParameterSetName="listfile")]
[string] $L, # list with folders
[ValidateSet(1, 2, 3, 4)]
[int] $T = 2, # Number of files processed simultaneously
[ValidateSet(1, 2, 3, 4, 5, 6, 7, 8, 9)]
[int] $E = 7, # cjxl effort/speed
[string] $P = "", # cjxl parameters
@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 }
@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"