Skip to content

Instantly share code, notes, and snippets.

@atr000
atr000 / cleanupd.m
Created December 16, 2010 21:01
cleanupd desktop files
#import <Foundation/Foundation.h>
int main(int argc, const char* argv[])
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
NSAppleScript* script = [[NSAppleScript alloc] initWithSource:@"tell application \"Finder\"\nclean up window of desktop\nend tell"];
while ( true )
{
@atr000
atr000 / displayBrightness.c
Created December 12, 2010 09:57
iokit / applicationservices cli to change the display brightness
/*
display-brightness.c
gcc -o display-brightness display-brightness.c \
-framework IOKit -framework ApplicationServices
*/
#include <stdio.h>
#include <IOKit/graphics/IOGraphicsLib.h>
#include <ApplicationServices/ApplicationServices.h>
#import <Foundation/Foundation.h>
int main(int argc, const char* argv[])
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
NSAppleScript* script = [[NSAppleScript alloc] initWithSource:@"tell application \"Finder\"\nclean up window of desktop\nend tell"];
while ( true )
{
@atr000
atr000 / picasa_upload.py
Created October 29, 2010 13:29
python cli util to upload images to picasa
#!/usr/bin/env python2
import gdata.photos.service
import getpass
import sys
import os.path
from optparse import OptionParser
def main():
parser = OptionParser(usage="usage: %prog [options] images...", version="%prog v0.1.0")
@atr000
atr000 / cb.c
Created October 28, 2010 00:07
// gcc -Wall -W -Wno-unused-parameter -Werror -arch i386 -arch ppc main.c -framework CoreServices -o cb
// cb service to respond to an action upon dir change. great starting point.
#include <CoreServices/CoreServices.h>
#define EVENT_STREAM_LATENCY ((CFAbsoluteTime)5)
const char *command;
void build(
@atr000
atr000 / autossh init.d
Created October 24, 2010 18:22
launches and maintains uniquely named autossh tunnels alive
#! /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
#
// gcc -framework ApplicationServices -framework CoreFoundation -framework IOKit display.c -o display
/* This code was based on SetDisplay from the University of Utah Student
* Computing Labs.
* The code has since been modified by Rob Braun (bbraun@synack.net)
* Please do not contact Utah Student Computing Labs with problems with
* this software. I probably introduced them.
*/
/*
require 'formula'
class Cpansearch <Formula
head 'http://github.com/c9s/cpansearch.git', :using => :git
homepage 'http://github.com/c9s/cpansearch'
# Don't take +x off these files
skip_clean 'bin'
# uses libcurl (system)
/*
asynctask.m -- sample code that shows how to implement asynchronous stdin, stdout & stderr streams for processing data with NSTask
compile with:
gcc -Wall -O3 -x objective-c -fobjc-exceptions -framework Foundation -o asynctask asynctask.m
./asynctask
./asynctask > asynctask-output.txt 2>&1
// -*- c-basic-offset:2; tab-width:8; -*-
/*
* change-bundle-id.m
*
* Created by Chris Suter on 16/5/2008.
* Copyright 2008 Coriolis Systems. All rights reserved.
*
*/
#import <Foundation/Foundation.h>