Skip to content

Instantly share code, notes, and snippets.

View elfenlaid's full-sized avatar
🐧
Slow Distillation ⚗️💭

Egor Mihnevich elfenlaid

🐧
Slow Distillation ⚗️💭
View GitHub Profile
@elfenlaid
elfenlaid / ipa_dir_observer.py
Last active December 14, 2015 00:29
Observe given directory and tag added IPA files
import sys
import time
from subprocess import Popen
from watchdog.observers import Observer
from watchdog.events import RegexMatchingEventHandler
class IpaDirectoryEventHandler(RegexMatchingEventHandler):
def on_modified(self, event):
first public gist
AVMutableAudioMix *exportAudioMix = [AVMutableAudioMix audioMix];
exportAudioMix.inputParameters = parameters;
AVAssetExportSession *export =
[[AVAssetExportSession alloc] initWithAsset:mixComposition
presetName:AVAssetExportPresetAppleM4A];
export.outputFileType = @"com.apple.m4a-audio";
export.outputURL = outputFileUrl;
export.audioMix = exportAudioMix;
CMTimeRange fadeInRange = CMTimeRangeMake(CMTimeMake(0, 1), CMTimeMake(self.fadeInToSec, 1));
[fadeInParameter setVolumeRampFromStartVolume:0.0 toEndVolume:1.0
timeRange:fadeInRange];
[parameters addObject:fadeInParameter];
OSStatus
MyAudioCallback(AudioConverterRef inAudioConverter,
UInt32 *ioDataPacketCount,
AudioBufferList *ioData,
AudioStreamPacketDescription **outDataPacketDescription,
void *inUserData);
UInt32 allowMixing = NO;
AudioSessionSetProperty(kAudioSessionProperty_OverrideCategoryMixWithOthers,
sizeof (allowMixing),
&allowMixing);
AudioSessionInitialize(NULL,
NULL,
InterruptionListenerCallback,
clientData);
@interface MediaPicker()
@property (nonatomic, retain) MPMediaPickerController *picker;
@end
@implementation PYSMediaPicker
@synthesize picker;
@synthesize delegate;
- (void)presentPicker
{
[Flurry logEvent:@"Picker presented"];
self.picker =
[[[MPMediaPickerController alloc]
initWithMediaTypes: MPMediaTypeAnyAudio] autorelease];
[picker setDelegate:self];
[picker setAllowsPickingMultipleItems:NO];
picker.prompt = @"Choose sound to process";
// Here a cave in which live all runtime dragons and wizards
#include <objc/runtime.h>
// We can swap instance methods, they start with '-' minus sign, you know
static void instance_methods_swap(id object, SEL firstSel, SEL secondSel) {
method_exchangeImplementations(
class_getInstanceMethod(object, firstSel),
class_getInstanceMethod(object, secondSel));
}