Skip to content

Instantly share code, notes, and snippets.

@andreasbotsikas
andreasbotsikas / ExcelXmlExport.xml
Last active October 17, 2024 21:31
Import Excel XML file using PowerQuery in Excel
<?xml version="1.0"?>
<?mso-application progid="Excel.Sheet"?>
<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:x="urn:schemas-microsoft-com:office:excel"
xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
xmlns:html="http://www.w3.org/TR/REC-html40">
<DocumentProperties xmlns="urn:schemas-microsoft-com:office:office">
<Author>Andreas Botsikas</Author>
<LastAuthor>Andreas Botsikas</LastAuthor>
@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")