Skip to content

Instantly share code, notes, and snippets.

View irwinwilliams's full-sized avatar

Irwin irwinwilliams

View GitHub Profile
@irwinwilliams
irwinwilliams / BMPtoNV12.cs
Created May 27, 2021 16:55
A simple C# method that _attempts_ to convert a BMP formatted byte array to NV12
public void BMPtoNV12(byte[] yuv420sp, byte[] argb, int width, int height)
{
int frameSize = width * height;
int yIndex = 0;
int uvIndex = frameSize;
uint a;
int R, G, B, Y, U, V;
@irwinwilliams
irwinwilliams / extract-data.js
Created March 31, 2023 03:32
GPT3-prompt to use jquery to extract html data
/*
jQuery to select all the values of the last column of 17 rows of an html table, where there are 8 columns. The values are actually anchor tags, which contain img tags. Extract the src attribute from those tags.
In the resulting JavaScript, also import jQuery via dynamically adding it to the page within the javascript, not via a script tag
*/
// Dynamically add jQuery to the page
let script = document.createElement('script');
script.type = 'text/javascript';
script.src = 'https://code.jquery.com/jquery-3.6.0.min.js';
document.head.appendChild(script);