Skip to content

Instantly share code, notes, and snippets.

View iluvcapra's full-sized avatar
💭
Workin’

Jamie Hardt iluvcapra

💭
Workin’
View GitHub Profile
@iluvcapra
iluvcapra / tentens.rb
Created January 31, 2009 09:22
Generate an AppleScript from a CMX-format Edit Decision List
#!/usr/bin/ruby
#read EDL for start times
class Event
attr_accessor :start
attr_accessor :finish
attr_accessor :clip_name
@iluvcapra
iluvcapra / sortbyname.rb
Created January 31, 2009 09:25
Sort a folder of files into folders
#!/usr/bin/env ruby
#
# Created by Jamie Hardt on 2007-01-13.
# Copyright (c) 2007. All rights reserved.
require 'find'
files = { }
raise ArgumentError unless (filesPath = ARGV[0] and destPath = ARGV[1])
//
// Riff.h
// riff-objc
//
// Created by Jamie Hardt on 3/27/09.
// Copyright 2009 The Sound Department. All rights reserved.
//
#import <Cocoa/Cocoa.h>
//
// Riff.m
// riff-objc
//
// Created by Jamie Hardt on 3/27/09.
// Copyright 2009 The Sound Department. All rights reserved.
//
#import "Riff.h"
@iluvcapra
iluvcapra / ptArchive.sh
Created November 29, 2009 17:27
A Shell Script for FLACing a broadcast WAV file and binary-comparing (including all wrapper and metadata) with original
#!/bin/sh
for file ; do
# We take every file we're given and...
echo "FLAC'ing" $file
# ...let the user know we've started working on it...
EXT=`echo $file | ruby -e "puts STDIN.read.scan(/([^.]*)$/)"`
# find out wether its name ends in ".wav" or ".aif"
#!/bin/sh
for file ; do
NEW_FILENAME=`echo "$file" | ruby -e "puts STDIN.read.scan(/(.*)\.flac$/)"`
flac -d --keep-foreign-metadata "$file" -o "$NEW_FILENAME" 2>/dev/null
if [ -e "$NEW_FILENAME" ]
then
echo Successfully "de-FLAC'd" $file
rm "$file"
else echo Failed to inflate $file as $NEW_FILENAME
fi
-(NSData *)dataFromResource:(OSType)ident
resID:(NSInteger)idnum
inFile:(NSString *)path {
FSRef feRef;
FSPathMakeRef((UInt8 *)[path fileSystemRepresentation], &feRef, NULL);
ResFileRefNum refFileNum = FSOpenResFile(&feRef, fsRdPerm);
UseResFile(refFileNum);
Handle resHandle = Get1Resource(ident, idnum);
long size = GetResourceSizeOnDisk(resHandle);
@iluvcapra
iluvcapra / tachyond.m
Created March 3, 2010 03:12
A daemon for excluding Pro Tools fade files from Time Machine backups
/* Copyright (c) 2010 Jamie Hardt, All Rights Reserved. */
/*
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the
following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
@iluvcapra
iluvcapra / NSPredicate2SQL.mm
Last active October 3, 2020 23:08
Convert an NSPredicate to a SQL WHERE clause
static NSString *SQLNullValueString = [[NSString alloc] initWithString:@"NULL"];
/* Prototypes */
NSString *SQLWhereClauseForPredictate(NSPredicate *predicate);
NSString *SQLExpressionForNSExpression(NSExpression *expression);
/* Implementation */
@interface NSData (SimpleChecksum)
-(NSUInteger)simpleChecksum;
@end
@implementation NSData (SimpleChecksum)
-(NSUInteger)simpleChecksum {
NSUInteger i, accumuator = 0;