Skip to content

Instantly share code, notes, and snippets.

@andreasbotsikas
andreasbotsikas / startup.cmd
Last active January 5, 2024 14:38
Windows Sandbox install VC_redist.x64
C:\Users\WDAGUtilityAccount\Desktop\VC_redist.x64.exe /install /quiet /norestart
@andreasbotsikas
andreasbotsikas / GetVolumes.ps1
Created September 3, 2023 20:07
Get HardDiskVolumes
$signature = @'
[DllImport("kernel32.dll", SetLastError=true)]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool GetVolumePathNamesForVolumeNameW([MarshalAs(UnmanagedType.LPWStr)] string lpszVolumeName,
[MarshalAs(UnmanagedType.LPWStr)] [Out] StringBuilder lpszVolumeNamePaths, uint cchBuferLength,
ref UInt32 lpcchReturnLength);
[DllImport("kernel32.dll", SetLastError = true)]
public static extern IntPtr FindFirstVolume([Out] StringBuilder lpszVolumeName,
uint cchBufferLength);
@REM Based onhttps://superuser.com/questions/139665/how-to-save-rdp-credentials-into-a-file
cmdkey /generic:8.8.8.8 /user:azureuser /password:mypassword
cmdkey /list
cmdkey /delete:8.8.8.8
@andreasbotsikas
andreasbotsikas / Quickstart.sh
Created July 4, 2023 15:13
virtual-machine-manager tips
virsh list --a
virsh destroy win11
virsh dumpxml win11
virsh start win11
@andreasbotsikas
andreasbotsikas / convert.ps1
Created June 16, 2023 13:57
Base64 encoding text
$encodedText = [System.Convert]::ToBase64String([System.Text.Encoding]::Unicode.GetBytes("<MESSAGE>"))
[System.Text.Encoding]::Unicode.GetString([Convert]::FromBase64String($encodedText))
@andreasbotsikas
andreasbotsikas / module.vb
Created June 7, 2023 09:18
Macro to move meeting responses in outlook
Sub Move_calendar_responses()
Dim objOutlook As Outlook.Application
Dim objNamespace As Outlook.NameSpace
Dim objInboxFolder As Outlook.MAPIFolder
Dim objDestFolder As Outlook.MAPIFolder
Set objOutlook = Application
Set objNamespace = objOutlook.GetNamespace("MAPI")
Set objInboxFolder = objNamespace.GetDefaultFolder(olFolderInbox)
@andreasbotsikas
andreasbotsikas / ApplyWindowsImage.bat
Last active December 31, 2022 12:06
Dual boot multiple windows operating systems
dism /Apply-Image /ImageFile:c:\tmp\install.wim /Index:1 /ApplyDir:P:\
@andreasbotsikas
andreasbotsikas / convert-mpg-to-mp4.bat
Last active December 8, 2022 20:17
Convert VHS mpg files to mp4
@REM Convert mpg files to ac3 with 128k autio and video encoded with libx264
@REM If you get unknown codec, get a build with the flag, e.g. https://www.gyan.dev/ffmpeg/builds/
forfiles /s /m *.mpg /c "cmd /c ffmpeg -i @file -codec:a aac -ar 44100 -b:a 128k -codec:v libx264 @fname.mp4"
@andreasbotsikas
andreasbotsikas / GenerateAzureBatchRequestHeaders.ps1
Created March 17, 2021 20:05
Generate Request Headers For Azure Batch REST API
$Key = "your azure batch key here"
$BatchAccount = "your azure batch account here"
$endpoint = "pools" # The endpoint https://docs.microsoft.com/en-us/rest/api/batchservice/pool/list
$verb = "GET" # "POST"
$version = "2020-09-01.12.0" # Api version used
$bodySize= "" # This is the body length. You can get it with the first Auth failure
$bodyType= "" # "application/json; odata=minimalmetadata" # Content type needs to be this in POST requests
$sharedKey = [System.Convert]::FromBase64String($Key)
$date = [System.DateTime]::UtcNow.ToString("R")
@andreasbotsikas
andreasbotsikas / encode.bat
Created December 30, 2020 15:36
Encode mts video to mp4
@REM Note that we scale down the video to 720p. Expect 200Mb to be converted into 70Mb. 1M in mpeg is too broken so we selected 5M
ffmpeg.exe -i original_video.mts -filter:v scale=720:-1 -vcodec mpeg4 -b:v 5M -acodec libmp3lame -b:a 128k output_video.mp4