This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <CoreFoundation/CoreFoundation.h> | |
#include <CoreServices/CoreServices.h> | |
#include <AudioToolbox/AudioFile.h> | |
#include <IOKit/storage/IOCDTypes.h> | |
#define AUDIO_FRAMES_PER_CDDA_SECTOR 588 | |
#define CDDA_SAMPLE_RATE 44100 | |
#define CDDA_CHANNELS_PER_FRAME 2 | |
#define CDDA_BITS_PER_CHANNEL 16 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <CoreFoundation/CoreFoundation.h> | |
#include <AudioToolbox/AudioToolbox.h> | |
#include "CAStreamBasicDescription.h" | |
#define BUFFER_SIZE_FRAMES 512 | |
static AudioBufferList * | |
allocateBufferList(UInt32 channelsPerFrame, UInt32 bytesPerFrame, bool interleaved, UInt32 capacityFrames) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func pointerToString(objRef: AnyObject) -> String { | |
let ptr: COpaquePointer = Unmanaged<AnyObject>.passUnretained(objRef).toOpaque() | |
return "\(ptr)" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (BOOL)_enumerateIndexedValuesInColumn:(NSString *)column matchingQuery:(YapDatabaseQuery *)query | |
usingBlock:(void (^)(id indexedValue, BOOL *stop))block | |
{ | |
if (column == nil) return NO; | |
if (query == nil) return NO; | |
if (query.isAggregateQuery) return NO; | |
// Create full query using given filtering clause(s) | |
NSString *fullQueryString = |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
class Test { | |
init() { | |
print("init") | |
} | |
deinit { | |
print("deinit") | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension String { | |
func snake_cased() -> String { | |
let re = try! NSRegularExpression(pattern: "((?<=[a-z0-9])[A-Z]|(?!^)[A-Z](?=[a-z]))") | |
let s = re.stringByReplacingMatches(in: self, range: NSMakeRange(0, (self as NSString).length), withTemplate: "_$1") | |
return s.lowercased() | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /etc/logrotate.d/cloudflared | |
/var/log/cloudflared/cloudflared.log { | |
rotate 7 | |
daily | |
compress | |
missingok | |
notifempty | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cmake_minimum_required (VERSION 2.6) | |
project (libmac) | |
set(EXEC_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}" CACHE PATH "Directory for architecture-dependent files") | |
set(BIN_INSTALL_DIR "${EXEC_INSTALL_PREFIX}/bin" CACHE PATH "Directory for user executables") | |
set(LIB_INSTALL_DIR "${EXEC_INSTALL_PREFIX}/lib" CACHE PATH "Ddirectory for object code libraries") | |
set(INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/include" CACHE PATH "Directory for header files") | |
add_definitions(-DPLATFORM_APPLE) | |
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Copyright (c) 2020 - 2021 Stephen F. Booth <[email protected]> | |
// MIT license | |
// | |
#import <Foundation/Foundation.h> | |
NS_ASSUME_NONNULL_BEGIN | |
@interface NSArray<ObjectType> (SFBFunctional) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func data_AudioFile_ReadProc(_ inClientData: UnsafeMutableRawPointer, _ inPosition: Int64, _ requestCount: UInt32, _ buffer: UnsafeMutableRawPointer, _ actualCount: UnsafeMutablePointer<UInt32>) -> OSStatus { | |
let data = inClientData.assumingMemoryBound(to: Data.self).pointee | |
let bufferPointer = UnsafeMutableRawBufferPointer(start: buffer, count: Int(requestCount)) | |
let copied = data.copyBytes(to: bufferPointer, from: Int(inPosition) ..< Int(inPosition) + Int(requestCount)) | |
actualCount.pointee = UInt32(copied) | |
return noErr | |
} | |
func data_AudioFile_GetSizeProc(_ inClientData: UnsafeMutableRawPointer) -> Int64 { | |
let data = inClientData.assumingMemoryBound(to: Data.self).pointee |
OlderNewer