Skip to content

Instantly share code, notes, and snippets.

@qwerty12
qwerty12 / bztest.c
Created June 7, 2012 19:40
Non-working GDBus BlueZ thing
//gcc -Wall bztest.c $(pkg-config --cflags --libs gio-2.0)
#include <stdlib.h>
#include <gio/gio.h>
#define NOPE(obj) \
G_STMT_START \
if (!obj) \
{ \
retval = EXIT_FAILURE; \
goto exit; \
@qwerty12
qwerty12 / screen_locked.py
Created February 13, 2012 14:09
Notification of gnome-screensaver state changes through D-Bus
#!/usr/bin/env python
import gobject, dbus
from dbus.mainloop.glib import DBusGMainLoop
def screensaver_state_changed(isActive):
print "locked" if isActive else "unlocked"
DBusGMainLoop(set_as_default=True)
sess_bus = dbus.SessionBus()
@qwerty12
qwerty12 / SleepLock.cpp
Created November 3, 2011 18:58
Basic hook (thanks to Mhook)
/*
* SleepLock: Simplest DLL ever to lock when resuming from sleep only. Designed to be injected into processes that call SetSuspendState.
*
* I feel dirty for attaching a license to something as simple as this. Nevertheless, the BSD licence is pretty much a free pass.
*
* Copyright (C) 2011 Faheem Pervez <[email protected]>. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
@qwerty12
qwerty12 / rain.ahk
Created October 16, 2011 12:26
AutoHotkey script to hide Rainmeter widget
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
DisableRainmeterSkin()
{
Envget, APPDATA, APPDATA
RainmeterINI = %APPDATA%\Rainmeter\Rainmeter.ini
VDMSection = Visions+\VDM Controller
VDMActiveKey = Active