Skip to content

Instantly share code, notes, and snippets.

@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
@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 <trippin1@gmail.com>. 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 / 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 / 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 / ATKMediaInterceptor.c
Created November 18, 2012 14:44
Butchered version of zaak404's ATKMediaInterceptor for global media keys support
#include <windows.h>
#ifndef VK_MEDIA_NEXT_TRACK
#define VK_MEDIA_NEXT_TRACK 0xB0
#endif
#ifndef VK_MEDIA_PREV_TRACK
#define VK_MEDIA_PREV_TRACK 0xB1
#endif
#ifndef VK_MEDIA_STOP
#define VK_MEDIA_STOP 0xB2
@qwerty12
qwerty12 / ldid.rb
Created February 6, 2013 23:15
Install a newer version of ldid from homebrew using Matthias Ringwald's work on the Fink version
require 'formula'
class Minimal < Formula
url 'http://ringwald.ch/fink/minimal-e327d27b214753a35b03a89886c82311c96353fa.tar.gz'
md5 '63926a804a44d5c36e8c0036ed653dbb'
end
class Ldid < Formula
homepage 'http://www.saurik.com/id/8'
url 'http://ringwald.ch/fink/ldid-4f4aa9c37a0c26908cafbc5ef58c94814d153415.tar.gz'
@qwerty12
qwerty12 / run-java.sh
Created February 20, 2013 01:39
Stupid wrapper for Sublime Text's JavaC Build System
#!/bin/sh
javac "$1"
if [ $? == 0 ]; then
#Thanks to Ken Pizzini: http://www.linuxmisc.com/12-unix-shell/4cd9a157aa806d45.htm
retval=`exec 3>&1; /opt/X11/bin/xterm -e sh -c '/usr/bin/java "'$2'" 3>&-; echo $? 1>&3; echo "Press ENTER to quit..."; read'`
rm "$2"*.class
exit $retval
fi
@qwerty12
qwerty12 / pidof.c
Created March 14, 2013 12:51
Butchered version of Night Productions' pidof utility for OS X
#import <sys/sysctl.h>
#import <stdlib.h>
#import <string.h>
int pidof(const char *argv)
{
struct kinfo_proc *kp;
int mib[4],nentries,i;
size_t bufSize=0;
@qwerty12
qwerty12 / superenv.rb.diff
Created April 29, 2013 13:56
Quick-'n'-dirty ccache hack for Homebrew
def determine_path
paths = [superbin]
+ if not ARGV.include? "--no-ccache"; paths.unshift "#{HOMEBREW_PREFIX}/Cellar/ccache/3.1.9/libexec:"; ENV.append 'CCACHE_DISABLE', "1"; end
@qwerty12
qwerty12 / _brew.zsh
Created July 15, 2013 02:04
brew_zsh_completion.zsh from Homebrew with the "versions" completion added back in again
#compdef brew
# Brew ZSH completion function
# Drop this somewhere in your $fpath (like /usr/share/zsh/site-functions)
# and rename it _brew
#
# altered from _fink
_brew_all_formulae() {
formulae=(`brew search`)