Skip to content

Instantly share code, notes, and snippets.

View indiejoseph's full-sized avatar
🏠
Working from home

Joseph cheng indiejoseph

🏠
Working from home
View GitHub Profile
@indiejoseph
indiejoseph / gist:39ffdef13bef18d919d9ffa822869bb7
Last active April 9, 2024 21:21
CantoneseLLM20240320 conversation log
User:講一個關於維尼大大嘅故仔畀我聽
CantoneseLLM: 維尼大大係一個好聰明、好有創意嘅人。佢成日都會諗到啲好有趣嘅主意。
有一次,維尼大大去咗公園玩。佢見到好多細路仔喺度玩滑梯。佢突然間諗到,如果將滑梯改造成一個旋轉木馬,一定會好受小朋友歡迎。
於是,維尼大大就開始動手整旋轉木馬。佢用咗好多唔同嘅材料嚟整,包括木頭、金屬同埋塑膠。佢仲用咗好多唔同嘅顏色嚟裝飾旋轉木馬。
終於,維尼大大整好咗旋轉木馬。佢將旋轉木馬放喺公園入面,細路仔一見到旋轉木馬就即刻衝埋去玩。旋轉木馬好受小朋友歡迎,好多細路仔都排隊玩。
@indiejoseph
indiejoseph / 中文運用模擬試卷.json
Created February 26, 2024 19:45
CRE公務員綜合招聘考試 模擬考試
{
"assessment": {
"title": "中文運用模擬試卷",
"access": "public",
"type": "assessment",
"model": "assessmentSnapshot",
"description": "",
"isTimed": true,
"timerFor": "assessmentTimed",
"onTimerExpiration": "autoSubmit",
const wait = ms => new Promise(resolve => setTimeout(resolve, ms));
const timeout = (p, ms) => Promise.race([p, wait(ms).then(() => {
throw new Error("Timeout after " + ms + " ms");
})]);
export const pubsubFunction: CloudEventFunction<{
message: { data: string };
}> = async () => {
timeout(checkShellTransactions(), 3 * 60 * 1000) // 3 minutes ms
};
@indiejoseph
indiejoseph / model.py
Created December 19, 2023 08:18
bart onnx model
# Copyright 2022, Lefebvre Dalloz Services
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
// copy from: https://github.com/techbandorg/web3ConnectorNPM/blob/86f5badf121b1e592da82426004d13ba8e8d7d0a/src/walletHooks/component/hooks/useSignMessage.tsx
import { useState, useEffect } from "react";
import { useWeb3React } from "@web3-react/core";
import { ethers } from "ethers";
import Web3 from "web3";
export const useSignMessage = () => {
const { library, account } = useWeb3React();
let web3 = new Web3(library?.provider);
@indiejoseph
indiejoseph / .deps...npm...@openzeppelin...contracts...access...Ownable.sol
Created June 21, 2022 23:00
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.7+commit.e28d00a7.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
useEffect(() => {
const canvas = document.createElement('canvas');
const context = canvas.getContext('2d', {
alpha: false,
});
const colorSampling = () => {
const { videoWidth, videoHeight } = videoRef.current;
context.drawImage(videoRef.current, 0, 0, videoWidth, videoHeight);
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "erc721a/contracts/ERC721A.sol";
import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
contract WEARKey is ERC721A, Ownable {
// events
event WhitelistMint(address sender, uint256 count);
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "erc721a/contracts/ERC721A.sol";
import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
contract WEARKey is ERC721A, Ownable {
// events
event WhitelistMint(address sender, uint256 count);
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "hardhat/console.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/utils/Context.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Burnable.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Pausable.sol";