This file contains hidden or 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
[{"label": "H7", "shape": [[1, 0, 1], [1, 1, 1], [1, 0, 1]], "order": "7", "color_hex": "#FF0000", "color_name": "red"}, {"label": "O6", "shape": [[1, 1, 1], [1, 1, 1]], "order": "6", "color_hex": "#DBFF2F", "color_name": "greenyellow"}, {"label": "F5", "shape": [[1, 1, 0], [0, 1, 1], [0, 1, 0]], "order": "5", "color_hex": "#EE82EE", "color_name": "violet"}, {"label": "Y5", "shape": [[1, 1, 1, 1], [0, 1, 0, 0]], "order": "5", "color_hex": "#00FF00", "color_name": "lime"}, {"label": "V5", "shape": [[1, 1, 1], [1, 0, 0], [1, 0, 0]], "order": "5", "color_hex": "#FFC0CB", "color_name": "pink"}, {"label": "U5", "shape": [[1, 0, 1], [1, 1, 1]], "order": "5", "color_hex": "#0000FF", "color_name": "blue"}, {"label": "N5", "shape": [[1, 1, 1, 0], [0, 0, 1, 1]], "order": "5", "color_hex": "#FF8C00", "color_name": "darkorange"}, {"label": "L5", "shape": [[1, 1, 1, 1], [1, 0, 0, 0]], "order": "5", "color_hex": "#008000", "color_name": "green"}, {"label": "Z5", "shape": [[1, 1, 0], [0, 1, 0], [0, 1, 1]], "order": "5", "co |
This file contains hidden or 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
""" | |
A minimal implementation of Monte Carlo tree search (MCTS) in Python 3 | |
Luke Harold Miles, July 2019, Public Domain Dedication | |
See also https://en.wikipedia.org/wiki/Monte_Carlo_tree_search | |
https://gist.github.com/qpwo/c538c6f73727e254fdc7fab81024f6e1 | |
""" | |
from abc import ABC, abstractmethod | |
from collections import defaultdict | |
import math |
This file contains hidden or 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
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[red]%}" | |
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" | |
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}⚡" | |
ZSH_THEME_GIT_PROMPT_CLEAN="" | |
function prompt_char { | |
if [ $UID -eq 0 ]; then echo "%{$fg[red]%}#%{$reset_color%}"; else echo $; fi | |
} | |
# PROMPT='%(?, ,%{$fg[red]%}FAIL: $?%{$reset_color%} |
This file contains hidden or 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.21; | |
/** | |
* @title SafeMath | |
* @dev Math operations with safety checks that throw on error | |
*/ | |
library SafeMath { | |
/** |
This file contains hidden or 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.23; | |
contract SimpleToken { | |
string public name = "SimpleToken"; | |
string public symbol = "SMPT"; | |
uint8 public decimals = 18; | |
uint256 public totalSupply = 1e24; | |
mapping (address => uint256) public balanceOf; | |
mapping (address => mapping (address => uint256)) public allowance; |
This file contains hidden or 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.21; | |
contract A { | |
function f() internal { | |
g(); | |
} | |
function g() internal { | |
} | |
} |
This file contains hidden or 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.21; | |
contract A { | |
uint public a = 0; | |
function f() internal { | |
a = a * 10 + 1; | |
g(); | |
} |
This file contains hidden or 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.18; | |
import 'zeppelin-solidity/contracts/ownership/Ownable.sol'; | |
contract HasAdmins is Ownable { | |
mapping (address => bool) public admins; | |
event AdminAdded(address indexed newAdmin); | |
event AdminRemoved(address indexed admin); |
This file contains hidden or 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
""" | |
Problem Description: | |
https://www.hackerrank.com/contests/world-codesprint-5/challenges/short-palindrome | |
must compile with pypy 3 | |
""" | |
MOD = 10**9 + 7 | |
s = input().strip() |
This file contains hidden or 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
# init a dict | |
d = dict() | |
d = {} | |
d = {'Name': 'Zara', 'Age': 7, 'Class': 'First'} # like js object | |
# get | |
d['Name'] # 'Zara' | |
d['Gender'] # KeyError # Don't use this | |
# dict.get(key, default=None) |
NewerOlder