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
using System; | |
using System.ComponentModel; | |
using System.Linq; | |
using System.Net; | |
using System.Net.Http; | |
using System.Threading; | |
using System.Threading.Tasks; | |
using System.Web.Http; | |
using System.Web.Http.Controllers; | |
using System.Web.Http.Metadata; |
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
#!/usr/bin/env bash -e | |
HOST=${1:-cloudflare.com} | |
FILENAME=${2:-${HOST%%.*}} | |
# For file naming, see https://support.ssl.com/Knowledgebase/Article/View/19/0/der-vs-crt-vs-cer-vs-pem-certificates-and-how-to-convert-them | |
# For HTTP Public Key Pinning (HPKP), see https://developer.mozilla.org/en-US/docs/Web/HTTP/Public_Key_Pinning | |
CERTIFICATE_PEM="${FILENAME}_certificate.ascii.crt" | |
CERTIFICATE_DER="${FILENAME}_certificate.crt" | |
PUBKEY_PEM="${FILENAME}_pubkey.ascii.key" |
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 java.io.IOException; | |
import java.net.InetAddress; | |
import java.net.Socket; | |
import java.net.UnknownHostException; | |
import java.util.Arrays; | |
import java.util.HashSet; | |
import java.util.Set; | |
import javax.net.ssl.SSLSocket; | |
import javax.net.ssl.SSLSocketFactory; |
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/Foundation.h> | |
int main(int argc, char *argv[]) | |
{ | |
@autoreleasepool | |
{ | |
NSProgress *progress = [[NSProgress alloc] initWithParent:nil userInfo:nil]; | |
progress.cancellationHandler = ^{ | |
NSLog(@"cancel"); | |
}; |
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
{ | |
"People" : [ | |
{ | |
"Symbol" : "😀", | |
"Name" : "GRINNING FACE" | |
}, | |
{ | |
"Symbol" : "😬", | |
"Name" : "GRIMACING FACE" | |
}, |
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
secureConnectionStart | |
│ | |
│ secureConnectionEnd | |
domainLookupStart │ │ responseStart | |
│ │ │ │ | |
│ connectStart │ ││ connectEnd │ | |
fetchStart │ │ │ ││ │ responseEnd | |
│ │ ├──────────┼────────────────┴┤ │ │ | |
│ │ │ TCP │ TLS │ │ │ | |
├─────────┼─────────┼──────────┴─────────────────┼─────┬───────────┼──────┤ |
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/Foundation.h> | |
@interface Delegate : NSObject <NSURLConnectionDelegate, NSURLSessionDataDelegate> | |
@end | |
@implementation Delegate | |
#pragma mark - NSURLConnectionDelegate | |
- (void) connection:(NSURLConnection *)connection willSendRequestForAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge; |
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
// http://twitter.com/nicklockwood/status/690540488433274881 | |
// @0xced hmm, you're right. So under what circumstances *does* it populate the error param? Why even have it at all? | |
// http://twitter.com/0xced/status/690543445404991488 | |
// @nicklockwood Just disassembled again, seems it can errors if a string fails to convert to UTF8. @nst021 Idea how to produce such a string? | |
// http://twitter.com/mikeash/status/690564095322542081 | |
// mikeash: @0xced @nicklockwood @nst021 Maybe try an NSString containing half of a surrogate pair. | |
#import <Foundation/Foundation.h> |
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
@implementation MPMoviePlayerViewController | |
- (void) _moviePlayerViewController_playbackDidFinishNotification:(NSNotification *)notification | |
{ | |
if (self.presentingViewController.presentedViewController == self) | |
{ | |
UIViewController *presentingViewController = self.presentingViewController; | |
if (self->_internal->_wasDisplayedAnimated) | |
[presentingViewController dismissMoviePlayerViewControllerAnimated]; | |
else |
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
@implementation UIClassSwapper | |
- (instancetype) initWithCoder:(UINibDecoder *)decoder | |
{ | |
NSString *className = [decoder decodeObjectForKey:@"UIClassName"]; | |
NSString *originalClassName = [decoder decodeObjectForKey:@"UIOriginalClassName"]; | |
Class class = NSClassFromString(className); | |
Class originalClass = NSClassFromString(originalClassName); | |