Skip to content

Instantly share code, notes, and snippets.

@3rdstage
3rdstage / using-remix-ide-chrome-extension-and-remixd.md
Last active January 21, 2020 07:12
Simple guide to use the Chrome extension of Remix IDE with local Remixd on Windows.

Using Chrome Extension of Remix IDE with Local Remixd on Windows

1. Download Remix IDE Binary

Download the zipped Remix IDE binary from release page (https://github.com/ethereum/remix-ide/releases) and unpack the file into the wanted location such as c:\tools\remix-ide

2. Fix the 'Content Security Policy' in the Manifest File

@3rdstage
3rdstage / dl_settings.xml
Last active February 27, 2020 11:31
Preferred or enhanced settings for Oracle SQL Developer Data Modeler project
<?xml version="1.0" encoding="UTF-8" ?>
<!--
'sed' commands to generate the following settings from the original one
$ sed -i 's/font_name=\"Dialog\" font_size=\"10\"/font_name=\"Malgun Gothic\" font_size=\"12\"/' dl_settings.xml
$ sed -ri 's/fc_object classname="(Table|Entity)" background="[^"]*"/fc_object classname="\1" background="-1"/' dl_settings.xml
$ sed -ri 's/fc_object classname="Note" background="[^"]*"/fc_object classname="Note" background="-52"/' dl_settings.xml
$ sed -ri 's/<pk value="[^"]*"\/>/<pk value="{table abbr}_PK"\/>/' dl_settings.xml
$ sed -ri 's/<fk value="[^"]*"\/>/<fk value="{child abbr}_FK{seq nr}"\/>/' dl_settings.xml
def mine(full_size, dataset, header, difficulty):
  target = zpad(encode_int(2**256 // difficulty), 64)[::-1]
  from random import randint
  nonce = randint(0, 2**64)
  while hashimoto_full(full_size, dataset, header, nonce) > target:
    nonce = (nonce + 1) % 2**64
  return nonce
fault total recursions
1 4 OM(1), OM(0)
2 7 OM(2), OM(1), OM(0)
3 10 OM(3), OM(2), OM(1), OM(0)
... ...
...
fault total recursions messages
1 4 OM(1), OM(0) 4·3 + 4·3·2
2 7 OM(2), OM(1), OM(0) 7·6 + 7·6·5 + 7·6·5·4
3 10 OM(3), OM(2), OM(1), OM(0)
10·9 + 10·9·8 + 10·9·8·7 + 10·9·8·7·6
fault total recursions
1 4 OM(1), OM(0)
2 7 OM(2), OM(1), OM(0)
3 10 OM(3), OM(2), OM(1), OM(0)
... ... ...
m 3m + 1 OM(m), OM(m - 1), OM(m - 2), OM(m - 3), ... , OM(2), OM(1), OM(0)
Data + Nonce SHA-256(Data + Nonce)
Hello, world! 0x315f5bdb76d078c43b8ac0064e4a0164612b1fce77c869345bfc94c75894edd3
Hello, world!0 0x1312af178c253f84028d480a6adc1e25e81caa44c749ec81976192e2ec934c64
Hello, world!1 0xe9afc424b79e4f6ab42d99c81156d3a17228d6e1eef4139be78e948a9332a7d8
Hello, world!2
0xae37343a357a8297591625e7134cbea22f5928be8ca2a32aa475cf05fd4266b7
Data + Nonce SHA-256(Data + Nonce)
Hello, world! 0x315f5bdb76d078c43b8ac0064e4a0164612b1fce77c869345bfc94c75894edd3
Hello, world!0 0x1312af178c253f84028d480a6adc1e25e81caa44c749ec81976192e2ec934c64
Hello, world!1 0xe9afc424b79e4f6ab42d99c81156d3a17228d6e1eef4139be78e948a9332a7d8
Hello, world!2 0xae37343a357a8297591625e7134cbea22f5928be8ca2a32aa475cf05fd4266b7
... ...
Hello, world!4248 0x6e110d98b388e77e9c6f042ac6b497cec46660deef75a55ebc7cfdf65cc0b965
Hello, world!4249 0xc004190b822f1669cac8dc37e761cb73652e7832fb814565702245cf26ebb9e6
Hello, world!4250 0x0000c3af42fc31103f1fdc0151fa747ff87349a4714df7cc52ea464e12dcd4e9
#! /bin/bash
function print_help {
echo "Executes some basic Ethereum JSON RPC method to check the specified Ethereum client."
echo ""
echo "Usage:"
echo " $ ${0##*/} [-h | --help | rpc_addr]"
echo ""
echo "If '-h' or '--help' is given, only display this help and quit."
echo "If rpc_addr is given, execute some basic Ethereum JSON RPC "
@3rdstage
3rdstage / FunctionBuilder.java
Created April 21, 2020 05:30
Solidity Function Builder class prototype - builder pattern and method chaining style applied
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import javax.annotation.concurrent.NotThreadSafe;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;