Skip to content

Instantly share code, notes, and snippets.

View mingder78's full-sized avatar
🌴
On vacation

Ming-der Wang mingder78

🌴
On vacation
  • Tone Leader Technology Corp.
  • Taipei, Taiwan
View GitHub Profile
@mingder78
mingder78 / gist:eb41956cb88688e0cb779a3fbd5a357f
Last active November 17, 2025 09:18
Cannot find module '../../../build/Release/node_datachannel.node' from '/private/tmp/x/node/node_modules/@ipshipyard/node-datachannel/dist/esm/lib/node-datachannel.mjs'
problem: when import and envoke a webRTC in a node.js app. that is only for a browser app.
$ bun run --hot index.ts
error: Cannot find module '../../../build/Release/node_datachannel.node' from '/private/tmp/x/node/node_modules/@ipshipyard/node-datachannel/dist/esm/lib/node-datachannel.mjs'
solution: add following code segment to your project.json and build node_modules again
+ "trustedDependencies": [
+ "@ipshipyard/node-datachannel",
+ ],
@mingder78
mingder78 / text.txt
Last active October 28, 2025 10:10
Updated Gist via JS
/dns6/14490944-bced-4f7a-90d0-5469826d6d01.pub.instances.scw.cloud/tcp/9001/wss/p2p/12D3KooW9scFmH8UkU39qG5WKWY5WW3MRTERUqLPCoqLQ1oAPpS4
@mingder78
mingder78 / index.ts
Created August 14, 2025 10:03
My awesome script
interface OllamaGenerateRequest {
model: string;
prompt: string;
stream?: boolean;
options?: Record<string, any>; // For Ollama-specific options
}
interface OllamaGenerateResponse {
model: string;
created_at: string;
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
import "@openzeppelin/contracts/interfaces/IERC1271.sol";
import "./IEntryPoint.sol";
// Simple Account Abstraction wallet with passkey-based signature verification
contract AAWallet is IERC1271 {
using ECDSA for bytes32;
const ipfsAPI = require("ipfs-http-client");
const chalk = require("chalk");
const { clearLine } = require("readline");
const { globSource } = ipfsAPI;
const infura = { host: "ipfs.infura.io", port: "5001", protocol: "https" };
// run your own ipfs daemon: https://docs.ipfs.io/how-to/command-line-quick-start/#install-ipfs
// const localhost = { host: "localhost", port: "5002", protocol: "http" };
@mingder78
mingder78 / CopyItem
Created July 4, 2021 07:30
test on Rinkeby for Hack Money 2021 hackathon, super XEROR project.
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol";
contract CopyItem is ERC1155 {
constructor() public ERC1155("http://mars.muzamint.com:3000/{id}.json") {
// _mint(msg.sender, 0, 1000, "GOLD"); // owner, token id, amount, data
// to use id for cryptokitty id as a copy of cryptokitty erc721 token
}
// contracts/GameItems.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol";
contract GameItems is ERC1155 {
uint256 public constant GOLD = 0;
uint256 public constant SILVER = 1;
uint256 public constant THORS_HAMMER = 2;
@mingder78
mingder78 / Demo.sol
Created April 13, 2021 16:31
Demo.sol is a dumb contract, you can run Echo with low gas, forked from https://rinkeby.etherscan.io/address/0x6663184b3521bf1896ba6e1e776ab94c317204b6#code
/**
*Submitted for verification at Etherscan.io on 2021-01-27
*/
pragma solidity 0.6;
contract Demo {
event Echo(string message);
function echo(string calldata message) external {
@mingder78
mingder78 / index.html
Created February 9, 2021 03:20
html code sample
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="./style.less" />
</head>
<body>
<img src="./images/header.png" />
More content: <a href="./other.html">Link to another page</a>.
<script type="module" src="./index.ts"></script>
'use strict';
// Load modules
const Boom = require('boom');
const Hoek = require('hoek');
const Joi = require('joi');
// Declare internals