Skip to content

Instantly share code, notes, and snippets.

/* mac-fix-env: A small utility to pick up the shell environment on MacOS X
and insert it into the file ~/.MacOSX/environment.plist
creating if necessary.
Copyright (C) 1989, 1993, 2005, 2008, 2009 Free Software Foundation, Inc.
This file is part of GNU Emacs.
GNU Emacs is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
#include <id3/tag.h>
#include <id3/misc_support.h>
#import <UniversalDetector/UniversalDetector.h>
#import <Cocoa/Cocoa.h>
static void ut(NSMutableDictionary *t, NSString *n, NSString *a, NSString *al)
{
if (n) [t setObject:n forKey:@"Name"];
if (a) [t setObject:a forKey:@"Artist"];
if (al) [t setObject:al forKey:@"Album"];
// Map right-side Option to Enter in OS X
// by Henrik Nyh <http://henrik.nyh.se> 2008-03-15.
// Free to modify and redistribute with credit.
//
// The Enter key does not always do the same thing as Return: when editing
// text in Photoshop, Return breaks lines and Enter commits the changes.
// The Adium IM client and and Colloquy IRC client can be set up much the
// same way: Return breaks lines, Enter sends. The TextMate editor
// (http://macromates.com) makes good use of Enter in its commands.
//
#import <Foundation/Foundation.h>
#import <AppKit/AppKit.h>
#import <ScreenSaver/ScreenSaver.h>
// Returns the file path of an unused temporary file
// (e.g. /var/folders/NU/.../1023.tmp)
NSString *getTempFilePath (NSString *extension) {
NSString *tempDirectory = NSTemporaryDirectory();
NSFileManager *fileManager = [NSFileManager defaultManager];
NSString *tempFilePath;
#import <Foundation/Foundation.h>
#import <Carbon/Carbon.h>
void printUsage (void) {
printf("Usage: spowin -s [search word(s)]\n");
}
int main (int argc, const char * argv[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
#import <Foundation/Foundation.h>
int main (int argc, const char * argv[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
// arguments array
NSArray *args = [[NSProcessInfo processInfo] arguments];
// check if all arguments have been supplied
if ( argc != 3 && argc != 4 )
printf("Usage:\nSource directory [path]\ntag [string]\nencoding [MacRoman / ISO8859-1 / UTF8 / UTF16]\n");
#import <Foundation/Foundation.h>
#import <AppKit/AppKit.h>
int main (int argc, const char * argv[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
if (argc != 4) {
printf("Usage: pixelcolor [imgpath] [pixelposx] [pixelposy]\n");
return 1;
}
#import <Foundation/Foundation.h>
#import <Quartz/Quartz.h>
// prints a short hint about how to use the utility
void printUsage (void) {
printf("\npdfprops - Tool to modify PDF metadata\n\n");
printf("Usage: pdfprops [-file PDF file path] [arguments]\n\n");
printf("Arguments:\n");
printf("\t[-author 'Max Frisch']\n");
printf("\t[-title 'Homo faber']\n");
#import <Foundation/Foundation.h>
#import <AppKit/AppKit.h>
// author: Martin Michel
// eMail: [email protected]
// created: 27.01.2010 (Apple tablet day!)
void printUsage () {
printf("ionicelf sets a given image as the icon of a given file\n");
printf("Usage: ionicelf -img [img file path] -file [file path]\n");
#import <Foundation/Foundation.h>
#import <AppKit/AppKit.h>
int main (int argc, const char * argv[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
NSArray *allScreens = [NSScreen screens];
if (allScreens == NULL) {
printf("ERROR: No screens found.");
return 1;
}