Skip to content

Instantly share code, notes, and snippets.

View Benhawkins18's full-sized avatar

Ben Hawkins Benhawkins18

View GitHub Profile
@Benhawkins18
Benhawkins18 / pump_my_bags.py
Created January 8, 2025 16:15
Pump My Bags
import openai
# Set up OpenAI API key
openai.api_key = "your-openai-api-key"
def generate_variations(prompt, num_variations=5):
"""
Generates variations of a given prompt using GPT-4.
"""
variations = []
@Benhawkins18
Benhawkins18 / dust.js
Created December 4, 2024 20:06
using the error log from validator start up, dust accounts with SOL
const fs = require("fs");
const solanaWeb3 = require("@solana/web3.js");
// Solana RPC endpoint
const RPC_URL = "https://api.devnet.com";
const connection = new solanaWeb3.Connection(RPC_URL);
// Load source keypair
const SOURCE_KEYPAIR_PATH = "DustwpCnsXvtmr5Z9zRfh1E1rx2deLJJhRRqmFSKPXgh.json";
const secretKey = JSON.parse(fs.readFileSync(SOURCE_KEYPAIR_PATH, "utf8"));
import subprocess
import json
LAMPORTS_PER_SOL = 1_000_000_000
print("Running the Solana stakes command...")
result = subprocess.run(['solana', 'stakes', '--withdraw-authority', '4ZJhPQAgUseCsWhKvJLTmmRRUV74fdoTpQLNfKoekbPY', '--output', 'json'], capture_output=True, text=True)
print("Finished Running the Solana stakes command...")
# Load the captured JSON output
if result.returncode == 0:
@Benhawkins18
Benhawkins18 / solana_validator_metrics.py
Created May 10, 2024 17:57
Solana Validator Decentralization
import requests
from collections import defaultdict
# weights should sum to 100
def HHI(weights):
return sum([x**2 for x in weights])
MAX_HHI_SCORE = 10000
#NE is the number of nodes with a perfectly even distribution with an equivalent HHI score.
def NE(HHI_score):
return 1 / (HHI_score / MAX_HHI_SCORE)
## Must have solana CLI installed for this to work
import json
import subprocess
command_output = subprocess.check_output(["solana", "stakes", "--output", "json"])
stakes = json.loads(command_output)
total_sfdp_stake = 0
for stake in stakes:
@Benhawkins18
Benhawkins18 / confetti-succesfull-screen-tailwind.markdown
Created December 22, 2022 19:56
Confetti succesfull screen Tailwind