This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Implement topological sorting by Kahn's algorithm | |
# Reference: https://youtu.be/guJkbg-gnLM | |
def ordering(input): | |
output = [] | |
queue = [] | |
incoming = {} | |
for k, v in input.items(): | |
if k not in incoming: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 1. Run `npm install keythereum` in an empty directory. | |
* 2. Save this script to a file named `main.js`. | |
* 3. Run `node main.js` in the same directory. | |
*/ | |
let keythereum = require("keythereum"); | |
// the keystore address | |
let address = "0x792E47E160f4eE67c17714Df1c92f678640E0E4c"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//SPDX-License-Identifier: Unlicense | |
pragma solidity ^0.8.0; | |
import "hardhat/console.sol"; | |
struct IndexValue { | |
uint256 keyIndex; | |
string value; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const upstream = 'www.google.com' | |
addEventListener('fetch', event => { | |
event.respondWith(fetchAndApply(event.request)); | |
}) | |
async function fetchAndApply(request) { | |
const region = request.headers.get('cf-ipcountry').toUpperCase(); | |
const ip_address = request.headers.get('cf-connecting-ip'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
chrome-bookmark-archive |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
daily-issue.bookmark |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sonatype.bookmark |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
docker-shortcut |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 验证身份证号码的算法 | |
// 可以根据规则找出校验位合规的身份证号 | |
let generatorIdNumber = (x) => { | |
// 目前是 16位 + 2位 | |
let str = '1111111111111111' + x | |
// 字符值 | |
let a = str.split('').map(i => parseInt(i)) | |
// 权重银子 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
@desc quick sort python version | |
@param List arr | |
@return List arr | |
""" | |
def quickSort(arr, left=None, right=None): | |
# default parameter | |
if left == None or right == None: | |
left = 0 |