This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#let the user know the current user, machine, directory, and success status of last command | |
$Script:prompt = '>' | |
function Prompt { | |
$error = !$? | |
Write-Host | |
Write-Host -NoNewline -ForegroundColor Yellow ([Environment]::UserName) | |
Write-Host -NoNewline '@' | |
Write-Host -NoNewline -ForegroundColor Cyan ([Environment]::MachineName) | |
Write-Host -NoNewline ':' | |
Write-Host -ForegroundColor Magenta $PWD.ProviderPath |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'3705688449 ,setup_cyberpunk_2077_build_4902785change_6408866_with_ep1_rl_(64bit)_(67718)-25.bin | |
2124976 ,setup_cyberpunk_2077_build_4902785change_6408866_with_ep1_rl_(64bit)_(67718).exe | |
30669496 ,setup_cyberpunk_2077_redmod_build_4902785change_6408866_with_ep1_rl_(64bit)_(67718).exe' -split '\n' ` | |
| %{ | |
$expected,$name = $_ -split ',' | |
$expected = [UInt32]$expected | |
$diff = (gci $name).Length - $expected | |
if (!$diff) { | |
return |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
./single.ps1 bob paris | |
./private.ps1 steve newyork | |
./private.ps1 greg seattle | |
./private.ps1 emma newyork | |
<# | |
Will create | |
a wireguard tunnel to paris using bob's credentials in the init [non-]namespace, | |
a tunnel to seattle with the interface name "seattle" using greg's config under the namespace "greg", | |
and two tunnels to newyork (interfaces both called 'newyork') using options from steve and emma (under namespaces of the same name respectively) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#todo explanation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class RC { | |
hidden $type = $NULL | |
hidden $code = $NULL | |
hidden $size = $NULL | |
hidden RC($type) { | |
$this.type = $type | |
$this.size = $type::New(1)[0]::MaxValue + 1 | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cd $env:LOCALAPPDATA | |
( | |
'Ubisoft*', | |
'Grip', | |
'Evil*', | |
'ride3', | |
'Squad*', | |
'Remnant', | |
'Mordhau', | |
'Dead*', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
. './metadata.ps1' | |
Function Bbcode-Row { | |
Param ([switch]$Heading, $From) | |
Begin { | |
'[tr]' | |
} | |
Process { | |
('[th]','[td]')[!$Heading] | |
if ($From) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add-Type -AssemblyName System.Drawing | |
# https://gist.github.com/Hashbrown777/fae023538705a1f3f01cd795a2314e61#file-metadata-ps1 | |
. './metadata.ps1' | |
Filter PointF { | |
[System.Drawing.PointF]::new($_[0], $_[1]) | |
} | |
Function ToArray { | |
Begin { $output = [System.Collections.ArrayList]::new() } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$blockSize = 4KB | |
$buffer=[byte[]]::new($blockSize) | |
Get-ChildItem -File ` | |
| Sort-Object -Property Length | |
| %{ | |
"$($_.Name)`t$($_.Length / 1MB -bor 0)MB" | |
$path = $_.FullName | |
#useful if your files are patchable eg torrent-sourced | |
sudo cp --reflink=always $path "${path}_rescued" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try { | |
Switch ($args[0]) { | |
#entrypoint | |
$NULL { | |
if (!(Start-Process ` | |
-FilePath 'PsExec' ` | |
-ArgumentList ( | |
'-s', | |
'-nobanner', | |
'-accepteula', |