Skip to content

Instantly share code, notes, and snippets.

@atr000
atr000 / osxDictionary.m
Created September 4, 2010 00:11
osxDictionary.m
#import <Foundation/Foundation.h>
#import <CoreServices/CoreServices.h>
int main(int argc, char **argv) {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
if (argc <= 1) {
printf("Usage: %s searchstring\n", argv[0]);
[pool release];
return 1;
@atr000
atr000 / jdownload.py
Created September 3, 2010 23:59
jdownload.py
import socket,urllib2
from xml.dom import minidom
# Get Info #
LocalIp = ([ip for ip in socket.gethostbyname_ex(socket.gethostname())[2] if not ip.startswith("127.")][0])
def get_downloadlist():
urlStr = 'http://' + LocalIp + ':10025/get/downloads/currentlist'
try:
fileHandle = urllib2.urlopen(urlStr)
@atr000
atr000 / jpegquality.c
Created August 31, 2010 16:46
jpegquality.c
/*************************************************************
Copyright 2005-2007 Hacker Factor, All Rights Reserved.
By Neal Krawetz, www.hackerfactor.com
jpegquality:
Estimate the quality of the JPEG based on the quanitization tables.
Neal's personal comment...
"Jpeg, and Exif in particular, is one of the most screwed up formats
that I have ever seen."
/* Copyright (c) 2007 Peter O'Gorman <[email protected]>
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
/*
Opposite of the easy way:
http://aladino.dmi.unict.it/?a=unlocker
iTunes Unlocker - Copyright (C) 2009 Costantino Pistagna - [email protected]
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
on open names
set volumeName to names as text
set macAddress to (do shell script "ifconfig en0 | grep ether | tr -d '\\011' | sed s/ether// | sed 's/ //g' | sed s/://g")
set hostName to (do shell script "hostname -fs")
tell application "Finder"
set theSize to round (((capacity of startup disk) / 1024 / 1024) / 1024)
end tell
do shell script "defaults write com.apple.systempreferences TMShowUnsupportedNetworkVolumes 1" with administrator privileges
@atr000
atr000 / flashscreen.m
Created August 20, 2010 00:57
flashscreen.m
//
// flashscreen.m
// Command Utility
//
// Copyright Cucurbita. All rights reserved.
//
// gcc -framework AppKit flashscreen.m -o flashscreen
// gcc -DHAVE_WINDOW_FADE -framework AppKit flashscreen.m -o flashscreen
@atr000
atr000 / wordPerms.c
Created August 19, 2010 15:36
wordPerms.c
#import <CoreFoundation/CoreFoundation.h>
#import <stdlib.h>
void PermutationsOfWord (CFMutableArrayRef output, CFStringRef prefix, CFStringRef letters);
CFStringRef CFStringCreateWithContentsOfFile (const char *path);
int main (int argc, const char *argv[]) {
if (argc != 3) {
printf("Usage: scrabblegen dictionary.txt setofletters\n");
@atr000
atr000 / osxMacAddress.m
Created August 19, 2010 14:00
osxMacAddress.m
#import <Foundation/Foundation.h>
#include <IOKit/IOKitLib.h>
#include <IOKit/network/IOEthernetInterface.h>
#include <IOKit/network/IOEthernetController.h>
static NSDictionary* GetMACAddresses( io_iterator_t netIterator );
static kern_return_t FindNetworkInterfaces( io_iterator_t *services );
static NSString* bytesToHexString( NSData* data );
@atr000
atr000 / catMovies.c
Created August 19, 2010 12:32
catMovies.c
// Contact: [email protected]
#include <CoreServices/CoreServices.h>
#include <Carbon/Carbon.h>
#include <QuickTime/QuickTime.h>
#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
#define ec(ERR, STR) if((ERR) != noErr) fprintf(stderr, "## %s() error:%d\n", (STR), (ERR))