关键字:php、curl、apns、推送、http2
时间:2017年4月

PHP代码

<?php
ini_set('display_errors', 1);

$service_url = 'https://api.push.apple.com/3/device/';
$token = '07cd****3217****6289****94999228d7b45339fbafdf08****8f83****499b';
$headers = array();
$header[] = 'apns-topic:com.xxxxx.xxapp'; // bundle-id
$payload = '{"aps":{"alert":"hello","sound":"msg_high.m4a"}}';

$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_2_0);
curl_setopt($ch, CURLOPT_SSLCERT, '/var/www/cer.pem'); // HTTP/2推送证书
curl_setopt($ch, CURLOPT_SSLCERTPASSWD, '');           // 证书没有密码
curl_setopt($ch, CURLOPT_URL, $service_url . $token);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
curl_setopt($ch, CURLOPT_HEADER, TRUE);                // 显示response头
curl_setopt($ch, CURL_RETURNTRANSFER, 1);

$result = curl_exec($ch);

curl_close($ch);

echo $result;
?>

结果

HTTP/2 200 apns-id: 5149B14A-0CB2-B045-8EE9-3C21ECB13FBC

关键字:debian、ntp
时间:2017年4月

脚本

root@debian:~# timedatectl status
      Local time: Tue 2017-04-18 23:01:02 CST
  Universal time: Tue 2017-04-18 15:01:02 UTC
        RTC time: Tue 2017-04-18 15:01:02
       Time zone: Asia/Shanghai (CST, +0800)
     NTP enabled: no
NTP synchronized: no
 RTC in local TZ: no
      DST active: n/a
root@debian:~# vim /etc/systemd/timesyncd.conf
...
[Time]
Servers=0.debian.pool.ntp.org 1.debian.pool.ntp.org 2.debian.pool.ntp.org 3.debian.pool.ntp.org
...
root@debian:~# timedatectl set-ntp true
root@debian:~# timedatectl status
      Local time: Tue 2017-04-18 23:02:33 CST
  Universal time: Tue 2017-04-18 15:02:33 UTC
        RTC time: Tue 2017-04-18 15:02:33
       Time zone: Asia/Shanghai (CST, +0800)
     NTP enabled: yes
NTP synchronized: no
 RTC in local TZ: no
      DST active: n/a
root@debian:~# timedatectl status
      Local time: Tue 2017-04-18 23:04:16 CST
  Universal time: Tue 2017-04-18 15:04:16 UTC
        RTC time: Tue 2017-04-18 15:04:16
       Time zone: Asia/Shanghai (CST, +0800)
     NTP enabled: yes
NTP synchronized: yes
 RTC in local TZ: no
      DST active: n/a

关键字:布克、钟表匠、监狱

布克原是法国的一名天主教信徒。1536年,因反对罗马教廷的刻板教规,被捕入狱。由于他是一位钟表大师,入狱后,被安排制作钟表。在那个失去自由的地方,他发现无论狱方采取什么手段,都不能使他们制作出日误差低于1/10秒的钟表。可是,入狱前在自己的作坊里,他们能使钟表的误差低于1/100秒。起初,布克把这归结为制造的环境,后来,他们越狱逃往日内瓦,才发现真正影响钟表准确度的不是环境,而是制作钟表时的心情。