Skip to content

Instantly share code, notes, and snippets.

@rajeshsubhankar
rajeshsubhankar / check_isomorphic_tree.cpp
Created September 22, 2014 00:29
Check whether 2 binary trees are Isomorphic to each other or not.
#include<bits/stdc++.h>
using namespace std;
struct node
{
int val;
node* left;
node* right;
@rajeshsubhankar
rajeshsubhankar / evaluate_infix.cpp
Created September 22, 2014 18:09
How to evaluate INFIX expression in C++ , INFIX to POSTFIX and evaluation of POSTFIX in one pass.
#include<bits/stdc++.h>
using namespace std;
bool isChar(string s)
{
if(s.size() >1 ) return false;
switch (s[0]) {
case '+': return true;
@rajeshsubhankar
rajeshsubhankar / SkipMetamask.js
Created July 17, 2018 10:08
In development mode while dealing with lot of transactions handling Metamask pop-ups are pain. To avoid that we can create and sign raw transactions.
var Web3 = require('web3');
const Tx = require('ethereumjs-tx')
var web3 = new Web3(Web3.givenProvider || "ws://localhost:8546");
// the address that will send the test transaction
const addressFrom = '0xDFf7787B927c0F03C3a8a49aF6726a074923663c'
//private key of above address
const privKey = 'replace_me'
//address to receive ether

Keybase proof

I hereby claim:

  • I am rajeshsubhankar on github.
  • I am rajeshsubhankar (https://keybase.io/rajeshsubhankar) on keybase.
  • I have a public key ASC7ai9mx-6lLHCqqUn-vScOYiEW1U0LjPrzzFQVMcVuAgo

To claim this, I am signing this object:

@rajeshsubhankar
rajeshsubhankar / sendRawTransaction.js
Created March 13, 2019 12:53 — forked from raineorshine/sendRawTransaction.js
Sends a raw transaction with web3 v1.0 and Infura
const Web3 = require('web3')
const Tx = require('ethereumjs-tx')
// connect to Infura node
const web3 = new Web3(new Web3.providers.HttpProvider('https://mainnet.infura.io/INFURA_KEY'))
// the address that will send the test transaction
const addressFrom = '0x1889EF49cDBaad420EB4D6f04066CA4093088Bbd'
const privKey = 'PRIVATE_KEY'
@rajeshsubhankar
rajeshsubhankar / sendRawTokenTransaction.js
Created March 27, 2019 11:18
Create and sends a raw ERC-20 token transaction with web3 v1.0 and Infura
const Web3 = require('web3');
const Tx = require('ethereumjs-tx');
const BigNumber = require('bignumber.js');
const abi = require('ethereumjs-abi');
// connect to Infura node
const web3 = new Web3(new Web3.providers.HttpProvider('https://ropsten.infura.io/v2/INFURA_PROJECT_ID'));
// the address that will send the test transaction
const addressFrom = 'SENDER_ADDRESS';
@rajeshsubhankar
rajeshsubhankar / sendRawEtherTransaction.js
Created March 28, 2019 13:59
Create and sends a raw ether transaction with ether.js and Infura
const ethers = require('ethers');
const provider = new ethers.providers.JsonRpcProvider('https://ropsten.infura.io/v2/INFURA_PROJECT_ID');
const addressFrom = 'SENDER_ADDRESS';
const privateKey = 'SENDER_ADDRESS_PRIVATE_KEY';
const wallet = new ethers.Wallet(privateKey, provider);
const addressTo = 'RECEIVER_ADDRESS';

3Box is a social profiles network for web3. This post links my 3Box profile to my Github account!

✅ did:muport:QmSBe7G1QioPMPvBUZU3NqqgdxZSHyKq2ZX85rJfWThyGr ✅

Create your profile today to start building social connection and trust online. https://3box.io/

@rajeshsubhankar
rajeshsubhankar / array_iteration_thoughts.md
Created July 6, 2019 10:36 — forked from ljharb/array_iteration_thoughts.md
Array iteration methods summarized

While attempting to explain JavaScript's reduce method on arrays, conceptually, I came up with the following - hopefully it's helpful; happy to tweak it if anyone has suggestions.

Intro

JavaScript Arrays have lots of built in methods on their prototype. Some of them mutate - ie, they change the underlying array in-place. Luckily, most of them do not - they instead return an entirely distinct array. Since arrays are conceptually a contiguous list of items, it helps code clarity and maintainability a lot to be able to operate on them in a "functional" way. (I'll also insist on referring to an array as a "list" - although in some languages, List is a native data type, in JS and this post, I'm referring to the concept. Everywhere I use the word "list" you can assume I'm talking about a JS Array) This means, to perform a single operation on the list as a whole ("atomically"), and to return a new list - thus making it much simpler to think about both the old list and the new one, what they contain, and

I, rajeshsubhankar, use SCsBX0uAP as identifier at #Whois0x, a tool to check my ETH address: 0x3d832905d37be42354433c8f88365b0fd4e28fc9. https://Whois0x.io