Skip to content

Instantly share code, notes, and snippets.

View dgarcia360's full-sized avatar

David Garcia dgarcia360

View GitHub Profile
@dgarcia360
dgarcia360 / sphinx-windows.md
Last active November 3, 2021 08:53
Installing Sphinx on Windows

Requirements

Instructions

Run the following commands in the folder you want to create a documentation project.

  1. Install Sphinx
@dgarcia360
dgarcia360 / 0.9.6.2 properties
Created June 30, 2020 08:22
0.9.6.2 properties
config-database.properties
==========================
.. csv-table::
:header: "Property", "Type", "Description", "Default"
:delim: ;
**database**; ; ;
databaseUri; string; Database uri.; mongodb://127.0.0.1:27017
databaseName; string; Database name.; catapult

config-database.properties

Property Type Description Default
database      
databaseUri string Database uri. mongodb://127.0.0.1:27017
databaseName string Database name. catapult
@dgarcia360
dgarcia360 / test.ts
Created April 13, 2020 11:04
[Bug] The same alias cannot be used for more than one asset.
import {MosaicId, NamespaceHttp} from "symbol-sdk";
const util = require('util');
const url = 'http://api-01.us-west-1.symboldev.network:3000';
const namespaceHttp = new NamespaceHttp(url);
const mosaicIds = [
new MosaicId('2DFD0AF0ED436D59'),
new MosaicId('2EED9EA233EC037F'),
new MosaicId('7D4542F3474D7D71')];
@dgarcia360
dgarcia360 / scrapper.py
Last active April 6, 2020 17:22
Checks if some NIS1 node has enable historical account data retrieval
from urllib.request import Request, urlopen
from bs4 import BeautifulSoup
PORT = ':7890'
ENDPOINT = '/account/historical/get?address=NALICELGU3IVY4DPJKHYLSSVYFFWYS5QPLYEZDJJ&startHeight=17592&endHeight=17592&increment=1'
explorer_url = 'https://nemnodes.org/nodes/'
req = Request(explorer_url, headers={'User-Agent': 'Mozilla/5.0'})
page_url = urlopen(req).read()
soup = BeautifulSoup(page, 'html')
@dgarcia360
dgarcia360 / gist:c854e3ba8e45ad84922b08865908c691
Created March 23, 2020 16:22
rocksdb (catapult-server) BUILDWIN error
C:\Users\dgarc\CLionProjects\lib\rocksdb\_build>cmake -G "Visual Studio 15 2017 Win64" -DROCKSDB_INSTALL_ON_WINDOWS=ON -DGFLAGS=1 -DWITH_SNAPPY=1 -DWITH_TESTS=OFF -DCMAKE_INSTALL_PREFIX=C:\devlibs\2017\rocksdb ..
-- Selecting Windows SDK version 10.0.17763.0 to target Windows 10.0.18363.
-- The CXX compiler identification is MSVC 19.16.27038.0
-- The C compiler identification is MSVC 19.16.27038.0
-- The ASM compiler identification is MSVC
-- Found assembler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x64/cl.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x64/cl.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x64/cl.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
@dgarcia360
dgarcia360 / multisig-test.ts
Created March 10, 2020 12:37
Create 1-of-1 multisig when cosigner private keys are known
import {
Account,
AggregateTransaction,
Deadline,
MultisigAccountModificationTransaction,
NetworkType,
RepositoryFactoryHttp,
UInt64,
} from 'symbol-sdk';
@dgarcia360
dgarcia360 / buildTransactionsMerkleTree.ts
Last active February 12, 2020 16:43
Build Transactions Merkle Tree
import {QueryParams, RepositoryFactoryHttp, UInt64} from "nem2-sdk";
import {MerkleTree} from "merkletreejs/index";
import {sha3_256} from "js-sha3";
const example = async () => {
const nodeUrl = 'http://api-xym-3-01.ap-northeast-1.nemtech.network:3000';
const repositoryHttp = new RepositoryFactoryHttp(nodeUrl);
const blockHttp = repositoryHttp.createBlockRepository();
// replace with block height
const height = UInt64.fromUint(1);
@dgarcia360
dgarcia360 / validateTransactionInBlock.ts
Last active February 13, 2020 12:04
validate transaction in block (WIP)
import {BlockRepository, RepositoryFactoryHttp, UInt64} from "nem2-sdk";
import {sha3_256} from "js-sha3";
const validateTransactionInBlock = async (leaf: string, height: UInt64, blockHttp: BlockRepository) => {
// 1.Calculate H(B) (leaf)
// 2. Obtain HRoot; in Symbol, this is stored in the block header.
const HRoot = (await blockHttp.getBlockByHeight(height).toPromise()).blockTransactionsHash;
console.log('Hroot', HRoot);
// 3. Request merkle path H(A), HCD, HEE2.
const merklePath = (await blockHttp.getMerkleTransaction(height, leaf).toPromise()).merklePath;
@dgarcia360
dgarcia360 / config-fushicho3.rst
Created December 16, 2019 10:21
catapult-server@0.9.1.1 configurable properties cheatsheet

config-database.properties

Property Type Description Default
database      
databaseUri string Database uri. mongodb://127.0.0.1:27017
databaseName string Database name. catapult