Skip to content

Instantly share code, notes, and snippets.

@Hashbrown777
Hashbrown777 / albums.ps1
Last active May 23, 2026 07:18
Defensively use AlbumData.xml to convert `./Masters/YYYY/MM/DD/yyyymmdd-xxyyzz/*.{jpg,MOV,png}` into `./$album/{IMG,VID}_$year$month$day_$hour$minute$second.$ext` without losing/corrupting date data.
#interpret the object version of iPhoto's AlbumData.xml
Function AlbumData { Param($root)
$images = @{}
$captions = @{}
$root.'Master Image List'.psobject.properties `
| %{
$key = $_.Name
$_ = $_.Value
if ($key -in $duplicates) {
@Hashbrown777
Hashbrown777 / jellyfin_inter.conf
Created April 11, 2026 01:52
Basic Auth for Jellyfin
#reverse proxy
server {
include inter.ssl;
listen unix:/tmp/jellyfin.sock ssl;
# server_name jellyfin;
client_max_body_size 0;
# location = Authorization {
@Hashbrown777
Hashbrown777 / necesse_extract.ps1
Last active October 23, 2025 00:36
Extract the files from inside Necesse `res.data` file
if (![System.BitConverter]::IsLittleEndian) {
throw [System.BitConverter]::IsLittleEndian
}
$resources = [System.IO.FileStream]::new(
'res.data',
[System.IO.FileMode]::Open,
[System.IO.FileAccess]::Read
)
@Hashbrown777
Hashbrown777 / dl.ps1
Created July 17, 2025 02:48
Upload and download from an nginx fileserver
#!/bin/pwsh
#Downloads matching items from the given url to the current directory
. $PSScriptRoot/l.ps1
$auth = Get-Credential
$from = 'https://some-web.site:1337/directory/root/'
$filter = (
'things we',
'might*want',
'to',
#Gets the methods you need to override to create a subclass of the given type
Filter GetOverrides { Param($filter)
if (!$filter) {
$filter = [System.Reflection.MethodAttributes]::Virtual -bor [System.Reflection.MethodAttributes]::Abstract
}
$type = $_
$type.GetMembers() `
| ?{ $_.DeclaringType -eq $type -and $_.Attributes -band $filter } `
| Sort-Object -Property 'Name' `
| PrintMembers
@Hashbrown777
Hashbrown777 / BDecode.ps1
Last active December 30, 2024 03:52
Decode's bencoded data from a file into a powershell structure
<#Decode's bencoded data from a file
# -Pieces enables reading of piece data, otherwise stops parsing when it sees this list start (to save time)
# -Ignore ignores errors such as duplicate key names in dictionaries (new entries are discarded)
# -Parse recognised object entries from bittorrent clients are parsed (eg comments & filepaths as utf8, pieces, if enabled, as hexstrings)
# -Debug outputs extra info to the console regarding the place in the encoded object we are currently reading for when an error occurs
#>
Param([switch]$Pieces, [switch]$Ignore, [switch]$Parse, [switch]$Debug)
$state = [PSCustomObject]@{
key = $NULL
output = $NULL
#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