Skip to content

Instantly share code, notes, and snippets.

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@sharow
sharow / monitoroff.py
Last active February 24, 2023 04:13
win: sleep monitor immediately
# -*- Mode: python; tab-width: 4; indent-tabs-mode: nil; coding: utf-8; -*-
from ctypes import *
user32 = WinDLL('User32')
DISPLAY_ON = -1
DISPLAY_OFF = 2
HWND_BROADCAST = 0xffff
WM_SYSCOMMAND = 0x0112
SC_MONITORPOWER = 0xf170
@sharow
sharow / rust_bmfont.rs
Created October 11, 2017 13:40
Rust code fragment. load BMFont xml geometries.
extern crate xml;
use std::path::Path;
use std::fs::File;
use xml::reader::EventReader;
use xml::reader::events::*;
#[derive(Clone)]
struct GlyphGeometry {
pub rect: Rect,