Skip to content

Instantly share code, notes, and snippets.

@0xlxy
0xlxy / lambda_function.py
Last active November 10, 2022 04:48
AWS Lambda + RDS to refresh & load all collection txns into sql
import multiprocessing.dummy as mp
import pymysql
import requests
class TransactionsTable:
def __init__(self, collections):
self.collections = collections
for collection in self.collections:
@0xlxy
0xlxy / main.js
Created April 19, 2023 23:41
Ethereum Blockchain Indexer
const { ethers } = require("ethers");
const provider = new ethers.providers.WebSocketProvider(
"wss://mainnet.infura.io/ws/v3/992c9dccdfd849dabf68ab78d689595d"
);
console.log(provider);
provider.on("block", (blockNumber) => {
provider
.getBlockWithTransactions(blockNumber)
@0xlxy
0xlxy / gas.py
Last active April 26, 2023 23:32
Script for Pirate Nation's total gas fee spent on Arbitrum Nova
import requests
# API endpoint for retrieving transaction information
api_url = "https://api-nova.arbiscan.io/api"
# Address of the smart contract
contract_address = "0x3b4cdb27641bc76214a0cb6cae3560a468d9ad4a"
# Start and end blocks to search for transactions
start_block = 0
@0xlxy
0xlxy / package.json
Created June 2, 2023 04:58
ENS Name Resolver
{
"name": "ens",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
@0xlxy
0xlxy / sharp.js
Created January 9, 2024 00:12
sharp.js
const sharp = require("sharp");
const main = async (scale) => {
const originalImage = await sharp("text.png").ensureAlpha().raw();
const { width, height } = await originalImage.metadata();
const image = await originalImage
.resize({
width: Math.floor(width * scale),
height: Math.floor(height * scale),
fit: "contain",