Skip to content

Instantly share code, notes, and snippets.

@atr000
atr000 / birthdays.m
Created March 31, 2010 00:06
cli tool to display birthdays. good for geektool
/**************************************************************************************/
// Copyright 2004 by Sven Janssen.
// Small app to get the birtday out of Apple Addressbook.
// Used to show them with GeekTool on my desktop
// gcc -framework Foundation -framework AddressBook -O2 -o birthday source/main.m
//
/**************************************************************************************/
#import <Foundation/Foundation.h>
#import <AddressBook/AddressBook.h>
//
// main.m
// charmap
//
// 20-Apr-09
// Added colour support. User may specify optional parameter <rrggbb> to force the generated charmap to
// be a particular colour. This allows the use of colour in cocos2D LabelAtlas classes - Dave
//
// 21-Apr-09
// Added code to wrap the charmap over multiple rows to avoid exceeding the 1024 pixel width limit
//
// Programmer: Craig Stuart Sapp <[email protected]>
// Creation Date: Tue Jan 20 11:13:16 GMT-0800 1998
// Last Modified: Sun Jan 9 10:34:22 PST 2000 (minor changes)
// Last Modified: Thu Aug 2 13:52:52 PDT 2001 (added stdlib.h for new gcc)
// Last Modified Tue Apr 9 12:24:27 PST 2002 (added Mac options)
// Last Modified Mon Jan 20 21:12:52 PST 2003 (enabled conversion from mac to other)
// Last Modified Wed May 18 14:03:03 PDT 2005 (updated for newer C++ compilers)
// Last Modified Sun Aug 21 21:41:47 PDT 2005 (fixed so running -d twice works)
// Web Address: http://www-ccrma.stanford.edu/~craig/utility/flip/flip.cpp
#import <Foundation/Foundation.h>
#import <Quartz/Quartz.h>
#import <ScreenSaver/ScreenSaver.h>
// cmd = "System/Library/Printers/Libraries/./quartzfilter '%s' '%s' '%s'" % (pdffilepath, qfilterpath, tmpfilepath)
// Returns the file path of an unused temporary file
NSString *getTempFilePath (NSString *extension) {
NSString *tempDirectory = NSTemporaryDirectory();
NSFileManager *fileManager = [NSFileManager defaultManager];
#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");
@atr000
atr000 / gist:303457
Created February 13, 2010 13:40
setDisplay.c
/*
gcc -o SetDisplay main.c -framework Cocoa
main.c
This tool sets the display resolution. This tool exists so that we
can set the display to a setting when the display manager says it can't,
mainly, when a Mac starts up and the monitor is off, or if the Mac is on
a KVM.
@atr000
atr000 / osxSleep.c
Created February 13, 2010 11:25
osxSleep.c
#include <IOKit/IOKitLib.h>
#include <IOKit/pwr_mgt/IOPMLib.h>
#include <IOKit/IOReturn.h>
#include <mach/mach_init.h> /* for bootstrap_port */
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
int main(int argc, char *argv[])
{
@atr000
atr000 / btpower.m
Created February 13, 2010 11:24
btpower.m
// Copyright (c) 2009 Berk D. Demir <[email protected]>
//
// Permission to use, copy, modify, and distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice appear in all copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
/*
* git-update-infoplist.m
* git-update-infoplist
*
* Created by Ofri Wolfus on 25/05/07.
* Copyright 2007 Ofri Wolfus. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
/*
rslight
rslight.c
Quentin D. Carnicelli - [email protected]
*/
#include <stdio.h>
#include <getopt.h>