Skip to content

Instantly share code, notes, and snippets.

#https://serverfault.com/questions/532065/how-do-i-diff-two-folders-in-windows-powershell/1041111#1041111
Function DirDiff { Param($a, $b, [switch]$Force, [switch]$Verbose)
$a,$b `
| DiffFolders -Force:$Force -Verbose:$Verbose `
| %{
$item = $_
switch -Exact ($item.event) {
'Added' { ">`t$($item.value)" }
'Deleted' { "<`t$($item.value)" }
@Hashbrown777
Hashbrown777 / btrfs
Last active February 2, 2024 12:47
sudo btrfs filesystem usage -T /mnt/*
btrfs fi df /mnt/*
sudo btrfs device stats /mnt/*
@Hashbrown777
Hashbrown777 / discordplayvideo.md
Last active November 9, 2023 09:42
play discord videos instead of downloading them
@Hashbrown777
Hashbrown777 / alignbytes.ps1
Last active September 28, 2023 02:32
Resizes files anchoring to EOF
'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
@Hashbrown777
Hashbrown777 / _wireguard.ps1
Last active September 7, 2023 14:45
Multiple wireguard connexions with an open port on each (azirevpn)
./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)
@Hashbrown777
Hashbrown777 / monitoring.sh
Last active October 27, 2023 09:02
Assorted commands
#top for networking
sudo iftop -P -B
#shows connexions going through listened port
sudo tcptrack -i eno1 port 8080
#get process listening on port
sudo netstat -tulpn | ag 8080
#top for disks
@Hashbrown777
Hashbrown777 / free.ps1
Created July 8, 2023 15:22
free up space on my c drive
cd $env:LOCALAPPDATA
(
'Ubisoft*',
'Grip',
'Evil*',
'ride3',
'Squad*',
'Remnant',
'Mordhau',
'Dead*',
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
}
@Hashbrown777
Hashbrown777 / _NetLbfoTeam.ps1
Created June 19, 2023 15:53
After extracting the needed files, get `New-NetLbfoTeam` working in win10
try {
Switch ($args[0]) {
#entrypoint
$NULL {
if (!(Start-Process `
-FilePath 'PsExec' `
-ArgumentList (
'-s',
'-nobanner',
'-accepteula',