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.5.1; | |
contract Stack { | |
int256[] stack; | |
function push(int256 data) public { | |
stack.push(data); | |
} | |
function pop() public returns (int256 data) { |
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
import requests | |
import base64 | |
# encode consumer API key and secret key | |
key = input("key: ") | |
secret = input("secret: ") | |
encoded = base64.b64encode((key + ":" + secret).encode()).decode() | |
# construct payload | |
endpoint = "https://api.twitter.com/oauth2/token" |
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 run_n_times(n): | |
def identity(func): | |
def wrapped(*args, **kwargs): | |
for i in range(n): | |
response = func(*args, **kwargs) | |
return response | |
return wrapped | |
return identity | |
@run_n_times(10) |
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
from z3 import * | |
# create sort | |
group = DeclareSort('G') | |
# create function symbols | |
iden = Function('e', group) | |
mult = Function('m', group, group, group) | |
inv = Function('i', group, group) |
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
class Publisher: | |
def __init__(self): | |
self.subscribers = [] | |
def publish(self, message): | |
print("publishing message: {msg}".format(msg=message)) | |
for subscriber in self.subscribers: | |
subscriber.onReceive(message) | |
def addSubscriber(self, subscriber): |