title | date | categories | author | tags | ||
---|---|---|---|---|---|---|
接码平台 |
2019-12-12 |
article |
Kamchan |
|
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 | |
ssh -p 2222 root@localhost "/sbin/hfs_uti /dev/rdisk0s2s1 cat /.journal" > my.journal | |
ssh -p 2222 root@localhost "/sbin/hfs_uti /dev/rdisk0s1s2 cat /.journal" > my.journal |
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) 2018 Michael Eisel. All rights reserved. | |
#import "CLRCallRecorder.h" | |
#import <dlfcn.h> | |
#import <libkern/OSAtomicQueue.h> | |
#import <pthread.h> | |
typedef struct { | |
void *ptr; | |
NSInteger number; |
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 <objc/runtime.h> | |
@implementation NSAssertionHandler (Disable) | |
+ (void)initialize { | |
[self swizzMethod:@selector(handleFailureInMethod:object:file:lineNumber:description:) to:@selector(swizz_handleFailureInMethod:object:file:lineNumber:description:)]; | |
[self swizzMethod:@selector(handleFailureInFunction:file:lineNumber:description:) to:@selector(swizz_handleFailureInFunction:file:lineNumber:description:)]; | |
} | |
+ (void)swizzMethod:(SEL)originalSelector to:(SEL)swizzledSelector { |
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
require 'xcodeproj' | |
project_path = Dir.glob("*.xcodeproj")[0] | |
project = Xcodeproj::Project.open(project_path) | |
project.targets.select { | |
|target| target.name.include? "InHouse" | |
}.each { |target| | |
puts "Process " + target.name + "..." | |
puts "Delete copy phases", target.copy_files_build_phases | |
target.copy_files_build_phases.each { |phases| |
I suspect most developers are using the libdispatch inefficiently due to the way it was presented to us at the time it was introduced and for many years after that, and due to the confusing documentation and API. I realized this after reading the 'concurrency' discussion on the swift-evolution mailing-list, in particular the messages from Pierre Habouzit (who is the libdispatch maintainer at Apple) are quite enlightening (and you can also find many tweets from him on the subject).
- https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20170828/date.html
- https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20170904/date.html
- https://twitter.com/pedantcoder
My take-aways are:
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
- (CGFloat)heightForAttributedString:(NSAttributedString *)text maxWidth:(CGFloat)maxWidth { | |
if ([text isKindOfClass:[NSString class]] && !text.length) { | |
// no text means no height | |
return 0; | |
} | |
NSStringDrawingOptions options = NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading; | |
CGSize size = [text boundingRectWithSize:CGSizeMake(maxWidth, CGFLOAT_MAX) options:options context:nil].size; |
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 time | |
from http.server import BaseHTTPRequestHandler, HTTPServer | |
HOST_NAME = 'localhost' | |
PORT_NUMBER = 9000 | |
class MyHandler(BaseHTTPRequestHandler): | |
def do_HEAD(self): | |
self.send_response(200) |
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
NSDate *date = [NSDate date]; | |
NSCalendar *calendar = [NSCalendar currentCalendar]; | |
NSDateComponents *comps; | |
// 年月日获得 | |
comps = [calendar components:(NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit) | |
fromDate:date]; | |
NSInteger year = [comps year]; | |
NSInteger month = [comps month]; | |
NSInteger day = [comps day]; |