【问题标题】:official GitHub identicon algorithm官方 GitHub 识别算法
【发布时间】:2021-03-15 07:01:02
【问题描述】:

我想得到官方的GitHub implementation of identicon算法。 我在哪里可以找到,谢谢。

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

【问题讨论】:

    标签: github identicon


    【解决方案1】:

    正如this Twitter Post 的回答中所述,没有正式发布,但employee of GitHub 将其移植到 rust 并发布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 中所述。

    【讨论】:

    • 哇,谢谢@dan1st。我也在做项目。谢谢 :)。但恐怕那些stackoverflow还没有开源他们的身份生成算法。但无论如何:)
    • 很高兴听到这个消息,但我认为来自官方员工的端口也很有效。
    猜你喜欢
    • 1970-01-01
    • 2020-12-18
    • 2022-01-14
    • 1970-01-01
    • 2020-01-03
    • 2021-12-06
    • 2020-11-21
    • 2010-11-15
    • 2011-12-30
    相关资源
    最近更新 更多