This file contains hidden or 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 | |
| import AudioToolbox | |
| class KKSimplePlayer: NSObject { | |
| var URL: NSURL | |
| var URLSession: NSURLSession! | |
| var packets = [NSData]() | |
| var audioFileStreamID: AudioFileStreamID = nil | |
| var outputQueue: AudioQueueRef = nil | |
| var streamDescription: AudioStreamBasicDescription? |
This file contains hidden or 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
| # To solve https://scontent-tpe1-1.xx.fbcdn.net/hphotos-xpt1/v/t1.0-9/12140762_10206383163957694_3005844752527088716_n.jpg?oh=b08035a7d4b6e98257a7b4cbc773a883&oe=579521DB | |
| valid_p = 0 | |
| def check(a, b, c, d, g, h): | |
| global valid_p # I always hate to use global vars... | |
| ef = (a * 10 + b) - (c * 10 + d) | |
| e = ef / 10; | |
| f = ef % 10 |
This file contains hidden or 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/Foundation.h> | |
| void removeInstanceMethod(Class cls, SEL _cmd); |
This file contains hidden or 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
| <?php | |
| /* | |
| * A tiny parser which parses ID3 tags and MP3 frames. | |
| */ | |
| function parseMP3($mp3file) { | |
| function _parseID3TagsV2($data) { | |
| define("HEADER_LENGTH", 10); |
This file contains hidden or 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 UIKit | |
| import CryptoKit | |
| import CommonCrypto | |
| let str = "Boom boom boom boom boom boom" | |
| // CryptoKit | |
| func MD5CryptoKit(string: String) -> Data { | |
| string.data(using:.utf8)!.withUnsafeBytes { ptr in | |
| Data(Insecure.MD5.hash(bufferPointer: ptr).map { $0 }[0..<Insecure.MD5.byteCount]) |
This file contains hidden or 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/Foundation.h> | |
| @interface KKSimpleAirPlay2Player : NSObject | |
| - (id)initWithURL:(NSURL *)inURL; | |
| - (void)play; | |
| - (void)pause; | |
| @property (readonly, getter=isStopped) BOOL stopped; | |
| @end |
This file contains hidden or 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
| let response = GCDWebServerStreamedResponse(contentType: "video/mp4", asyncStreamBlock: { block in | |
| /// Fetch data | |
| }) |
This file contains hidden or 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
| let begin = request.hasByteRaange ? request.byteRange.lowerBound : 0 | |
| let end = request.hasByteRaange ? request.byteRange.higherBound : clipFileSize | |
| var readHead = begin | |
| let response = GCDWebServerStreamedResponse(contentType: "video/mp4", asyncStreamBlock: { block in | |
| if readHead < end { | |
| let data = getData(readHead, chunkSize) | |
| block(data, nil) | |
| readHead += data.count | |
| } else { | |
| block(nil, nil) |
This file contains hidden or 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
| let response = GCDWebServerStreamedResponse(contentType: "video/mp4", asyncStreamBlock: { block in | |
| let begin = request.hasByteRaange ? request.byteRange.lowerBound : 0 | |
| let end = request.hasByteRaange ? request.byteRange.higherBound : clipFileSize | |
| var readHead = begin | |
| while readHead < end { | |
| let data = getData(readHead, chunkSize) | |
| block(data, nil) | |
| readHead += data.count | |
| } | |
| }) |
This file contains hidden or 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
| let response = GCDWebServerStreamedResponse(contentType: "video/mp4", asyncStreamBlock: { block in | |
| /// Fetch data | |
| }) |
NewerOlder