Skip to content

Instantly share code, notes, and snippets.

View fky2015's full-sized avatar
🎯
Working.

Feng Kaiyu fky2015

🎯
Working.
View GitHub Profile
@fky2015
fky2015 / settings.json
Created May 14, 2022 02:10
Compile BIThesis using VSCode LaTeX Workshop
{
"latex-workshop.latex.tools":[
{
"name":"latexmk",
"command":"latexmk",
"args":[
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"-xelatex",
@fky2015
fky2015 / Lottery.sol
Last active May 6, 2022 10:57
Lottery.sol
pragma solidity >=0.8.0;
import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/utils/Address.sol";
// 该合约会实现一个简单彩票游戏,玩家可以在其中为自己购买彩票,或将其赠送给另一位用户。
// 当 1 小时过去了,或有 10 名参与者,下一个参加抽奖的玩家将执行一个选择获胜者的函数。
// 存储在合约钱包中的所有资金都将发送给获胜者,之后游戏会开始新的一轮。
@fky2015
fky2015 / test_MyToken.js
Created April 10, 2022 03:14
Moonbeam lesson 2
// Transfer token must under balance limit.
it("should not transfer if token is insufficient", async () => {
const amount = "100000000000000000000000000";
// Transfer method
try {
await token.transfer(accounts[0], amount, { from: accounts[1] });
assert.fail('should have thrown before');
} catch (error) {
assert.ok(error.message.indexOf('revert') >= 0, 'error message must contain revert');
}
@fky2015
fky2015 / Subbytes.py
Created March 17, 2022 13:02
AES SubBytes() implementation
def gf_degree(a) :
res = 0
a >>= 1
while (a != 0) :
a >>= 1;
res += 1;
return res
def gf_invert(a, mod=0x1B) :
v = mod
@fky2015
fky2015 / roam-research-auto-delete.js
Created September 5, 2021 02:25
Roam Research Auto Delete Script
/*
This script is for delete block with a tag marked in "auto-deleted" in specific page.
e.g.
```
- # title #auto-deleted
- content
- # another title #auto-delete
- to be deleted #auto-deleted
```
after run action `delete`x2 and `clean`x1, will become:

Keybase proof

I hereby claim:

  • I am fky2015 on github.
  • I am fkynjyq (https://keybase.io/fkynjyq) on keybase.
  • I have a public key whose fingerprint is F680 87B8 4C85 FA44 B2E1 A506 F0D1 B1AF CD9E C7F6

To claim this, I am signing this object: