打开 sock5 代理:
ssh -D 1337 -q -C -N remote-hostname
# -D sock5 代理端口
# -q 不输出任何内容
#!/bin/bash | |
# | |
# 声明 | |
# | |
# 本脚本主要来自 https://blog.xiexun.tech/linux-bc-custom-opt.html, | |
# 这里只是收藏一下(并做了一点点小修改)。 | |
# | |
# 用法 | |
# |
# References: | |
# https://cmake.org/cmake/help/latest/command/add_custom_target.html | |
# https://samthursfield.wordpress.com/2015/11/21/cmake-dependencies-between-targets-and-files-and-custom-commands/ | |
# https://gist.github.com/socantre/7ee63133a0a3a08f3990 | |
# https://stackoverflow.com/questions/24163778/how-to-add-custom-target-that-depends-on-make-install | |
# https://stackoverflow.com/questions/30719275/add-custom-command-is-not-generating-a-target | |
# https://stackoverflow.com/questions/26024235/how-to-call-a-cmake-function-from-add-custom-target-command | |
# https://blog.csdn.net/gubenpeiyuan/article/details/51096777 | |
cmake_minimum_required(VERSION 3.10) |
Connect the external drive to MacOS. It should mount read-only. Start "System Information", clic on Hardware -> Storage, select your drive in the list and copy its UUID.
Another way to get the UUID is to use the diskutil CLI tool:
~$ diskutil list
~$ diskutil info diskXsY
data:text/html;charset=utf-8, <title>TextEditor</title> <link rel="shortcut icon" href="http://g.etfv.co/https://docs.google.com"/> <style> html{height: 100%;} body{background: -webkit-linear-gradient(#f0f0f0, #fff); padding: 3%; height: 94%;} .paper { font: normal 12px/1.5 "Lucida Grande", arial, sans-serif; width: 50%; height: 80%; margin: 0 auto; padding: 6px 5px 4px 42px; position: relative; color: #444; line-height: 20px; border: 1px solid #d2d2d2; background: #fff; background: -webkit-gradient(linear, 0 0, 0 100%, from(#d9eaf3), color-stop(4%, #fff)) 0 4px; background: -webkit-linear-gradient(top, #d9eaf3 0%, #fff 8%) 0 4px; background: -moz-linear-gradient(top, #d9eaf3 0%, #fff 8%) 0 4px; background: -ms-linear-gradient(top, #d9eaf3 0%, #fff 8%) 0 4px; background: -o-linear-gradient(top, #d9eaf3 0%, #fff 8%) 0 4px; background: linear-gradient(top, #d9eaf3 0%, #fff 8%) 0 4px; -webkit-background-size: 100% 20px; -moz-background-size: 100% 20px; -ms-background-size: 100% 20px; -o-background-size: 100% 20p |
<?php | |
$str = 'Hello,世界!'; | |
preg_match_all('/./us', $str, $match); | |
echo count($match[0]); // 输出9 | |
?> |
+ (NSString *)unicodeStringWithString:(NSString *)string { | |
NSString *result = [NSString string]; | |
for (int i = 0; i < [string length]; i++) { | |
result = [result stringByAppendingFormat:@"\\u%04x", [string characterAtIndex:i]]; | |
/* | |
因为 Unicode 用 16 个二进制位(即 4 个十六进制位)表示字符,对于小于 0x1000 字符要用 0 填充空位, | |
所以使用 %04x 这个转换符, 使得输出的十六进制占 4 位并用 0 来填充开头的空位. | |
*/ | |
} | |
return result; |
// 首先把 UITextField 的 delegate 设置成当前的 ViewController, | |
// 然后在 ViewController.m 里添加下面一个代理方法: | |
- (BOOL)textFieldShouldReturn:(UITextField *)textField | |
{ | |
[textField resignFirstResponder]; | |
return YES; | |
} | |
// 如果有多个文本框需要输入, 希望点`Return`跳到下一个, 就给下一个文本框的 outlet 发送 becomeFirstResponder 消息即可. |
// 代码如下: | |
[NSURLConnection sendAsynchronousRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:urlString]] | |
queue:[[NSOperationQueue alloc] init] | |
completionHandler:^(NSURLResponse *response, NSData *data, NSError *connectionError) { | |
//异步请求完成后的操作 | |
}]; | |
// 如果要在 completionHandler 中更改界面, 需要用以下代码: |
// Create a subclass of `UITextField` or `UITextView`, | |
// and override the `canPerformAction:withSender:` method like following: | |
- (BOOL)canPerformAction:(SEL)action withSender:(id)sender | |
{ | |
if (action == @selector(copy:)) | |
return NO; | |
return [super canPerformAction:action withSender:sender]; | |
} |