Skip to content

Instantly share code, notes, and snippets.

import ecdsa
signature = bytes.fromhex('3044022063a01ee35e4946f924202a2f1c5110047d4830a02f792fbe6bdfdfbf1fb513cf022016d1d8f95f9d69a9243c2e392dfebeb8ad9a2c8e693f161b5d29bdb802a9f0ee')
r, s = ecdsa.util.sigdecode_der(signature, ecdsa.SECP256k1.generator.order())
print(r)
print(s)
from eth_account._utils.transactions import serializable_unsigned_transaction_from_dict
from web3 import Web3
transaction = {
'to': Web3.toChecksumAddress('0x4d6bb4ed029b33cf25d0810b029bd8b1a6bcab7b'),
'gas': 21000,
'gasPrice': 10000000000,
'nonce': 1,
'value': 1,
}
from web3 import Web3
public_key = bytes.fromhex('04da2bb6a42df116824d7ccb91b09e3f8fa2c0c94a829791468dd10cc63b9c2f9cd8ead4b201a07acc30c4a9b23d77ec9c43f7206a039418b20ae89d395308e76f')
unprefixed_public_key = public_key[1:] # remove the '04' prefix
public_key_hash = Web3.keccak(unprefixed_public_key)
address_bytes = public_key_hash[-20:]
address = address_bytes.hex()
print(address)
from web3 import Web3, HTTPProvider
web3_endpoint = 'https://kovan.infura.io/v3/xxxxxxxxxxxxxxxxxx'
private_key = '0xCC206D...'
web3 = Web3(HTTPProvider(web3_endpoint))
transaction = {
'to': '0x4d6Bb4ed029B33cF25D0810b029bd8B1A6bcAb7B',
'gas': 21000,
console.log('this is ocean protocol compute test')
@kdembler
kdembler / apfsbug.md
Last active October 15, 2024 09:11
Fix League of Legends client not launching after champion select on macOS

The issue

After fresh install of League of Legends on macOS with case-sensitive APFS volume it's not possible to start League of Legends game, after champion selection the launcher won't open the game client and is stuck with reconnect button.

Solution

Terminal method is probably more reliable as you can see real file names within terminal opposite to Finder which "beautifies" them so you can't be sure what the actual file name is.

Note that League patcher will probably install updates under old filename so it's possible that these steps will need to be taken after every patch until Riot fixes it.

Terminal.app

  1. Open Terminal.app from Applications
  2. Browse to League contents with cd /Applications/League of Legends.app/Contents/LoL/RADS/solutions/lol_game_client_sln/releases/
@kdembler
kdembler / mac-gpg.md
Last active September 16, 2020 10:00
Setting up gpg commit signing on macOS

Set up GPG on macOS

Setup:

brew install gnupg2
gpg --import private.key

brew install pinentry-mac
echo "pinentry-program /usr/local/bin/pinentry-mac" > ~/.gnupg/gpg-agent.conf
killall gpg-agent