Skip to content

Instantly share code, notes, and snippets.

@wy
wy / 2623809_issue.md
Created August 24, 2018 19:24
Block Discrepancy (between two blocks) for different Nodes

Result when executing RPC call getblockhash for 2623809

https://seed1.switcheo.network:10331 0xef934051c6732b415de63222790aea4fe78dacb6723cb14a0803c72fe35e836a https://seed2.switcheo.network:10331 0xef934051c6732b415de63222790aea4fe78dacb6723cb14a0803c72fe35e836a https://seed4.switcheo.network:10331 0xef934051c6732b415de63222790aea4fe78dacb6723cb14a0803c72fe35e836a http://seed1.travala.com:10332 0xef934051c6732b415de63222790aea4fe78dacb6723cb14a0803c72fe35e836a http://seed2.travala.com:10332 0xef934051c6732b415de63222790aea4fe78dacb6723cb14a0803c72fe35e836a http://seed4.travala.com:10332 0xef934051c6732b415de63222790aea4fe78dacb6723cb14a0803c72fe35e836a http://seed2.neo.org:10332 0xef934051c6732b415de63222790aea4fe78dacb6723cb14a0803c72fe35e836a http://seed3.neo.org:10332 0xef934051c6732b415de63222790aea4fe78dacb6723cb14a0803c72fe35e836a

@wy
wy / gist:e0df9cc085c371f6d34c6117237054f3
Created August 24, 2018 19:47
Block discrepancy code
import requests
import json
known = {}
# investigate block 2,623,809
block = 2623809
request_json = "{\r\n \"jsonrpc\": \"2.0\",\r\n \"method\": \"getblockhash\",\r\n \"params\": [2623809],\r\n \"id\": 3\r\n}"
request_json_prev = "{\r\n \"jsonrpc\": \"2.0\",\r\n \"method\": \"getblock\",\r\n \"params\": [2623810,1],\r\n \"id\": 3\r\n}"
Old Data from 14th:
SELECT connection_id, blockheight
FROM public.blockheight_history
where ts > '2018-08-14 00:00:00'
and ts < '2018-08-14 07:00:00'
and blockheight >= 2616259
[(457, 873), (439, 822), (464, 820), (444, 820), (443, 804), (445, 803), (438, 800), (27, 799), (4, 756), (486, 754)]
unique 953
75 nodes total
@wy
wy / gist:56b4d0d2f47b6f4cdeadb59b8cb0ab7f
Created March 27, 2019 23:33
lazyload bash lookfantastic
#!/bin/bash
for i in {1..1000};
do
sudo lighthouse https://www.lookfantastic.com --extra-headers='{"x-thehutsrv":"227"}' --chrome-flags="--headless --no-sandbox" --output=json --output-path=test.json --quiet
speedindex=$(cat test.json | jq '.["audits"]' | jq '.["speed-index"]' | jq '.["rawValue"]')
totalbyteweight=$(cat test.json | jq '.["audits"]' | jq '.["total-byte-weight"]' | jq '.["rawValue"]')
interactive=$(cat test.json | jq '.["audits"]' | jq '.["interactive"]' | jq '.["rawValue"]')
printf '%s\n' $speedindex $totalbyteweight $interactive | paste -sd ',' >> lookfantastic.csv
printf '%s,' "normal" $speedindex $totalbyteweight $interactive
printf '\n'
@wy
wy / testtwiml
Last active June 13, 2019 12:53
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Say voice="alice">Hello there</Say>
</Response>
{
"//": "used to determine the full dependency tree",
"method": "GET",
"path": "/repos/:name/:repo/contents/:path*/package.json",
"origin": "https://${GITHUB_TOKEN}@${GITHUB_API}"
}