ffmpeg CPU 壓縮與 nvenc

以同樣是 hevc (h.265) 來說, 來源若是 h.264 的 1080p M2TS 片源, 如果 decode 跟 encode 都用顯卡加速 (nvenc), GTX 1080 可以做到 11x 的速度, 若用 CPU 來壓通常只有 0.0x 的速度.

至於畫質, nvenc 就將就點, 適合做直播時使用, 因為做直播延遲不能太久. 明顯肉眼一喵就看得出來的情況, 大概是昏暗然後有聚光打在物體或人物上時候, 聚光到暗部會有明顯的水波紋路, CPU 壓出來相對就沒有這問題, 畫質相對穩定很多, CPU 適合壓來收藏 BD 片源.

php7 ppa

出處: https://www.colinodell.com/blog/201711/installing-php-72

Ubuntu 14.04, 16.04, 17.04, 17.10, & 18.04

PHP 7.2 can be installed using Ondřej Surý’s PPA:

sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install php7.2-cli

View the full list of available packages here.

Debian 8 (Jessie) and 9 (Stretch)

Ondřej Surý also provides PHP 7.2 packages for Debian which can be installed using these commands:

sudo apt-get install apt-transport-https lsb-release ca-certificates
sudo wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/php.list
sudo apt-get update
sudo apt-get install php7.2-cli

Debian 7 (Wheezy)

PHP 7.2 can be compiled from source by following the instructions outlined here: Install PHP 7 on Debian Wheezy. Make sure you git checkout the appropriate tag after cloning the php-src repository.

CentOS / RHEL 6+ & Fedora 25+

Remi Collet, one of the release managers for PHP 7.2, also publishes RPM packages for this new version. You can use the configuration wizard to determine the exact setup steps, or see Remi’s website for additional details about the 7.2.0 release.

Mac OS X

PHP 7.2 can easily be installed via Liip’s php-osx tool:

curl -s https://php-osx.liip.ch/install.sh | bash -s 7.2

Or, if you prefer using Homebrew:

brew tap homebrew/homebrew-php
brew install php72

Windows

PHP 7.2 distributions for Windows can be found on the windows.php.net website: http://windows.php.net/download#php-7.2

You can find instructions for installing the distribution here: https://www.webtechgadgetry.com/install-php-7-windows/

phpbrew

phpbrew is a really nice tool that helps you download, compile, and manage multiple versions of PHP. Assuming you’ve already followed the installation directions and have phpbrew up-and-running, PHP 7.2.0 can be installed with two easy commands:

phpbrew update
phpbrew install -j $(nproc) 7.2.0 +default

Docker

Official PHP images can be found on Docker Hub. You can use the php:7.2 tag for base images.

If you’d like to tinker with PHP 7.2 in an interactive shell, simply run this in your terminal:

docker run -it --rm php:7.2

google fonts

https://fonts.google.com/

https://fonts.google.com/earlyaccess

https://www.google.com/get/noto/

http://fontcdn.org/

php aspect mock

最近在研究 aspect mock.
發現幾點要注意的:

  1. 文件有提到:
    appDir defines the root of web application which is being tested. All classes outside the root will be replaced with the proxies generated by AspectMock. By default it is a directory in which vendor dir of composer if located. If you don’t use Composer or you have custom path to composer’s vendor’s folder, you should specify appDir.
    意思是如果 你 include 要 mock 的 dir 不在 appDir  底下.
    那就不行.
  2. 如果你要 mock 的 class method 是繼承來的.
    class 本身沒有去 override parent method.
    那麼 parent class 也要在 include path 裡面.
  3. 由於 asspect mock 是利用蓋掉已經註冊進去 spl autoload 的 composer ClassLoader
    把它換成自己的, 所以像是 php 內建 Memcached 這種,
    他就沒轍了…

複雜的ipv6設定

還蠻有趣的真的!
之前在台北有用過,
但是那時是用 ddwrt 內建的功能,
點一點就配置好了!
以下是以我前幾天申請了hinet ipv6來玩,
現在申請比以前簡單很多,
http://www.ipv6.hinet.net/,
有線上申請的連結!!
點一點就有了(而且幾乎是馬上),
手癢把之前改裝成 router 的 raspberry pi 2,
增加了 SLAAC 功能,
步驟如下:

1. 開啟 ipv6:
編輯 /etc/modules 加入一行 ipv6

2. /etc/ppp/options: 增加這行 +ipv6 ipv6cp-use-ipaddr

3. 裝完 wide-dhcpv6-client (安裝過程會問你要監聽哪個介面,記得改成 ppp0), 編輯 /etc/wide-dhcpv6/dhcp6c.conf


interface ppp0
{
send ia-pd 0;
script "/etc/wide-dhcpv6/dhcp6c-script";
};
id-assoc pd 0 {
prefix-interface eth0 {
sla-len 0;
};
};

這是要從 isp 那邊拿到配發的 prefix.

4. 裝完 radvd 編輯 /etc/radvd.conf (公告ra用的)

interface eth0
{
AdvSendAdvert on;
AdvManagedFlag off; //由ra取得prefix然後自己組合產生ipv6位址
AdvOtherConfigFlag on; //dns等其他資訊由 dhcpv6 拿
AdvLinkMTU 1492;
MinRtrAdvInterval 3;
MaxRtrAdvInterval 10;
prefix ::/64 {
AdvRouterAddr on;
AdvOnLink on;
AdvAutonomous on;
};
};

dns 部分本來我是設定 rdnss 不過 windows 沒支援…
mac os x 10.10 倒是有.

5. 裝完 wide-dhcpv6-server 編輯 /etc/wide-dhcpv6/dhcp6s.conf
option domain-name-servers 2001:b000:168::1 2001:b000:168::2 2001:4860:4860::8888 2001:4860:4860::8844;
option domain-name “xxx.org”;

第一個就是列出 dns 位址, 前兩組是 hinet 後面是 google的.
option domain-name, dns 尾碼, 設定之後, client 比如只打 www,
如果 dns 查不到,
為自動補完變成 www.xxx.org.

wide-dhcpv6-server 這個東西要不要配置其實無所謂,
因為其實hinet 他的 ipv4 dns 可以查得到反解成 ipv6 的位址,
所以就算沒有ipv6的 dns,
還是照常可以查詢,
我會知道是因為沒有設定 ipv6 dns,
nslookup 可以看到是到 ipv4 dns 查的.

6. 編輯 /etc/sysctl.conf
net.ipv6.conf.all.forwarding=1
net.ipv6.conf.default.forwarding=1
net.ipv6.conf.all.accept_ra=2
net.ipv6.conf.default.accept_ra=2

下面要設定 accept_ra 的原因是如果不這樣
ppp0 就拿不到 ip 了.

7. 編輯 /etc/ppp/ipv6-up 最後加入
service wide-dhcpv6-client start
service radvd start
service wide-dhcpv6-server start

配置完我是直接重開-_-!
然後就完成啦!!

看似輕鬆完成,
其實我研究了整整兩天= =!!
因為要看很多資料,
還要知道 hinet 怎配的…

ssh tunnel

感覺網管跟RD就像一個守門的,
另外一個進攻的….
今天原本開放的機器突然被限定,
只好連到跳板….

開發機 A  —>   資料機 C  被擋,
程式卻放在開發機 A,
所以只好 ssh tunnel 開發機 A –> 跳板機B  —>   資料機 C …