Skip to content

Instantly share code, notes, and snippets.

View KnIfER's full-sized avatar

knziha KnIfER

View GitHub Profile
@3735943886
3735943886 / SetDeviceState.c
Last active January 25, 2024 08:46
Disable or Enable Device with Hardware ID
/* for Devpkey */
#define INITGUID
/* dependencies */
#pragma comment (lib, "SetupAPI")
#include <windows.h>
#include <SetupAPI.h>
#include <Devpkey.h>
VOID SetDeviceState(LPCWSTR lpszHardwareId, DWORD dwState)
@comargo
comargo / README.md
Last active February 1, 2023 08:32
OutputDebugString with cpp std::ostream

Sven Axelsson 24 Nov 2001

How to create an output stream that writes to the debug terminal.

Background

There are many different schools of how to debug a program (yeah, I know - write it correctly from the start), but whatever tools you prefer it is often very convenient just to use the printf approach. Well, since you are a modern C++ kind of person, you don't really want printf, you want to use an output stream, like cerr.

@sankarara
sankarara / monitor-off.ahk
Created March 23, 2016 14:29
AutoHotKey: Turn monitor off with a keyboard shortcut
; This is part of my AutoHotkey [1] script that turns off my monitor when I
; press Win+\.
; It also turns the screensaver on at the same time, so that Windows Live
; Messenger (and any other programs) know I am away.
; I don't have a password on my screensaver, so there is a second version
; (Win+Shift+\) that locks the PC as well.
; Note: Sometimes the monitor comes back on after a second and I have to
@jaydson
jaydson / gist:1780598
Created February 9, 2012 15:11
How to detect a click event on a cross domain iframe
var myConfObj = {
iframeMouseOver : false
}
window.addEventListener('blur',function(){
if(myConfObj.iframeMouseOver){
console.log('Wow! Iframe Click!');
}
});
document.getElementById('YOUR_CONTAINER_ID').addEventListener('mouseover',function(){