This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.4.24; | |
// * dice2.win - fair games that pay Ether. Version 5. | |
// | |
// * Ethereum smart contract, deployed at 0xD1CEeeeee83F8bCF3BEDad437202b6154E9F5405. | |
// | |
// * Uses hybrid commit-reveal + block hash random number generation that is immune | |
// to tampering by players, house and miners. Apart from being fully transparent, | |
// this also allows arbitrarily high bets. | |
// |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo apt-get install htop -y # This is not necessary, I just have it for check the resources consumption | |
sudo apt-get update | |
sudo apt-get install golang-go -y | |
export PATH=$PATH:$GOROOT/bin:$GOPATH/ | |
export GOPATH=$HOME/go | |
wget https://dist.ipfs.io/go-ipfs/v0.4.15/go-ipfs_v0.4.15_linux-amd64.tar.gz | |
tar xvfz go-ipfs_v0.4.15_linux-amd64.tar.gz | |
sudo mv go-ipfs/ipfs /usr/local/bin/ipfs | |
ipfs init | |
ipfs config Addresses.Gateway /ip4/0.0.0.0/tcp/8080 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.4.16; | |
contract Atm { | |
mapping(address => bool) public withdrawer; | |
uint256 public basicAmount; | |
address public owner; | |
function Atm() public payable { | |
owner = msg.sender; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"config": { | |
"chainId": 99, | |
"homesteadBlock": 1, | |
"eip150Block": 2, | |
"eip150Hash": "0x0000000000000000000000000000000000000000000000000000000000000000", | |
"eip155Block": 3, | |
"eip158Block": 3, | |
"byzantiumBlock": 4 | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" vim-bootstrap b990cad | |
"***************************************************************************** | |
"" Vim-PLug core | |
"***************************************************************************** | |
if has('vim_starting') | |
set nocompatible " Be iMproved | |
endif | |
let vimplug_exists=expand('~/.config/nvim/autoload/plug.vim') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def _notify_command_handlers(self, handlers, new_messages): | |
for message in new_messages: | |
# if message has next step handler, dont exec command handlers | |
if (isinstance(message, types.CallbackQuery)) or \ | |
(isinstance(message, types.Message) and (message.chat.id not in self.message_subscribers_next_step)): | |
for message_handler in handlers: | |
if self._test_message_handler(message_handler, message): | |
self._exec_task(message_handler['function'], message) | |
break | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.code | |
PUSH 60 contract RevertTest {\n | |
... | |
PUSH 40 contract RevertTest {\n | |
... | |
MSTORE contract RevertTest {\n | |
... | |
CALLVALUE function RevertTest() public {... | |
ISZERO function RevertTest() public {... | |
PUSH [tag] 1 function RevertTest() public {... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func GodDoSomething(ctx Contex){ | |
c := make(chan struct{}) | |
go func() { | |
defer close(c) | |
wg.Wait() | |
}() | |
ds1ctx ,ds1CancelFunc := context.WithCancel(ctx) | |
wg.Add(1) | |
go DoSomething1(ds1ctx, wg) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void draw() | |
{ | |
Graphviz gv = new Graphviz(); //Graphviz Object. | |
Graph graph = new Graph("g1", GraphType.DIGRAPH); //Create New Gpaph. | |
graph.addAttributes(new Attribute("rankdir","LR")); //Add some attribute. | |
Node n1 = new Node("N1"); //Create Node Object. | |
n1.addAttributes(new Attribute("label","\" Node1 \"")); //Add attribute | |
Node n2 = new Node("N2"); | |
Node n3 = new Node("N3"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(); | |
// 這裡我將drl檔案放在 drools/example1.drl 這裡,記得改成你的檔案目錄 | |
kbuilder.add(ResourceFactory.newClassPathResource("drools/example1.drl"), ResourceType.DRL); | |
// 確認載入是否有錯誤 | |
if (kbuilder.hasErrors()) { | |
System.out.println(kbuilder.getErrors().toString()); | |
throw new RuntimeException("Unable to compile \"example1.drl\"."); | |
} | |
// 取得所有Package | |
Collection<KnowledgePackage> pkgs = kbuilder.getKnowledgePackages(); |
NewerOlder