官方 GitHub identicon 算法

official GitHub identicon algorithm

我想获取官方GitHub implementation of identicon算法。 在哪里可以找到谢谢。

找了很多教程都不是官方实现的, 我该怎么做?

this Twitter Post, there is no official release but an employee of GitHub ported it to rust and published it here 的回答所述。您需要输入的数字是您的用户 ID。您可以通过 运行 向 https://api.github.com/users/<username> 发出请求(该字段名为 id)。

构建完成后,您可以使用以下命令对其进行测试(bash、$ghUserId):

echo -n "$ghUserId" | ./target/debug/identicon > identicon.png

为了从用户名中获取用户id并在一个命令中计算identicon,你可以使用这个(如果你已经安装了jq$githubUserName是一个带有用户名的变量):

curl "https://api.github.com/users/$githubUserName" | jq .id | ./target/debug/identicon > identicon.png

另请注意,我使用 ./target/debug/identicon 作为可执行文件,因为我在构建它后在此处找到它。

您还可以从 https://github.com/identicons/<username>.png 获取标识,如 this blog post 中所述。