Skip to content

Instantly share code, notes, and snippets.

View mingder78's full-sized avatar

Ming-der Wang mingder78

View GitHub Profile
nmap -A -T4 scanme.nmap.org ming@Ming-ders-MacBook-Pro
Starting Nmap 6.47 ( http://nmap.org ) at 2014-09-14 13:04 CST
Nmap scan report for scanme.nmap.org (74.207.244.221)
Host is up (0.19s latency).
Not shown: 997 closed ports
PORT STATE SERVICE VERSION
22/tcp open ssh OpenSSH 5.3p1 Debian 3ubuntu7.1 (Ubuntu Linux; protocol 2.0)
| ssh-hostkey:
| 1024 8d:60:f1:7c:ca:b7:3d:0a:d6:67:54:9d:69:d9:b9:dd (DSA)
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 {
# check if git is installed
hash git >/dev/null && /usr/bin/env git clone git://github.com/kaochenlong/eddie-vim.git ~/.vim || {
echo "sorry, git is not installed in this machine."
exit
}
@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>
@mingder78
mingder78 / gist:0e4f3910c22793fac07d
Created July 20, 2014 05:10
install google cloud sdk (for playing with kubernetes for running docker in a cluaster)
$ curl https://sdk.cloud.google.com | bash [13:00:26]
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 425 0 425 0 0 179 0 --:--:-- 0:00:02 --:--:-- 179
Downloading Google Cloud SDK install script: https://dl.google.com/dl/cloudsdk/release/install_google_cloud_sdk.bash
######################################################################## 100.0%
Running install script from: /var/folders/fx/t80gxlyx19x0l00v89frtmbw0000gp/T/tmp.XXXXXXXXXX.o87fIXx2/install_google_cloud_sdk.bash
curl -# -f https://dl.google.com/dl/cloudsdk/release/google-cloud-sdk.tar.gz
######################################################################## 100.0%
'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();
});