Skip to content

Instantly share code, notes, and snippets.

rocketVault
rocketAuctionManager
rocketDepositPool
rocketMinipoolDelegate
rocketMinipoolManager
rocketMinipoolQueue
rocketMinipoolStatus
rocketMinipoolPenalty
rocketNetworkBalances
@jar-o
jar-o / ecrecover.js
Last active April 26, 2022 18:47
ecrecover script node javascript web3 ethereumjs-util
#!/usr/bin/env node
/*
Test (1) r/s/v:
> node ecrecover.js \
0xb9cbc613e7154b248b1fb1cfd190e173c6d4e8e7bd89b754debe1322f9a4a15c \
0xa58c6ba0acb8005d0e3510396951a7949707428d7db97be8dc114af58a06140f \
0x0fe3e42fed1daabef16b2a9f3da5d36538898c8a9f491b48b4cef9ee731ff2f3 \
#!/usr/bin/env bash
{ # Prevent execution if this script was only partially downloaded
set -e
tmpfile=$(mktemp)
trap 'rm $tmpfile' EXIT
cat > "$tmpfile" <<'EOF'
GREEN='\033[0;32m'
@jar-o
jar-o / Converter.sol
Created February 24, 2022 14:55
Solidity - convert uint256 array to bytes
contract Converter {
function u256a_tobytes(uint256[] memory arr) public pure returns (bytes memory) {
bytes memory b = new bytes(arr.length*32);
for (uint256 i = 0; i < arr.length; i++) {
uint256 x = arr[i];
uint256 j = 32+(i*32);
assembly {
mstore(add(b, j), x)
}
}
@jar-o
jar-o / sign.js
Created October 29, 2021 15:32
Web3 examples for ecrecover
const Web3 = require('web3')
var utils = require('ethereumjs-util');
const provider = new Web3.providers.HttpProvider('http://localhost:8545')
const web3 = new Web3(provider)
const dorecover = async function(){
// Recover using account from ganache-cli
var accounts = await web3.eth.getAccounts()
let msg = 'I shill your promotion'

Keybase proof

I hereby claim:

  • I am jar-o on github.
  • I am jrobson (https://keybase.io/jrobson) on keybase.
  • I have a public key ASCKhgdIGGhBtrQPu4hdVvIjmqQSGNm_xKbJRAxprxT7Rgo

To claim this, I am signing this object:

This file has been truncated, but you can view the full file.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf8" />
<title>ReDoc documentation</title>
<!-- needed for adaptive design -->
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
@jar-o
jar-o / compress-multipage-tiff.go
Last active April 10, 2018 15:40
Simple go app that uses ImageMagick to compress multipage TIFFs without losing the pages.
/*
# This werks in OSX ... need to build the C deps locally, then run your go app
# with the appropriate CGO* flags.
http://www.imagemagick.org/download/releases/ImageMagick-7.0.6-10.tar.xz
tar xvzf ImageMagick-7.0.6-10.tar.xz
cd ImageMagick-7.0.6-10
mkdir dist
export CGO_IMAGEMAGICK_PREFIX=`pwd`/dist
@jar-o
jar-o / maximal-square.py
Last active March 16, 2019 17:48
Maximal square solution in Python
###### For submission to https://leetcode.com/problems/maximal-square/
class Solution(object):
def maximalSquare(self, matrix):
# handle 0 and 1 dimensional arrays
if len(matrix) == 0: return 0
if len(matrix) == 1:
for i in range(len(matrix[0])):
if matrix[0][i] == '1': return 1