我想在没有安装Swift的计算机上执行编译的Swift脚本.但默认情况下,Swift编译器似乎使用动态链接库.是否可以静态包含这些库?
使用Docker重现的步骤:
user@host:~# docker run -it swiftdocker/swift
root@16974ad4edb1:/# swift --version
Swift version 3.0-dev (LLVM dffa09ffd8, Clang 9f0d189820, Swift 1c720b8f84)
Target: x86_64-unknown-linux-gnu
root@16974ad4edb1:/# echo 'print("Hello, world")' > helloworld.swift
root@16974ad4edb1:/# swiftc helloworld.swift
root@16974ad4edb1:/# ./helloworld
Hello, world
root@16974ad4edb1:/# exit
exit
user@host:~# docker cp 16974ad4edb1:/helloworld .
user@host:~# file helloworld
helloworld: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.24, BuildID[sha1]=c4d42f6185b3d53ecf2dfb0c386263c17cb34675, not stripped
user@host:~# ./helloworld
./helloworld: error while loading shared libraries: libswiftCore.so: cannot open shared object file: No …Run Code Online (Sandbox Code Playgroud) 我试图从我的Docker镜像中从项目的所有目录中排除所有隐藏文件(以点开头).
排除.git和.gitingore:.git*
要排除所有.keep文件:**/.keep有效
对于所有隐藏文件,我试过:**/.*,但是这会排除包含点的所有文件,就像**/*.*这样.
我希望通过PHP脚本直接链接到Vimeo的视频.我设法手动找到它们,但我的PHP脚本不起作用.这是倡议:例如,我拍摄了这个视频:http://vimeo.com/22439234
当您进入页面时,Vimeo会生成与当前时间戳和此视频相关联的签名.此信息存储在一个JavaScript变量中,紧接在第520行之后:
window.addEvent ('domready', function () {
然后,当您单击"播放"时,HTML5播放器将读取此变量并发送HTTP请求:
http:// player.vimeo.com/play_redirect?clip_id=37111719&sig={SIGNATURE}&time={TIMESTAMP}&quality=sd&codecs=H264,VP8,VP6&type=moogaloop_local&embed_location=
Run Code Online (Sandbox Code Playgroud)
但它也适用于:
http:// player.vimeo.com/play_redirect?clip_id=37111719&sig={SIGNATURE}&time={TIMESTAMP}&quality=sd
Run Code Online (Sandbox Code Playgroud)
如果此URL未使用打开的http://vimeo.com/22439234的IP地址打开,则会返回HTTP代码200并显示错误消息.
如果使用正确的IP地址打开此URL,则标题"位置"会重定向以链接到视频文件:
http://av.vimeo.com/XXX/XX/XXXX.mp4?aksessionid=XXXX&token=XXXXX_XXXXXXXXX
当我http://player.vimeo.com/play_redirect?...手动构建此链接时("右键单击">"源代码">"第520行"),它可以正常工作.
但是使用PHP和正则表达式,它会返回HTTP code 200错误消息.
为什么?
从我的观察,Vimeo的不检查HTTP请求的头http:// player.vimeo.com/play_redirect?...
GET,HEAD与饼干,没有cookies,引用等等......不会改变.
使用PHP,我使用函数file_get_contents()和get_headers().
<?php
function getVimeo($id) {
$content = file_get_contents('http://vimeo.com/'.$id);
if (preg_match('#document\.getElementById\(\'player_(.+)\n#i', $content, $scriptBlock) == 0)
return 1;
preg_match('#"timestamp":([0-9]+)#i', $scriptBlock[1], $matches);
$timestamp = $matches[1];
preg_match('#"signature":"([a-z0-9]+)"#i', $scriptBlock[1], $matches);
$signature = $matches[1];
$url = 'http://player.vimeo.com/play_redirect?clip_id='.$id.'&sig='.$signature.'&time='.$timestamp.'&quality=sd';
print_r(get_headers($url, 1));
}
Run Code Online (Sandbox Code Playgroud) 我有一个带UIToolbar的UIViewController(在底部),我想在里面添加一个带UINavigationBar的UINavigationController.但是不显示UINavigationController.
MyViewController.m:
- (void)viewDidLoad
{
[super viewDidLoad];
int toolBarHeight = 44;
UIToolbar *toolBar = [[UIToolbar alloc] initWithFrame:CGRectMake(0, [self.view bounds].size.height-toolBarHeight, [self.view bounds].size.width, toolBarHeight)];
UIBarButtonItem *button = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemRefresh target:nil action:nil];
toolBar.items = @[button];
[self.view addSubview:toolBar];
MyNavigationController *myNav = [[MyNavigationController alloc] init];
[self addChildViewController:myNav];
}
Run Code Online (Sandbox Code Playgroud) 如何仅从 IP 列表中限制 Docker 公开的容器端口?只有这个 IP 列表才能访问这个端口。
我试过了:
iptables -I DOCKER -p tcp --dport PORT_X -j REJECT --reject-with icmp-port-unreachable
iptables -I DOCKER -p tcp --dport PORT_X --source EXTERNAL_IP_1 --destination HOST_IP_1 -j ACCEPT
iptables -I DOCKER -p tcp --dport PORT_X --source EXTERNAL_IP_2 --destination HOST_IP_1 -j ACCEPT
iptables -I DOCKER -p tcp --dport PORT_X --source EXTERNAL_IP_3 --destination HOST_IP_1 -j ACCEPT
Run Code Online (Sandbox Code Playgroud)