Skip to content

Instantly share code, notes, and snippets.

@johnson86tw
johnson86tw / general-api.gs
Last active May 23, 2024 10:17
Google Apps Script General API
let book = SpreadsheetApp.openByUrl('');
let sheet = book.getSheetByName("工作表1");
function doGet(e) {
let data = sheet.getDataRange().getValues()
let headers = data[0];
let arr = [];
for (let i = 1; i < data.length; i++) {
@johnson86tw
johnson86tw / kmlToCSV.py
Created January 9, 2024 08:06 — forked from mohitsingh2806/kmlToCSV.py
This is a modified version of "https://gist.github.com/mciantyre/32ff2c2d5cd9515c1ee7". I modified it to add functionality to save the Name and description of the placemarks in the KML file along with the coordinates.
from bs4 import BeautifulSoup
import csv
def main():
"""
Open the KML. Read the KML. Make 3 lists for Name, Coordinates and Description of the placemarks. Save the data to a CSV
"""
name_counter = 0
names_list = []
coords_counter = 0
I contributed to the Semaphore Trusted Setup Multi-Party Ceremony.
The following are my contribution signatures:
Circuit: semaphore16
Contributor # 225
Hash: bcc623e9 675fd000 84f49e98 f0b3f4f0
cbae9604 192e0122 5ae68599 2bd13e5c
18a8f466 5ba642b3 582d0cb6 cb698c93
a3351938 8ed7bdf8 f209a470 66c13574
import HelloWorld from './components/HelloWorld.vue'
import { useBoard, useEthers } from 'vue-dapp'
export default {
name: 'App',
components: {
HelloWorld,
},
setup() {
const { open } = useBoard()
<template>
<img alt="Vue logo" src="./assets/logo.png" />
<HelloWorld msg="Welcome to Your Vue.js App" />
<!-- 這裡 -->
<button @click="open">Connect</button>
{{ address }}
<vdapp-board />
</template>
import { createApp } from 'vue'
import App from './App.vue'
import { VueDapp } from 'vue-dapp'
const app = createApp(App)
app.use(VueDapp)
app.mount('#app')
@johnson86tw
johnson86tw / PrizeSplitter.sol
Last active July 22, 2021 00:30
A prize splitter for hackathon team to split prize evenly from the sponsors.
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
contract PriceSplitter {
using EnumerableSet for EnumerableSet.AddressSet;
// ======================================= STATE VARIABLES =======================================
function deposit(bytes32 _commitment) external payable nonReentrant {
require(!commitments[_commitment], "The commitment has been submitted");
uint32 insertedIndex = _insert(_commitment);
commitments[_commitment] = true;
_processDeposit();
emit Deposit(_commitment, insertedIndex, block.timestamp);
}
function withdraw(bytes calldata _proof, bytes32 _root, bytes32 _nullifierHash, address payable _recipient, address payable _relayer, uint256 _fee, uint256 _refund) external payable nonReentrant {
require(_fee <= denomination, "Fee exceeds transfer value");
require(!nullifierHashes[_nullifierHash], "The note has been already spent");
require(isKnownRoot(_root), "Cannot find your merkle root"); // Make sure to use a recent one
require(verifier.verifyProof(_proof, [uint256(_root), uint256(_nullifierHash), uint256(_recipient), uint256(_relayer), _fee, _refund]), "Invalid withdraw proof");
nullifierHashes[_nullifierHash] = true;
_processWithdraw(_recipient, _relayer, _fee, _refund);
emit Withdrawal(_recipient, _nullifierHash, _relayer, _fee);
}
function process(uint256[2] memory a, uint256[2][2] memory b, uint256[2] memory c, uint256[1] memory publicSignals) public {
require(isAnswer(publicSignals[0]), "incorrect answer");
require(verifier.verifyProof(a, b, c, publicSignals), "invalid");
_setGreeting("answer to the ultimate question of life, the universe, and everything");
}