Skip to content

Instantly share code, notes, and snippets.

View GopherJ's full-sized avatar
🎯
Focusing on applied ZKP

Cheng JIANG GopherJ

🎯
Focusing on applied ZKP
View GitHub Profile
@cf
cf / README.md
Created June 15, 2023 09:26
A Hackers Guide to Layer 2: Zero Merkle Trees from Scratch
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};
@ruanyf
ruanyf / mtr.css
Created March 16, 2019 11:23
mtr.css: Hong Kong MTR station colors http://metrocolor.live/index.html
: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;
@System-Glitch
System-Glitch / generate_blocks.sh
Last active June 21, 2024 18:48
Tutorial for bitcoin regtest
# 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
@jdrew1303
jdrew1303 / readme.md
Last active May 28, 2024 17:42
Market Order Matching Engine

Introduction

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

@namannik
namannik / MGLMapView+MBTiles.swift
Last active April 10, 2024 16:28
MGLMapView+MBTiles
import Foundation
import Mapbox
import SQLite
// MARK: MbtilesSource
enum MBTilesSourceError: Error {
case CouldNotReadFileError
case UnknownFormatError
case UnsupportedFormatError
@AtulKsol
AtulKsol / db_backup_commands.md
Last active May 31, 2024 20:19
Commands to backup & restore database
  1. 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.

@chriseth
chriseth / snarktest.solidity
Last active December 3, 2023 07:03
zkSNARKs test code
// 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