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
# Creating sigleton | |
class Singleton: | |
_instance = None | |
def __new__(cls): | |
if cls._instance is None: | |
cls._instance = super().__new__(cls) | |
return cls._instance | |
def __init__(self): |
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 pprint import pprint | |
from itertools import product | |
suits = ['♠️', '♣️', '♥️', '♦️'] | |
values = ['2', '3', '4', '5', '6', '7', '8', '9', '10', 'jack', 'queen', 'king', 'ace'] | |
deck = list(product(suits, values)) | |
pprint(deck, compact=False) |
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 socket | |
import struct | |
# create a raw socket that listens for ICMP packets | |
icmp = socket.getprotobyname('icmp') | |
sock = socket.socket(socket.AF_INET, socket.SOCK_RAW, icmp) | |
while True: | |
packet, address = sock.recvfrom(1024) | |
print(len(packet)) |
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 Web3 from "web3"; | |
import ERC20ABI from './abi/api-moonDoge.js'; | |
const tokenData = async (token = "") => { | |
const web3 = new Web3( | |
new Web3.providers.HttpProvider("https://bsc-dataseed1.binance.org:443") | |
); | |
if (!token) { | |
var customToken = new web3.eth.Contract( | |
ERC20ABI, |
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
# Running your own xdai done | |
# # # # # # # # # # # # # # # # # # | |
https://forum.1hive.org/t/run-your-own-xdai-node/2875/8 | |
# The graph api | |
# # # # # # # # # # # # # # # # # # | |
https://thegraph.com/explorer/subgraph/1hive/uniswap-v2 | |
POST: https://api.thegraph.com/subgraphs/name/1hive/uniswap-v2 |
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
# Elementu išpakavimas | |
{lists.map(list => <li>{list.projectName}</li>)} | |
# Funkcinio elemento hookai ir axios | |
const [lists, setprojects] = useState([]); | |
useEffect(() => { | |
axios | |
.get("http://localhost:9090/api/project") |
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
#Random | |
## Secure random generating | |
private static final int NUMBER_OF_CARDS = 52; | |
private static final SecureRandom randomNumbers = new SecureRandom(); | |
int second = randomNumbers.nextInt(NUMBER_OF_CARDS) | |
#Printing | |
##Printing values with leading zeros 0: | |
System.out.printf("valu:e %s%n", counter ); |