Skip to content

Instantly share code, notes, and snippets.

View thevurv's full-sized avatar
🛠️
Working on mekkanics

Vurv thevurv

🛠️
Working on mekkanics
View GitHub Profile
@thevurv
thevurv / get_open_windows.rs
Last active February 28, 2021 05:40
getOpenWindows function
// Requires winapi-rs.
// Accidentally made this instead of a getOpenPrograms function so just putting it as a gist so it doesn't go to waste.
use winapi::{
um::winuser::{EnumWindows, GetWindowTextW}
};
static mut windows: Vec<String> = Vec::new(); // Use a static because local variables aren't sent to non-closure functions.
unsafe fn getOpenWindows() -> bool {
@thevurv
thevurv / StrMatch.lua
Last active January 30, 2021 01:02
Lua string match function
-- Program: Lua String Match Func
-- Purpose: To help in tokenizers and stuff. This is a pretty tiny function that allows you to match for custom strings (of course it also has perfect escape-character support.)
-- Returns number start_pos, number end_pos, string match
-- Vurv Update 0.2.0 12/25/2020
-- Make sure quote and escape don't interfere with lua patterns.
local function match_str(self,quote,escape,pos)
local matched = false
local exp = string.format( "^[%s](.-)([%s]-)%s",quote,escape,quote )
local matches = {}