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
| CCCryptorStatus CCCryptorGCM(CCOperation op, /* kCCEncrypt, kCCDecrypt */ | |
| CCAlgorithm alg, | |
| const void *key, size_t keyLength, /* raw key material */ | |
| const void *iv, size_t ivLen, | |
| const void *aData, size_t aDataLen, | |
| const void *dataIn, size_t dataInLength, | |
| void *dataOut, | |
| void *tagOut, size_t *tagLength) | |
| { |
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
| // | |
| // main.c | |
| // kq | |
| #include <stdio.h> | |
| /* echo.c - Simple `echo' server for N clients written using kqueue/kevent. */ |
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
| #include <stdlib.h> | |
| #include <stdio.h> | |
| #include <sys/types.h> | |
| #include <sys/socket.h> | |
| #include <netinet/in.h> | |
| #include <unistd.h> | |
| #include <fcntl.h> | |
| #include <string.h> | |
| #include <sys/types.h> | |
| #include <sys/event.h> |
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
| protocol ValueType { | |
| init() | |
| } | |
| extension UInt8:ValueType {} | |
| extension Int8:ValueType {} | |
| extension UInt16:ValueType {} | |
| extension Int16:ValueType {} | |
| extension UInt32:ValueType {} | |
| extension Int32:ValueType {} |
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
| func testsnappy(){ | |
| let st = "sdlfjlsadfjalsdjfalsdfjlasf".data(using: .utf8)! | |
| let count:UnsafeMutablePointer<Int> = UnsafeMutablePointer<Int>.allocate(capacity: 1) | |
| count.pointee = snappy_max_compressed_length(st.count) | |
| let out:UnsafeMutablePointer<Int8> = UnsafeMutablePointer<Int8>.allocate(capacity: count.pointee) | |
| defer { | |
| out.deallocate(capacity: count.pointee) |
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 | |
| // In this example, we'll use `[.nameType]` as `tagSchemes` to create a `tagger` of Named Entities. | |
| let tagger = NSLinguisticTagger(tagSchemes: [.nameType], options: 0) | |
| var text1 = """ | |
| On Monday, June 5, Apple handed out its annual Apple Design Awards, which celebrate the talent, artistry and creativity of developers who set the standard for ideal app design. | |
| Now in its 20th year, the Awards recognize excellence in design, innovation and technology in apps and games across iPhone, iPad, Mac, Apple Watch and Apple TV. This year’s honorees represent eight countries around the world: Austria, Canada, Germany, Israel, Italy, Singapore, Slovenia and the US. | |
| """ | |
| // Set the string the tagger will tag. |
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
| - (void)detectWithImageURL:(NSURL *)URL | |
| { | |
| VNImageRequestHandler *handler = [[VNImageRequestHandler alloc] initWithURL:URL options:@{}]; | |
| VNDetectTextRectanglesRequest *request = [[VNDetectTextRectanglesRequest alloc] initWithCompletionHandler:^(VNRequest * _Nonnull request, NSError * _Nullable error) { | |
| if (error) { | |
| NSLog(@"%@", error); | |
| } | |
| else { | |
| for (VNTextObservation *textObservation in request.results) { | |
| // NSLog(@"%@", textObservation); |
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
| - (void)correctAngleWithImage:(UIImage *)image | |
| { | |
| VNImageRequestHandler *handler = [[VNImageRequestHandler alloc] initWithCGImage:image.CGImage options:@{}]; | |
| VNDetectHorizonRequest *request = [[VNDetectHorizonRequest alloc] initWithCompletionHandler:^(VNRequest * _Nonnull request, NSError * _Nullable error) { | |
| if (error) { | |
| NSLog(@"%@", error); | |
| } | |
| else { | |
| NSAssert(request.results.count > 0, @"No Results"); | |
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
| #include <sys/socket.h> | |
| #include <sys/ioctl.h> | |
| #include <sys/kern_event.h> | |
| #include <stdio.h> | |
| #include <stdint.h> | |
| #include <stdbool.h> | |
| #include <stdlib.h> | |
| #include <assert.h> | |
| #include <string.h> | |
| #include <net/ethernet.h> |
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
| *** Panic Report *** | |
| panic(cpu 0 caller 0xffffff80029ff3dd): Kernel trap at 0xffffff800290f4a4, type 13=general protection, registers: | |
| CR0: 0x0000000080010033, CR2: 0x000000010747227d, CR3: 0x0000000a2573c03d, CR4: 0x00000000003627e0 | |
| RAX: 0x00000000cce499e4, RBX: 0x000000003b9aca00, RCX: 0x0000000000000000, RDX: 0x00000001087f63e4 | |
| RSP: 0xffffff9499083ed0, RBP: 0xffffff9499083ed0, RSI: 0x0000000000000000, RDI: 0xffffff805ede4f20 | |
| R8: 0xffffff8002d82aa0, R9: 0x0000000000000000, R10: 0x0000000000000001, R11: 0x0000000000000202 | |
| R12: 0x0000000000000000, R13: 0xffffff806127fcc0, R14: 0xffffff8002d82aa0, R15: 0xffffff805ede4f20 | |
| RFL: 0x0000000000010246, RIP: 0xffffff800290f4a4, CS: 0x0000000000000008, SS: 0x0000000000000010 | |
| Fault CR2: 0x000000010747227d, Error code: 0x0000000000000000, Fault CPU: 0x0, PL: 0, VF: 0 |