Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View shawntabrizi's full-sized avatar

Shawn Tabrizi shawntabrizi

View GitHub Profile
@shawntabrizi
shawntabrizi / export_history.sh
Last active November 19, 2023 16:50
Export each historical commit of a repo into a separate folder.
#!/bin/bash
# Name of the folder where files will be copied for each commit
output_folder="commit_files"
# Create the output folder if it doesn't exist
mkdir -p $output_folder
# Counter for incrementing folder names
counter=1
@shawntabrizi
shawntabrizi / index.html
Created June 16, 2022 17:12
the most simple polkadot js api example
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<script src="//unpkg.com/@polkadot/util/bundle-polkadot-util.js"></script>
<script src="//unpkg.com/@polkadot/util-crypto/bundle-polkadot-util-crypto.js"></script>
<script src="//unpkg.com/@polkadot/types/bundle-polkadot-types.js"></script>
<script src="//unpkg.com/@polkadot/api/bundle-polkadot-api.js"></script>
<script type="text/javascript">
@shawntabrizi
shawntabrizi / index.js
Created June 20, 2021 23:49
Get Parachain Wasm Size
var { ApiPromise, WsProvider } = require('@polkadot/api');
// Main function which needs to run at start
async function main() {
const provider = new WsProvider('wss://kusama-rpc.polkadot.io/');
const api = await ApiPromise.create({ provider });
// Get general information about the node we are connected to
const [chain, nodeName, nodeVersion] = await Promise.all([
@shawntabrizi
shawntabrizi / kusama.js
Last active November 7, 2021 09:03
unlocking data on substrate
var { ApiPromise, WsProvider } = require('@polkadot/api');
var { BN_ZERO } = require('@polkadot/util');
async function main() {
const provider = new WsProvider("wss://kusama-rpc.polkadot.io/", false);
provider.connect();
const api = await ApiPromise.create({ provider });
// Get general information about the node we are connected to
const [chain, nodeName, nodeVersion] = await Promise.all([
/// A runtime module template with necessary imports
/// Feel free to remove or edit this file as needed.
/// If you change the name of this file, make sure to update its references in runtime/src/lib.rs
/// If you remove this file, you can remove those references
/// For more guidance on Substrate modules, see the example module
/// https://github.com/paritytech/substrate/blob/master/frame/example/src/lib.rs
fio --randrepeat=1 --ioengine=posixaio --direct=1 --gtod_reduce=1 --name=test --filename=test --bs=4k --iodepth=64 --size=4G --readwrite=randrw --rwmixread=75
######################################
+++ Winner Validators:
#1 == W3F-012 [578e1d3e796c1df204ceb0dd0841b28df59ca81b1e49e0c81e08da11eb088158 (EZ7uBY7Z...)]
[stake_total: 26827_KSM (26,827,164,243,973,954)] [vote_count: 5] [ctrl: Some(1e4c6490abbc74684fa6a32b771a6ace358279948b2655685236679ea8d1af67 (DG3eXF79...))]
#2 == cp287-cloudwalk [30599dba50b5f3ba0b36f856a761eb3c0aee61e830d4beb448ef94b6ad92be39 (DfiSM1qq...)]
[stake_total: 22056_KSM (22,056,129,553,895,962)] [vote_count: 15] [ctrl: Some(30599dba50b5f3ba0b36f856a761eb3c0aee61e830d4beb448ef94b6ad92be39 (DfiSM1qq...))]
#3 == W3F-020 [9ee6f9ef5cb4d24b3519c7efca31a60dc27c215100014e50f8871feb381aebba (GAfhRsNq...)]
@shawntabrizi
shawntabrizi / 0_General_Instructions.md
Last active July 25, 2022 09:05
Sub 0.1 Workshop Setup Instructions

General Instructions

Most workshops at Sub0 will require that you have set up your computer to compile Substrate.

You can use this one-liner to do many of these steps for you automatically:

curl https://getsubstrate.io -sSf | bash -s -- --fast
/// A runtime module that interprets a sipmlified pi calculus
use support::{decl_module, decl_storage, decl_event, StorageMap, dispatch::Result, ensure};
use system::ensure_signed;
use rstd::boxed::Box;
use codec::{ Encode, Decode };
use sr_primitives::traits::Hash;
/// All the types of processes in our calculus
@shawntabrizi
shawntabrizi / customSpecRaw.json
Last active September 13, 2019 08:37
Geneva Workshop
{
"name": "Local Testnet",
"id": "local_testnet",
"bootNodes": [
"/ip4/127.0.0.1/tcp/30333/p2p/QmSidBKvi8CcbqK5TZdAq1cxFBJAYwUWmg6VwwPtVK2eyT"
],
"telemetryEndpoints": null,
"protocolId": null,
"consensusEngine": null,
"properties": null,