Skip to content

Instantly share code, notes, and snippets.

View cds-amal's full-sized avatar
🏠
Working from home

cds-amal cds-amal

🏠
Working from home
  • New York City
View GitHub Profile
@cds-amal
cds-amal / Order.sol
Created July 8, 2023 15:47
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.20+commit.a1b79de6.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
contract A {
function foo() public pure returns (uint) { return bar(); }
function bar() public virtual pure returns (uint) { return 1; }
}
contract B is A { }
@cds-amal
cds-amal / preprocessor_fun.h
Created November 22, 2022 09:15 — forked from aras-p/preprocessor_fun.h
Things to commit just before leaving your job
// Just before switching jobs:
// Add one of these.
// Preferably into the same commit where you do a large merge.
//
// This started as a tweet with a joke of "C++ pro-tip: #define private public",
// and then it quickly escalated into more and more evil suggestions.
// I've tried to capture interesting suggestions here.
//
// Contributors: @r2d2rigo, @joeldevahl, @msinilo, @_Humus_,
// @YuriyODonnell, @rygorous, @cmuratori, @mike_acton, @grumpygiant,

I set up test project based on the metacoin-box (truffle unbox metacoin mc) with two test folders

  • test - has js tests
  • test-solidity - has solidity tests
Test layout

╭─amal@falafel  ~/.scratch/2022/07/18/swiss-dirs/mc ‹node-16.16.0›  ‹›

reprod test-from truffle unbox metacoin rm contracts/Migrations.sol rm migrations/*.js cat << EOF > migrations/1_deploy_it.js const ConvertLib = artifacts.require("ConvertLib"); const MetaCoin = artifacts.require("MetaCoin");

module.exports = async function(deployer, network, accounts) { const from = accounts[1];

@cds-amal
cds-amal / foo.md
Last active February 19, 2022 21:39

verdaccio

  1. install
    npm -g install verdaccio
  2. configure
    cat << EOF > config.yml
    listen:

FWIW: I'm not the author of the content presented here (which is an outline from Edmond Lau's book). I've just copy-pasted it from somewhere over the Internet, but I cannot remember what exactly the original source is. I was also not able to find the author's name, so I cannot give him/her the proper credits.


Effective Engineer - Notes

What's an Effective Engineer?

1 EIP Purpose and Guidelines
2 Homestead Hard-fork Changes
3 Addition of CALLDEPTH opcode
4 EIP Classification
5 Gas Usage for `RETURN` and `CALL*`
6 Renaming SUICIDE opcode
7 DELEGATECALL
8 devp2p Forward Compatibility Requirements for Homestead
20 ERC-20 Token Standard
55 Mixed-case checksum address encoding
@cds-amal
cds-amal / create_repo_labels.sh
Created August 3, 2021 05:34 — forked from liuderchi/create_repo_labels.sh
To Create Labels for your Repo
#!/bin/bash
set -e
# NOTE to create labels for your repo
# to support types from commit message guide (feat, fix, docs, style, refactor, test, chore)
# by hitting GitHub API v3
#
# https://docs.github.com/en/rest/reference/issues#create-a-label
# https://developer.github.com/v3/issues/labels/#create-a-label
@cds-amal
cds-amal / find-old-branches.sh
Created July 18, 2021 02:22 — forked from mroderick/find-old-branches.sh
A small script to find stale branches
#!/bin/bash
# This is a very naive script, it doesn't do grouping and returns all branches
# I only really care about branches that have not seen commits in two months
#
# I am hoping to find some time to write a tool that can output these reports for me
# In the meantime, I am using this
echo "Merged branches"
for branch in `git branch -r --merged | grep -v HEAD`;do echo -e `git log --no-merges -n 1 --format="%ci, %cr, %an, %ae, " $branch | head -n 1` \\t$branch; done | sort -r
module.exports = {
networks: {
development: {
host: "127.0.0.1", // Localhost (default: none)
port: 8545, // Standard Ethereum port (default: none)
network_id: "*", // Any network (default: none)
},
},
// Set default mocha options here, use special reporters etc.