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
#!/bin/bash | |
if [ $# -ne 4 ] | |
then | |
echo "Usage: $0 <host> <port> <pattern> <seconds>" | |
exit 1 | |
fi | |
cursor=-1 | |
keys="" |
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
enum X509Error: Error { | |
case certificateError(message: String) | |
case publicKeyError(message: String) | |
} | |
class X509 { | |
// A DER (Distinguished Encoding Rules) representation of an X.509 certificate. | |
let publicKey: SecKey |
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
#!/bin/sh | |
# Example usage | |
# cd into directory that has @3x images | |
# ./whatever-you-name-this.sh | |
# Remember to chmod +x the script | |
resize () { | |
ls *@3x.png | awk '{print("convert "$1" -filter box -resize '$1' "$1)}' | sed 's/@3x/'$2'/2' | /bin/sh | |
} |
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
@protocol AutoHook <NSObject> | |
@required | |
+ (NSArray <NSString *> *)targetClasses; | |
@end |
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
// | |
// Obfuscator.swift | |
// | |
// Created by Dejan Atanasov on 2017-05-31. | |
// | |
import Foundation | |
class Obfuscator: AnyObject { | |
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 UIFont (PSPDFAdditions) | |
// https://gist.github.com/nuthatch/7594460 | |
static CGFloat PSPDFMultiplicatorForPreferredContentSize(void) { | |
CGFloat multiplicator = 1.f; | |
NSString *preferredTextStyle = UIApplication.sharedApplication.preferredContentSizeCategory; | |
if ([preferredTextStyle isEqualToString:UIContentSizeCategoryExtraSmall]) { | |
multiplicator = 0.9f; | |
}else if ([preferredTextStyle isEqualToString:UIContentSizeCategorySmall]) { | |
multiplicator = 0.95f; |
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 <netinet/in.h> | |
#include <sys/socket.h> | |
#include <unistd.h> | |
#include <arpa/inet.h> | |
- (void)sendBroadcastPacket { | |
// Open a socket | |
int sd = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP); | |
if (sd<=0) { | |
NSLog(@"Error: Could not open socket"); |
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 <netinet/in.h> | |
#include <sys/socket.h> | |
#include <unistd.h> | |
#include <arpa/inet.h> | |
- (void)broadCast | |
{ | |
int socketSD = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP); | |
if (socketSD <= 0) { | |
NSLog(@"Error: Could not open socket."); |
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 UIKit | |
import ExternalAccessory | |
class ViewController: UIViewController, EAWiFiUnconfiguredAccessoryBrowserDelegate { | |
var accessoryBrowser: EAWiFiUnconfiguredAccessoryBrowser? | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
accessoryBrowser = EAWiFiUnconfiguredAccessoryBrowser.init(delegate: self, queue: nil) | |
accessoryBrowser?.startSearchingForUnconfiguredAccessoriesMatchingPredicate(nil) |
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
uint64_t nanos() { | |
static mach_timebase_info_data_t info; | |
mach_timebase_info(&info); | |
uint64_t now = mach_absolute_time(); | |
now *= info.numer; | |
now /= info.denom; | |
return now; | |
} |
NewerOlder