分类 教程 下的文章

git log --pretty=format:"%cn made a commit %h on %ad - %s" --date=short

如果需要过滤,就可以用pipe符号|,然后后面用grep来匹配字符串。
关于grep,如果要反向匹配,就是说,不含有某个字符,用grep -v

Title: How to verify json web token (jwt) signature by using PHP native functions?

class Jsonwebtoken()
{
   public static function verify(string $token)
    {
        /**应该学习firebase jwt lib,做大量错误处理 */
        $tokenParts = explode('.', $token);
        list($headb64, $bodyb64, $cryptob64) = $tokenParts;

        /** both work */
        $pubKey = openssl_get_publickey('file://'.__DIR__.'/jwtRS256.key.pub');
        // $pubKey = file_get_contents(__DIR__.'/jwtRS256.key.pub');

        $signature = self::urlsafeB64Decode($cryptob64); // from Google Firebase JWT lib

        $isVerified = openssl_verify("$headb64.$bodyb64", $signature, $pubKey, OPENSSL_ALGO_SHA256);

        return $isVerified === 1; // openssl_verify return value is int
    }

    /**
     * Decode a string with URL-safe Base64.
     *
     * @param string $input A Base64 encoded string
     *
     * @return string A decoded string
     */
    public static function urlsafeB64Decode(string $input)
    {
        $remainder = strlen($input) % 4;
        if ($remainder) {
            $padlen = 4 - $remainder;
            $input .= str_repeat('=', $padlen);
        }
        return base64_decode(strtr($input, '-_', '+/'));
    }
}

- 阅读剩余部分 -

<?php
$my_array = array("Dog","Cat","Horse");

list($a, $b, $c) = $my_array;
echo "I have several animals, a $a, a $b and a $c.";
// I have several animals, a Dog, a Cat and a Horse.
?>

这个函数有点意思, 和ES6里面的 ...Array有点像。
补充
这个函数的问题是,如果左边的$my_array比如只有2个元素,也就是是说count($my_array) ===2,这种情况就会导致报错,因为数组越界了。所以应该增加一定的校验和错误处理。

我理解就是,tag就是一个快照(snapshot),是某个repo的一个定点的状态;branch就是一段录像,反应了一段时间范围内的变化(多个commit组成了一个开发变化的过程)。

A tag represents a version of a particular branch at a moment in time. A branch represents a separate thread of development that may run concurrently with other development efforts on the same code base. Changes to a branch may eventually be merged back into another branch to unify them.

From the theoretical point of view:

  • tags are symbolic names for a given revision. They always point to the same object (usually: to the same revision); they do not change.
  • branches are symbolic names for line of development. New commits are created on top of branch. The branch pointer naturally advances, pointing to newer and newer commits.

- 阅读剩余部分 -

原来各个region之间还是物理隔离的,基本上没法互通。

目前我用的是Oregon,就是us-west-2,至于为啥选了这个区,我也不知道啊。