Skip to content

Instantly share code, notes, and snippets.

View terriblememory's full-sized avatar

I forgot. terriblememory

View GitHub Profile
@terriblememory
terriblememory / example.cs
Created June 21, 2018 17:02
UWP - populate XAML Image with RGBA image data
var bgraBuffer = new byte[256 * 256 * 4];
// whatever you need to do to populate the image buffer
var sbm = SoftwareBitmap.CreateCopyFromBuffer(bgraBuffer.AsBuffer(), BitmapPixelFormat.Bgra8, 256, 256, BitmapAlphaMode.Premultiplied);
var sbms = new SoftwareBitmapSource();
var ignore_this_task_it_doesnt_matter = sbms.SetBitmapAsync(sbm);
// SetBitmapAsync may still be in flight but it doesn't matter
var image = Image();
image.Source = sbms;
@terriblememory
terriblememory / gist:652f7757bfe03bf543d111b08daa7934
Created July 11, 2024 18:50
Creating an SD card from an image on macos
Disk Utility croaks when you try to do it from the UI but this command line works...
Replace G3X1.dmg with whatever it should be and get the device from DU.
asr imagescan --source ~/Documents/G3X1.dmg
sudo asr restore --source ~/Documents/G3X1.dmg --target /dev/disk-GET-THIS-FROM-DISK-UTILITY --erase