Skip to content

Instantly share code, notes, and snippets.

@eugrus
eugrus / cs.ps1
Last active January 4, 2025 20:30
PowerShell loader for C# code
param([string]$CSFilePath)
Add-Type -LiteralPath $CSFilePath -IgnoreWarnings
[Program]::Main(@())
@eugrus
eugrus / Rubrumauslese.ps1
Last active November 25, 2024 15:49
Rubrum eines anwaltlichen Schreibens auslesen
function Rubrumauslese () {
$wordApp = [Runtime.Interopservices.Marshal]::GetActiveObject('Word.Application')
$doc = $wordApp.ActiveDocument
$documentText = $doc.Content.Text -replace '\r',[System.Environment]::Newline
$Az = [regex]::match($documentText, '\d{1,5}/\d{2}').Value
$Mandant, $Gegner = ((Select-String -InputObject $documentText -Pattern '.*\./\..*').matches.value -split './.').trim()
[System.Runtime.Interopservices.Marshal]::ReleaseComObject($wordApp) | Out-Null
@eugrus
eugrus / OpenURLs.ps1
Created November 21, 2024 14:39
Open each URL from a string of arguments in browser.
# Ensure an argument is passed
if ($args.Count -eq 0) {
Write-Host "Usage: OpenURLs.ps1 '<url1> <url2> ...'"
exit
}
# Concatenate all arguments to handle multiple strings
$inputString = $args -join ' '
# Split the string into individual URLs (space-separated)
@eugrus
eugrus / Gegner.ps1
Created November 19, 2024 09:16
pwsh mandatory params; regex for ./. * -
param ([Parameter(Mandatory=$true)][string]$string)
$Gegner = [regex]::match($string, '(?<=\./\.\s)(.*?)(?=\s-|$)').Value
Write-Output $Gegner
@eugrus
eugrus / wordcopy.ps1
Created November 18, 2024 11:29
Copy all text from a Word document to clipboard
param(
[string]$filePath
)
$filePath = Resolve-Path -Path $filePath
# Ensure the file path is provided
if (-not (Test-Path $filePath)) {
Write-Error "File does not exist: $filePath"
exit 1
@eugrus
eugrus / external_camera_config.xml
Last active November 14, 2024 13:00
/vendor/etc/external_camera_config.xml or /system/vendor/etc/external_camera_config.xml on GREVA 8K (RK3528)
<ExternalCamera>
<Provider>
<ignore> <!-- Internal video devices to be ignored by external camera HAL -->
<!-- <id>0</id> --> <!-- No leading/trailing spaces -->
</ignore>
</Provider>
<!-- See ExternalCameraUtils.cpp for default values of Device configurations below-->
<Device>
<!-- Max JPEG buffer size in bytes-->
<MaxJpegBufferSize bytes="3145728"/> <!-- 3MB (~= 1080p YUV420) -->
javascript:document.body.style.backgroundColor = "white"; document.querySelectorAll('*').forEach(el => { if (window.getComputedStyle(el).color) { el.style.color = "black"; }});
#!/usr/bin/pwsh
param (
[string]$Prompt
)
if (-not $Prompt) {
$Prompt = ""
while ($true) {
$line = Read-Host ">"
param (
[string]$Prompt
)
if (-not $Prompt) {
$Prompt = ""
while ($true) {
$line = Read-Host ">"
if (-not $line) { break }
$Prompt += $line + "`n"
}
param (
[string]$Prompt
)
if (-not $Prompt) {
$Prompt = ""
while ($true) {
$line = Read-Host ">"
if (-not $line) { break }
$Prompt += $line + "`n"