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 / get_chrome.py
Last active December 12, 2024 03:51
Python: script to download and extract chrome installer
#!/usr/bin/env python3
import glob
import json
import msvcrt
import os
import requests
import shutil
import subprocess
@eddiezato
eddiezato / genloss.ps1
Last active November 5, 2024 07:05
PowerShell: script to test 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 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 / 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 / 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 / _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 / 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()]