This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <windows.h> | |
#include <atlbase.h> | |
#include <stdio.h> | |
#include <wincodec.h> | |
#define HRASSERT(x) ATLASSERT(SUCCEEDED(x)) | |
HRESULT ConvertBitmapTo256(PCWSTR input, PCWSTR output, REFGUID outputFormat) | |
{ | |
HRESULT hr = S_OK; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Microsoft.UI.Xaml; | |
namespace WinUIAppFx | |
{ | |
public partial class App : Application | |
{ | |
private Window m_window; | |
public App() | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static void Main() | |
{ | |
// needs using UIAutomationClient; | |
// requires a reference to windows\system32\UIAutomationClient.dll | |
// and set Embed Interop Types to false for project reference | |
var root = new CUIAutomation8(); | |
// we want to *keep* the focus | |
root.AutoSetFocus = 0; // false |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void SaveAsANI(Image inputImage, string outputFilePath) | |
{ | |
ArgumentNullException.ThrowIfNull(inputImage); | |
ArgumentNullException.ThrowIfNull(outputFilePath); | |
using var stream = new FileStream(outputFilePath, FileMode.Create); | |
SaveAsANI(inputImage, stream); | |
} | |
public static void SaveAsANI(Image inputImage, Stream outputStream) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Runtime.InteropServices; | |
using System.Text; | |
namespace ConsoleApp1 | |
{ | |
internal class Program | |
{ | |
static void Main() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <windows.h> | |
#include <stdio.h> | |
#include <atlbase.h> | |
#include <atlcom.h> | |
#include <thumbcache.h> | |
DECLARE_INTERFACE_IID_(IThumbnailCachePrivate, IUnknown, "3413b9cd-0db3-4e97-8bf4-68fb100d1815") | |
{ | |
public: | |
virtual HRESULT STDMETHODCALLTYPE Method0(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// backspace starts the editor on Windows | |
const KEY_BACKSPACE = 'Backspace'; | |
// a numeric editor that supports comma or dot as decimal separator | |
class numericEditor { | |
init(params) { | |
// get separator, only used for initial input | |
this.decimalSeparator = params.decimalSeparator; | |
// create the cell |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@build sqlcipher | |
@ 1. clone sqlcipher somewhere (in a sqlcipher directory). | |
@ 2. install a proper tclsh.exe and put it in the path https://www.activestate.com/products/tcl/ | |
@ 3. install open SSL binaries & static libs https://slproweb.com/products/Win32OpenSSL.html | |
@ 4. create a "build" directory at same level | |
@ 5. create a "x64" directory under "build" | |
@ 6. copy this file in build\x64 | |
@ 7. open "x64 Native Tools Command Prompt for VS 20XX" | |
@ 8. cd build\x64 | |
@ 9. run buildx64.bat (this file copied in build\x64) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// by design, this returns the same values as .NET's System.Random | |
export default class Random { | |
private static readonly INT_MAX_VALUE: number = 0x7fffffff; | |
private static readonly INT_MIN_VALUE: number = 0x80000000; | |
private static readonly MSEED = 161803398; | |
private inext = 0; | |
private inextp = 21; | |
private seedArray = new Array(56); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export interface IHasNeighbours<T> { | |
getNeighbours(): Iterable<T>; | |
} | |
export class AStar { | |
static findPath<T extends IHasNeighbours<T>>(start: T, end: T, distanceFunc: (a: T, b: T) => number, estimateFunc?: (a: T) => number): Array<T> { | |
estimateFunc ??= (a: T) => distanceFunc(a, end); | |
const closed = new Set<T>(); | |
const queue = new PriorityQueue<NodeWithNumber<Path<T>>>(NodeWithNumber.comparator); | |
queue.push(new NodeWithNumber(new Path<T>(start, undefined, 0), 0)); |