From 212f7027575c31fc4f96b1323813cae1c915eff7 Mon Sep 17 00:00:00 2001 From: exsersewo Date: Fri, 15 Jan 2021 23:25:27 +0000 Subject: [PATCH] Init --- .gitignore | 7 +++ 2mp3.ps1 | 10 ++++ applysshkey.ps1 | 8 +++ ff2gif.ps1 | 8 +++ ff2sgif.ps1 | 8 +++ ffdash.ps1 | 10 ++++ ffscale.ps1 | 5 ++ getKeys.ps1 | 41 ++++++++++++++ rtdownloader.ps1 | 14 +++++ screenfetch.ps1 | 140 +++++++++++++++++++++++++++++++++++++++++++++++ ytdlbae-w.ps1 | 8 +++ ytdlbae.ps1 | 8 +++ ytdlbve.ps1 | 8 +++ 13 files changed, 275 insertions(+) create mode 100644 .gitignore create mode 100644 2mp3.ps1 create mode 100644 applysshkey.ps1 create mode 100644 ff2gif.ps1 create mode 100644 ff2sgif.ps1 create mode 100644 ffdash.ps1 create mode 100644 ffscale.ps1 create mode 100644 getKeys.ps1 create mode 100644 rtdownloader.ps1 create mode 100644 screenfetch.ps1 create mode 100644 ytdlbae-w.ps1 create mode 100644 ytdlbae.ps1 create mode 100644 ytdlbve.ps1 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..05b8546 --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +netling/ +*.exe +*.hlp +*.a +*.lib +*.dll +*.lnk \ No newline at end of file diff --git a/2mp3.ps1 b/2mp3.ps1 new file mode 100644 index 0000000..f0d0c68 --- /dev/null +++ b/2mp3.ps1 @@ -0,0 +1,10 @@ +$file = $args[0] + +if ($file -eq $null) +{ + $file = Read-Host -Prompt "Enter filename" +} + +$filenew = $file.Substring(0,$file.Length-4) + +ffmpeg -i `"$file`" -vn -ar 44100 -ac 2 -ab 320k -f mp3 `"$filenew.mp3`" \ No newline at end of file diff --git a/applysshkey.ps1 b/applysshkey.ps1 new file mode 100644 index 0000000..f8d9675 --- /dev/null +++ b/applysshkey.ps1 @@ -0,0 +1,8 @@ +$destinationHost = $args[0] + +if ($destinationHost -eq $null) +{ + $destinationHost = Read-Host -Prompt "Enter Host (e.g. root@contoso.com)" +} + +type $env:USERPROFILE\.ssh\id_rsa.pub | ssh $destinationHost '[ -d .ssh ] || mkdir .ssh; cat >> .ssh/authorized_keys' \ No newline at end of file diff --git a/ff2gif.ps1 b/ff2gif.ps1 new file mode 100644 index 0000000..7c16594 --- /dev/null +++ b/ff2gif.ps1 @@ -0,0 +1,8 @@ +$palname = $args[1]+'-palette.png' + +if(![System.IO.File]::Exists($palname)) +{ + ffmpeg -i $args[0] -vf fps=60,scale=480:-1:flags=lanczos,palettegen $palname +} + +ffmpeg -i $args[0] -i $palname -filter_complex "fps=30,scale=400:-1:flags=lanczos[x];[x][1:v]paletteuse" $args[1] \ No newline at end of file diff --git a/ff2sgif.ps1 b/ff2sgif.ps1 new file mode 100644 index 0000000..245ca75 --- /dev/null +++ b/ff2sgif.ps1 @@ -0,0 +1,8 @@ +$palname = $args[1]+'-palette.png' + +if(![System.IO.File]::Exists($palname)) +{ + ffmpeg -i $args[0] -vf fps=5,scale=-1:50:flags=lanczos,palettegen $palname +} + +ffmpeg -i $args[0] -i $palname -filter_complex "fps=5,scale=-1:50:flags=lanczos[x];[x][1:v]paletteuse" $args[1] \ No newline at end of file diff --git a/ffdash.ps1 b/ffdash.ps1 new file mode 100644 index 0000000..f64d271 --- /dev/null +++ b/ffdash.ps1 @@ -0,0 +1,10 @@ +$file = $args[0] + +#Audio Process +ffmpeg -i $file -vn -acodec libvorbis -ab 128k -dash 1 audio_128k.webm + +#Video Process +ffmpeg -i $file -c:v libvpx-vp9 -keyint_min 150 -g 150 -tile-columns 4 -frame-parallel 1 -f webm -dash 1 -an -vf scale=640:480 -b:v 1000k -dash 1 -preset fast video_640x480_1000k.webm -an -vf scale=1280:720 -b:v 1500k -dash 1 -preset fast video_1280x720_1500k.webm + +#Video Manifest +ffmpeg -f webm_dash_manifest -i video_640x480_1000k.webm -f webm_dash_manifest -i video_1280x720_1500k.webm -f webm_dash_manifest -i audio_128k.webm -c copy -map 0 -map 1 -map 2 -f webm_dash_manifest -adaptation_sets "id = 0, streams = 0, 1 id = 1, streams = 3" video_manifest.mpd \ No newline at end of file diff --git a/ffscale.ps1 b/ffscale.ps1 new file mode 100644 index 0000000..868f5ac --- /dev/null +++ b/ffscale.ps1 @@ -0,0 +1,5 @@ +$file = $args[0] +$fileout = $args[1] +$scale = $args[2] + +ffmpeg -i $file -filter:v scale=$scale -c:a copy -map 0 -preset veryfast -movflags +faststart $fileout \ No newline at end of file diff --git a/getKeys.ps1 b/getKeys.ps1 new file mode 100644 index 0000000..d9f7427 --- /dev/null +++ b/getKeys.ps1 @@ -0,0 +1,41 @@ +$pfxLocation = $args[0] + +if ($pfxLocation -eq $null) { + $pfxLocation = Read-Host -Prompt "Enter PFX Location" +} + +$password = Read-Host -AsSecureString -Prompt "Enter Password" +$password = ConvertFrom-SecureString -SecureString $password -AsPlainText + +if(!$pfxLocation.EndsWith(".pfx")) { + $pfxLocation = $pfxLocation+".pfx" +} + +$pfxLocationWithoutExt = $pfxLocation.Replace(".pfx", "") + +$pfxFilePath = "`"$($pfxLocation)`"" + +$caCrt = "`"$($pfxLocationWithoutExt)-ca.crt`"" +$crt = "`"$($pfxLocationWithoutExt).crt`"" +$encryptedKey = "`"$($pfxLocationWithoutExt)-encrypted.key`"" +$key = "`"$($pfxLocationWithoutExt).key`"" +$fullCrt = "`"$($pfxLocationWithoutExt)-full.crt`"" + +#ca-cert +openssl pkcs12 -in $pfxLocation -nodes -nokeys -cacerts -out $caCrt -passin pass:$password + +#key file +openssl pkcs12 -in $pfxLocation -nocerts -out $encryptedKey -passin pass:$password -passout pass:$password + +#key decrypt +openssl rsa -in $encryptedKey -out $key -passout pass:$password + +#cert +openssl pkcs12 -in $pfxLocation -clcerts -nokeys -out $crt -passin pass:$password + +$crt = "$($pfxLocationWithoutExt).crt" +$caCrt = "$($pfxLocationWithoutExt)-ca.crt" +$fullCrt = "$($pfxLocationWithoutExt)-full.crt" + +#join files +Get-Content $crt, $caCrt | Set-Content $fullCrt \ No newline at end of file diff --git a/rtdownloader.ps1 b/rtdownloader.ps1 new file mode 100644 index 0000000..a0fa816 --- /dev/null +++ b/rtdownloader.ps1 @@ -0,0 +1,14 @@ +$url = $args[0] +$file = $args[1] + +if($url -eq $null) +{ + $url = Read-Host -Prompt "Enter url that trails with .m3u8" +} + +if($file -eq $null) +{ + $file = Read-Host -Prompt "Enter destination file+extension" +} + +ffmpeg -i $url -c copy -bsf:a aac_adtstoasc $file \ No newline at end of file diff --git a/screenfetch.ps1 b/screenfetch.ps1 new file mode 100644 index 0000000..c92f220 --- /dev/null +++ b/screenfetch.ps1 @@ -0,0 +1,140 @@ +#### Screenfetch for powershell +#### Author Julian Chow + +Add-Type -AssemblyName System.Windows.Forms + +####### Functions ######## +Function Get-PrimaryResolution{ Param ($monitorArray) + foreach ($monitor in $monitorArray){ + if($monitor.Primary){ + $primaryResolution = [System.Tuple]::Create($monitor.Bounds.Width, $monitor.Bounds.Height); + return $primaryResolution; + } + } +} + +####### Information Collection ######### + +## Resolution Information +$PrimaryResolution = Get-PrimaryResolution([System.Windows.Forms.Screen]::AllScreens); +$Horizontal = $PrimaryResolution.Item1; +$Vertical = $PrimaryResolution.Item2; + +## Uptime Information +$uptime = ((gwmi Win32_OperatingSystem).ConvertToDateTime((gwmi Win32_OperatingSystem).LocalDateTime) - + (gwmi Win32_OperatingSystem).ConvertToDateTime((gwmi Win32_OperatingSystem).LastBootUpTime)); + +## Disk Information +# Available Space +$FreeDiskSize = (gwmi Win32_LogicalDisk).FreeSpace | select -f 1; +$FreeDiskSizeGB = $FreeDiskSize / 1073741824; +$FreeDiskSizeGB = "{0:N0}" -f $FreeDiskSizeGB; +# Total Space +$DiskSize = (gwmi Win32_LogicalDisk).size | select -f 1; +$DiskSizeGB = $DiskSize / 1073741824; +$DiskSizeGB = "{0:N0}" -f $DiskSizeGB; +$FreeDiskPercent = ($FreeDiskSizeGB / $DiskSizeGB) * 100; +$FreeDiskPercent = "{0:N0}" -f $FreeDiskPercent; +# Used Space +$UsedDiskSizeGB = $DiskSizeGB - $FreeDiskSizeGB; +$UsedDiskPercent = ($UsedDiskSizeGB / $DiskSizeGB) * 100; +$UsedDiskPercent = "{0:N0}" -f $UsedDiskPercent; + +## Environment Information +$Username = $env:username; +$Machine = (gwmi Win32_OperatingSystem).CSName; +$OS = (gwmi Win32_OperatingSystem).Caption; +$BitVer = (gwmi Win32_OperatingSystem).OSArchitecture; +$Kernel = (gwmi Win32_OperatingSystem).Version; + +## Hardware Information +$Motherboard = Get-CimInstance Win32_BaseBoard | Select-Object Manufacturer, Product; +$CPU = (((gwmi Win32_Processor).Name) -replace '\s+', ' '); +$GPU = (gwmi Win32_DisplayConfiguration).DeviceName; +$FreeRam = ([math]::Truncate((gwmi Win32_OperatingSystem).FreePhysicalMemory / 1KB)); +$TotalRam = ([math]::Truncate((gwmi Win32_ComputerSystem).TotalPhysicalMemory / 1MB)); +$UsedRam = $TotalRam - $FreeRam; +$FreeRamPercent = ($FreeRam / $TotalRam) * 100; +$FreeRamPercent = "{0:N0}" -f $FreeRamPercent; +$UsedRamPercent = ($UsedRam / $TotalRam) * 100; +$UsedRamPercent = "{0:N0}" -f $UsedRamPercent; + +####### Printing Output ######### + +# Line 1 - HostName +Write-Host " ....:::: " -f Cyan -NoNewline; +Write-Host $Username -f red -nonewline; +Write-Host "@" -f gray -nonewline; +Write-Host $Machine -f red; + +# Line 2 - OS +Write-Host " ....:::::::::::: " -f Cyan -NoNewline; +Write-Host "OS: " -f Red -NoNewline; +Write-Host $OS $BitVer; + +# Line 3 - Kernel +Write-Host " ....:::: :::::::::::::::: " -f Cyan -NoNewline; +Write-Host "Kernel: " -f Red -nonewline; +Write-Host $Kernel; + +# Line 4 - Uptime +Write-Host "....:::::::::::: :::::::::::::::: " -f Cyan -NoNewline; +Write-Host "Uptime: " -f Red -nonewline; +Write-Host $uptime.Days"d " $uptime.Hours"h " $uptime.Minutes"m " $uptime.Seconds"s " -separator ""; + +# Line 5 - Motherboard +Write-Host ":::::::::::::::: :::::::::::::::: " -f Cyan -NoNewline; +Write-Host "Motherboard: " -f Red -nonewline; +Write-Host $Motherboard.Manufacturer $Motherboard.Product; + +# Line 6 - Shell (Hardcoded since it is unlikely anybody can run this without powershell) +Write-Host ":::::::::::::::: :::::::::::::::: " -f Cyan -NoNewline; +Write-Host "Shell: " -f Red -nonewline; +Write-Host "PowerShell $($PSVersionTable.PSVersion.ToString())" + +# Line 7 - Resolution (for primary monitor only) +Write-Host ":::::::::::::::: :::::::::::::::: " -f Cyan -NoNewline; +Write-Host "Resolution: " -f Red -NoNewline; +Write-Host $Horizontal "x" $Vertical; + +# Line 8 - Windows Manager (HARDCODED, sorry bbzero users) +Write-Host ":::::::::::::::: :::::::::::::::: " -f Cyan -NoNewline; +Write-Host "Window Manager: " -f Red -nonewline; +Write-Host "DWM"; + +# Line 10 - Font (HARDCODED) +Write-Host "................ ................ " -f Cyan -NoNewline; +Write-Host "Font: " -f Red -nonewline; +Write-Host "Segoe UI"; + +# Line 11 - CPU +Write-Host ":::::::::::::::: :::::::::::::::: " -f Cyan -NoNewline; +Write-Host "CPU: " -f Red -nonewline; +Write-Host $CPU; + +# Line 12 - GPU +Write-Host ":::::::::::::::: :::::::::::::::: " -f Cyan -NoNewline; +Write-Host "GPU: " -f Red -nonewline; +Write-Host $GPU; + +# Line 13 - Ram +Write-Host ":::::::::::::::: :::::::::::::::: " -f Cyan -NoNewline; +Write-Host "RAM: " -f Red -nonewline; +Write-Host $UsedRam "MB / $TotalRam MB" -NoNewline; +Write-Host " (" -NoNewline +Write-Host $UsedRamPercent"%" -f Green -NoNewline; +Write-Host ")"; + +# Line 13 - Disk Usage +Write-Host "'''':::::::::::: :::::::::::::::: " -f Cyan -NoNewline; +Write-Host "Disk: " -f Red -NoNewline; +Write-Host $UsedDiskSizeGB"GB" " / " $DiskSizeGB"GB" -NoNewline; +Write-Host " (" -NoNewline; +Write-Host $UsedDiskPercent"%" -f Green -NoNewline; +Write-Host ")"; + +# Empty Lines +Write-Host " '''':::: :::::::::::::::: " -f Cyan; +Write-Host " '''':::::::::::: " -f Cyan; +Write-Host " '''':::: " -f Cyan; + diff --git a/ytdlbae-w.ps1 b/ytdlbae-w.ps1 new file mode 100644 index 0000000..1c3f78f --- /dev/null +++ b/ytdlbae-w.ps1 @@ -0,0 +1,8 @@ +$url = $args[0] + +if ($url -eq $null) + { + $url = Read-Host -Prompt "Enter url" + } + +youtube-dl --extract-audio --audio-format wav --audio-quality 0 -i --output "%(title)s.%(ext)s" $url \ No newline at end of file diff --git a/ytdlbae.ps1 b/ytdlbae.ps1 new file mode 100644 index 0000000..9624a57 --- /dev/null +++ b/ytdlbae.ps1 @@ -0,0 +1,8 @@ +$url = $args[0] + +if ($url -eq $null) + { + $url = Read-Host -Prompt "Enter url" + } + +youtube-dl --extract-audio --audio-format m4a --audio-quality 0 -i --output "%(title)s.%(ext)s" $url \ No newline at end of file diff --git a/ytdlbve.ps1 b/ytdlbve.ps1 new file mode 100644 index 0000000..5dbd1d8 --- /dev/null +++ b/ytdlbve.ps1 @@ -0,0 +1,8 @@ +$url = $args[0] + +if ($url -eq $null) + { + $url = Read-Host -Prompt "Enter url" + } + +youtube-dl -f 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/bestvideo+bestaudio' -i --merge-output-format mp4 --output "%(title)s.%(ext)s" $url \ No newline at end of file