Skip to content

Instantly share code, notes, and snippets.

View mingder78's full-sized avatar

Ming-der Wang mingder78

View GitHub Profile
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
const request = { method: 'POST', url: '/', headers: { authorization: internals.header('john', '123:45') } };
server.inject(request, (res) => {
expect(res.result).to.equal('ok');
done();
});
@mingder78
mingder78 / gist:4a500f1bbd84d57b0601417792ea275b
Created August 14, 2017 04:11
/voordeel_locaties/golfpark-spandersbosch
I, [2017-08-14T03:09:32.987205 #26197] INFO -- : Started GET "/voordeel_locaties/golfpark-spandersbosch" for 119.77.228.244 at 2017-08-14 03:09:32 +0000
I, [2017-08-14T03:09:32.988249 #26197] INFO -- : Processing by GreenLocationsController#show as HTML
I, [2017-08-14T03:09:32.988291 #26197] INFO -- : Parameters: {"id"=>"golfpark-spandersbosch"}
D, [2017-08-14T03:09:32.988398 #26197] DEBUG -- : Geokit is using the domain: codegreenit.com
D, [2017-08-14T03:09:32.990838 #26197] DEBUG -- : Location Load (0.6ms) SELECT `locations`.* FROM `locations` WHERE `locations`.`sane_name` = 'golfpark-spandersbosch' LIMIT 1
D, [2017-08-14T03:09:32.991733 #26197] DEBUG -- : GreenLocation Load (0.3ms) SELECT `green_locations`.* FROM `green_locations` WHERE `green_locations`.`location_id` = 134 LIMIT 1
D, [2017-08-14T03:09:32.992762 #26197] DEBUG -- : Attachment Load (0.2ms) SELECT `attachments`.* FROM `attachments` WHERE `attachments`.`attachable_id` = 134 AND `attachments`.`attachable_type` = 'Location'
@mingder78
mingder78 / gist:5cbc8e3f267084e278ded2385aa6673e
Created May 31, 2017 05:56
10.1.11.166 - - - [11/May/2017:09:43:12 +0800] GET / 200 1496 - - - 0.000
%{IPORHOST:s_ip} ?(%{IPORHOST:c_ip}|%{NOTSPACE:c_ip}) %{NOTSPACE:remote_logname} %{NOTSPACE:remote_user} \[%{MONTHDAY:day}/%{MONTH:month}/%{YEAR:year}:%{HOUR:hour}:%{MINUTE:minute}:%{SECOND:second} %{ISO8601_TIMEZONE:timezone}\] %{WORD:request} %{NOTSPACE:file_path} ?(%{NOTSPACE:http_version}| ) %{WORD:status} %{INT:bytes} %{NOTSPACE:referer} %{GREEDYDATA:user_agent} %{NOTSPACE:data} %{BASE16FLOAT:time_taken}
@mingder78
mingder78 / gist:d56cc051d8bffc2f3c93e3ecd103d044
Created December 13, 2016 01:52
where to download kibana 4.x rpm file.
https://download.elasticsearch.org/kibana/kibana/kibana-4.6.1-x86_64.rpm