Skip to content

Instantly share code, notes, and snippets.

View TrevorJTClarke's full-sized avatar
🙈

Trevor Clarke TrevorJTClarke

🙈
View GitHub Profile
axios({
method:'get',
url: 'https://web3api.io/api/v1/transactions/gas/percentiles',
headers: { 'x-api-key': 'YOUR_API_KEY_HERE' }
}).then(res => {
// res data example:
// {
// "percentile_000": 0,
// "percentile_001": 0,
// "percentile_002": 0,
axios({
method:'get',
url: 'https://web3api.io/api/v1/transactions/gas/predictions',
headers: { 'x-api-key': 'YOUR_API_KEY_HERE' }
}).then(res => {
// res data example:
// {
// "average": {
// "gasPrice": 2000000000,
// "numBlocks": 4,
@TrevorJTClarke
TrevorJTClarke / Snapshot_4bytes
Last active February 28, 2019 23:11
snapshot of random sampling (127M out of 400M txns):
Count Signature % % (without 0x) Function
222,852,719 0x 55.96% ETH TRANSFER
87,649,468 0xa9059cbb 22.01% 49.97% transfer(address,uint256) OR many_msg_babbage(bytes1)
4,265,659 0x0a19b14a 1.07% 2.43% trade(address,uint256,address,uint256,uint256,uint256,address,uint8,bytes32,bytes32,uint256)
3,935,612 0x6ea056a9 0.99% 2.24% sweep(address,uint256)
3,297,997 0xef343588 0.83% 1.88% trade(uint256[8],address[4],uint8[2],bytes32[4])
3,247,646 0x0f2c9329 0.82% 1.85% split(address,address)
2,960,633 0x095ea7b3 0.74% 1.69% approve(address,uint256)
2,476,038 0x00000000 0.62% 1.41% -
2,470,649 0xa9b1d507 0.62% 1.41% makeWallet()
@TrevorJTClarke
TrevorJTClarke / sc_audit_vuln.csv
Last active October 28, 2018 17:15
Smart Contract Audit Vulnerabilities
Vulnerability Count
Integer Overflow 100,635
Message CALL to External Contract 84,964
Exception State 8,908
Multiple CALLs 518
DELEGATECALL to a User-Supplied Address 458
Unchecked CALL return value 224
Use of tx.origin 185
Integer Underflow 173
Ether Send 125
@TrevorJTClarke
TrevorJTClarke / sc_audit_stats.csv
Last active October 28, 2018 17:37
Smart Contract Security Audit Stats
Success Warnings Information
161,914 38,618 6,927
@TrevorJTClarke
TrevorJTClarke / hexFromImage.js
Last active May 24, 2018 17:04
Get Color From Image
function rgbToHex(r, g, b) {
if (r > 255 || g > 255 || b > 255) throw 'Invalid color component'
return ((r << 16) | (g << 8) | b).toString(16)
}
const generateColor = src => {
return new Promise((res, rej) => {
let c = document.createElement('canvas')
if (c.getContext) {
c = c.getContext('2d')
@TrevorJTClarke
TrevorJTClarke / user.sol
Last active November 1, 2017 19:14
User with some skillz & endorsed by other users, solidity contract style!
pragma solidity ^0.4.15;
contract User {
// Name of the contract
string public userName;
uint public skillsTotal = 0;
address owner;
// Used to keep track of skills
0xcfF015fAa7ADeE7D013dB4A3AA6e34a5a51F0EBE
@TrevorJTClarke
TrevorJTClarke / BlueSmirf: Bluetooth Notes
Created January 20, 2017 00:07
BlueSmirf: Bluetooth Notes - How I got data passthrough working
Reference Doc: https://cdn.sparkfun.com/assets/1/e/e/5/d/5217b297757b7fd3748b4567.pdf
Initial Setup Doc: https://learn.sparkfun.com/tutorials/using-the-bluesmirf#example-code-using-command-mode
Final Setup: (Data Passthrough settings)
$$$ Type this within 60 sec of turning modem on. You get a "CMD" response.
+ This turns on echo so you see what you are typing.
SU,96 This sets 9600 baud to Uno.
ST,255 This disables that pesky 60 sec timer.
--- This ends the command session.
@TrevorJTClarke
TrevorJTClarke / deploy_with_ebcli3_on_circleci.md
Last active March 9, 2017 00:45 — forked from RobertoSchneiders/deploy_with_ebcli3_on_circleci.md
Settings to deploy to AWS Elastic Beanstalk on CircleCi (EB Cli 3)

Configure the deploy of AWS Elastic Beanstalk through CircleCI.

Configure Environments Variables

On Project Settings > Environment Variables add this keys:

  • AWS_ACCESS_KEY_ID
  • AWS_SECRET_ACCESS_KEY
    The aws user must have the right permissions. This can be hard, maybe, this can help you.

Confirm Build Environment: