Skip to content

Instantly share code, notes, and snippets.

View caspark's full-sized avatar

Caspar Krieger caspark

View GitHub Profile
@caspark
caspark / textfetch.py
Created May 28, 2020 03:12
Python UI Automation text fetching from a Windows contro sample
import uiautomation as auto
# move mouse cursor over a text box with some text in it first
c = auto.ControlFromCursor()
v = c.GetValuePattern()
print(v.Value) # should print the contents of the text box
# now select some text in that same control
t = c.GetTextPattern()
@caspark
caspark / cloning_world.rs
Created May 17, 2024 05:48
Example of how to clone world in hecs
use hecs::{ColumnBatchBuilder, ColumnBatchType, Component, TypeUnknownToCloner, World};
fn try_add_type_to_batch<T: Component>(
archetype: &hecs::Archetype,
batch_type: &mut ColumnBatchType,
) {
if archetype.has::<T>() {
batch_type.add::<T>();
}
}
@caspark
caspark / LICENSE
Last active December 6, 2024 03:30
Script to use network namespaces to create isolated network adapters on linux
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2004 Sam Hocevar <[email protected]>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE