This repository contains the code snippets from the tutorial A Hackers Guide to Layer 2: Zero Merkle Trees from Scratch.
Thanks to OAS for sponsoring this tutorial series.
Copyright 2023 Carter Jack Feldman
This repository contains the code snippets from the tutorial A Hackers Guide to Layer 2: Zero Merkle Trees from Scratch.
Thanks to OAS for sponsoring this tutorial series.
Copyright 2023 Carter Jack Feldman
mapping(address => uint256) amountLeftToMint;
addUserToPresale(address _buyer, uint256 _amt) external onlyOwner {
amountLeftToMint[_buyer] = _amt;
}
function presaleSingle(bytes calldata _proof) external payable {
// ... other require statements
require(amountLeftToMint[msg.sender] > 0);
amountLeftToMint[msg.sender]--;
function benchmark1Mapping() external {
require(allowList[msg.sender] == 1, "not allowed");
// business logic
}
function benchmark2PublicSignature(bytes calldata _signature) external {
require(
allowListSigningAddress ==
keccak256(
mod codec; | |
use crate::codec::MQTTCodec; | |
use std::error::Error; | |
use std::net::{IpAddr, Ipv4Addr, SocketAddr}; | |
use tokio::net::{TcpListener, TcpStream}; | |
use tokio_util::codec::{Framed}; |
:root { | |
--heng-fa-chuen: #b51921; | |
--tai-koo: #b2103e; | |
--kowloon-bay: #c41832; | |
--tseung-kwan-o: #ef342a; | |
--wui-kai-sha: #a84d18; | |
--po-lam: #f68f26; | |
--sai-wan-ho: #faca07; | |
--disneyland-resort: #07594a; | |
--skek-kip-mei: #4ba946; |
# Script to generate a new block every minute | |
# Put this script at the root of your unpacked folder | |
#!/bin/bash | |
echo "Generating a block every minute. Press [CTRL+C] to stop.." | |
address=`./bin/bitcoin-cli getnewaddress` | |
while : | |
do |
The computer driven markets for instruments like stocks and exchange traded stock options, have transformed finance and the flow of capital. These markets are enabled by order matching engines (and the infrastructure that supports this software). Before computer trading networks and matching engines, stocks where traded on cavernous exchange floors and transaction costs where high. When electronic trading fully matured, floor traders were a fading anachronism and transaction costs had been reduced to pennies a share in many cases. Electronic trading could not exist without advanced network infrastructure, but without the software matching engines no shares would change hands. The computer trading networks, the matching engine software has also created a concentrated nexus of potential failure. Failures in these systems have increased as the frequency and volume on the electronic networks has increased. The position of order matching engines in the trading infrastructure makes these systems o
import Foundation | |
import Mapbox | |
import SQLite | |
// MARK: MbtilesSource | |
enum MBTilesSourceError: Error { | |
case CouldNotReadFileError | |
case UnknownFormatError | |
case UnsupportedFormatError |
pg_dump is a nifty utility designed to output a series of SQL statements that describes the schema and data of your database. You can control what goes into your backup by using additional flags.
Backup: pg_dump -h localhost -p 5432 -U postgres -d mydb > backup.sql
Restore: psql -h localhost -p 5432 -U postgres -d mydb < backup.sql
-h is for host.
-p is for port.
-U is for username.
-d is for database.
// This file is MIT Licensed. | |
// | |
// Copyright 2017 Christian Reitwiessner | |
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | |
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | |
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF O |