std::generate in modern c++

Posted on Fri 27 January 2023 in tech • Tagged with c++, std::generate, lambda, tutorial

std::generate

Many examples of std::generate in C++ involve a static. However using a static introduces issues around thread safety and usability in modern code. Here is a simple example using std::generate with a c++14 style lambda that defines and captures a local variable.

Full tutorial on …


Continue reading

M1 Mac: Should you enable efficiency cores in Docker?

Posted on Fri 20 January 2023 in tech • Tagged with docker, rust, c++, go, build, apple

Should you enable your efficiency cores for use by Docker on Apple Silicon?

If you enable the efficiency cores there are 2 additional cores for the system scheduler to allocate to your workload. However, if you leave them disabled, these 2 cores will remain in reserve for use by supportive …


Continue reading

Fibonacci 200M in 2 Minutes

Posted on Fri 16 December 2022 in tech • Tagged with programming, fibonacci, prime, go

Fibonaccis

F(200M) in 2 minutes! Apple arm64 is no joke. You can do it yourself with Go Fib


@collectivexyz/governance

Posted on Tue 13 December 2022 in tech • Tagged with TypeScript, npmjs, web3, Ethereum, governance

@collectivexyz just published @collectivexyz/governance

Install from command line:

 $ npm install @collectivexyz/governance

Install using yarn:

 $ yarn add @collectivexyz/governance

Usage

Simple example to connect to a governance contract.

import { EthWallet, Governance, GovernanceBuilder, CollectiveGovernance } from '@collectivexyz/governance';
import Web3 from 'web3';

export async function connect(): Promise<Governance> {
  try {
    const rpcUrl …

Continue reading

Find event from Transaction Receipt

Posted on Sat 10 December 2022 in tech • Tagged with ethereum, solidity, typescript, ethers

Here is a trivial example that finds an event from a Transaction Receipt in ethers js.


Continue reading

Find past events in ethers js

Posted on Thu 08 December 2022 in tech • Tagged with ethereum, solidity, typescript, ethers

Although there are examples of getting events from a particular transaction using ethers js. I found it fairly difficult to find an example that searches for events from a particular block or transaction. Here is a code to do just that:


Continue reading