This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// a) As Mac OS X does not have byteswap.h | |
// needed this for a c util I had used over the years on linux. | |
// did not find a solution to stopgap via macports, sadly, but this did the trick | |
#if HAVE_BYTESWAP_H | |
#include <byteswap.h> | |
#else | |
#define bswap_16(value) \ | |
((((value) & 0xff) << 8) | ((value) >> 8)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tell application "Finder" | |
-- get desktop dimensions (dw = desktop width; dh = desktop height) | |
set db to bounds of window of desktop | |
set {dw, dh} to {item 3 of db, item 4 of db} | |
end tell | |
tell application "System Events" | |
repeat with proc in application processes | |
tell proc | |
repeat with win in windows |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* FindProxies.c | |
* | |
* -------------------------------------------------------------------------------------- | |
* | |
* The contents of this file are subject to the NOKOS License Version 1.0a (the | |
* "License"); you may not use this file except in compliance with the License. | |
* | |
* Software distributed under the License is distributed on an "AS IS" basis, WITHOUT | |
* WARRANTY OF ANY KIND, either express or implied. See the License for the specific |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# take a screenshot via pyobjc | |
from AppKit import * | |
def screenShot(self): | |
rect = NSScreen.mainScreen().frame() | |
image = NSImage.alloc().initWithSize_((rect.size.width, rect.size.height | |
)) | |
window = NSWindow.alloc().initWithContentRect_styleMask_backing_defer_( | |
rect, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
usbdevs - list mounted USB devices & their volume paths on Mac OS X | |
References: | |
- http://stackoverflow.com/questions/2459414/osx-how-to-get-a-volume-name-or-bsd-name-from-a-iousbdeviceinterface-or-locati | |
- http://superuser.com/questions/103755/whats-up-with-stat-on-mac-os-x-darwin-or-filesystems-without-names | |
- http://stackoverflow.com/questions/1698124/how-to-tell-if-a-given-path-is-mounted-removable-media-in-mac-os-x | |
- http://developer.apple.com/mac/library/samplecode/VolumeToBSDNode/Introduction/Intro.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* keyremap.c | |
* | |
* features: | |
* 1. map lower enter to forward delete key - useful for macbooks | |
* (works only when secure event input is not activated, | |
* which happens very rarely, e.g. when password fields are focused) | |
* 2. send enter key event when right command key is released | |
* without any other key pressed while it was down | |
* | |
* by Bert Mu"nnich, January 2009 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/sh | |
# | |
# Author: Andreas Olsson <andreas@arrakis.se> | |
# Version: @(#)autossh_tunnel.foo 0.1 27-Aug-2008 andreas@arrakis.se | |
# | |
# For each tunnel; make a uniquely named copy of this template. | |
## SETTINGS | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd"> | |
<plist version="0.9"> | |
<dict> | |
<key></key> | |
<dict> | |
<key></key> | |
<string>noop:</string> | |
<key>$</key> | |
<string>moveToEndOfLine:</string> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <string.h> | |
#include <IOKit/hidsystem/IOHIDLib.h> | |
#include <IOKit/hidsystem/IOHIDParameter.h> | |
#include <IOKit/hidsystem/event_status_driver.h> | |
int main(int argc, char **argv) | |
{ | |
const int32_t accel = -0x10000; | |
io_connect_t handle = NXOpenEventStatus(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// gcc -framework ApplicationServices testfade.c | |
#include <stdio.h> | |
#include <ApplicationServices/ApplicationServices.h> | |
int main() | |
{ | |
fprintf(stdout, "Fading to blue...\n"); | |
CGDisplayFadeReservationToken token; |
NewerOlder