V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
爱意满满的作品展示区。
zjcqoo

利用 Jekyll 内置的模板语言 Liquid 让 GitHub 计算数学问题~

  •  
  •   zjcqoo · Oct 7, 2017 · 2222 views
    This topic created in 3128 days ago, the information mentioned may be changed or developed.
    之前一直没详细了解 Jekyll 的 Liquid 语法,于是晚上去官网研究了翻。突然脑洞大开,在想是不是可以利用 GitHub 的计算力,来算一些数学问题呢:)

    于是先写了个比较简单的,计算质数:

    demo: https://fanhtml5.github.io/prime.html

    source: https://github.com/fanhtml5/fanhtml5.github.io/blob/master/_layouts/prime.html

    不过这个语言缺少很多功能,比如循环貌似不能设置 step,开根号的函数也没有,所以实现的不是很完善。

    当然计算效率也是超级慢的,本地计算 1-10000 的质数,居然要 8 秒。。。

    另外,看见官网上说 Liquid 内置密码学 Hash 函数: https://help.shopify.com/themes/liquid/filters/string-filters

    不过本地和 GitHub 上测试都没成功,不知道是什么原因。如果可以的话,倒是可以试试 SHA256 PoW 了:)
    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   801 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 34ms · UTC 20:35 · PVG 04:35 · LAX 13:35 · JFK 16:35
    ♥ Do have faith in what you're doing.