Skip to content

Instantly share code, notes, and snippets.

@llk23r
llk23r / treepwd_content
Created February 12, 2025 16:55
Turn your codebase into an llm friendly context. Put this in your .zshrc.
treepwd_content() {
local current_dir=$(pwd)
local output_file="codebase.txt"
echo "Current directory: $current_dir" > "$output_file"
echo "" >> "$output_file"
echo "Directory Structure:" >> "$output_file"
# Updated exclusion pattern to properly handle target directory and its contents
find . -type d \( -name node_modules -o -name venv -o -name .git -o -name .vscode -o -name .next -o -name .mypy_cache -o -name .venv -o -name .DS_Store -o -path '*/target/*' -o -name build -o -name src-tauri/target \) -prune -o -print | sed -e 's;[^/]*/;| ;g;s;| \([^|]\)/;\1;g' >> "$output_file"
@llk23r
llk23r / get_txn_status.py
Created March 18, 2024 07:51
Get status of an ethereum transaction from Etherscan.
import requests
import re
def get_transaction_details(tx_id):
"""
Fetches transaction details from Etherscan and extracts status, from, and to fields.
Args:
tx_id: The transaction ID (hash) to fetch details for.
@llk23r
llk23r / decode_merkle.py
Created March 8, 2024 11:05
decode blockerts encoded proof
# pip install lds_merkle_proof_2019
from lds_merkle_proof_2019.merkle_proof_2019 import MerkleProof2019
example_proof_value = "znKD4YGVqA8texv1PrVrhripRpmtid9LqxNj8TRUKHD5dXobGcBnZcHJMY3oguH9T8YcT9MuqnzQxYYRcReoxc9vm5PhucNBqdFYwZuwNEeFTn9GoJLPqAwQSw2J2atnCuEFAqwMXstnLkSNQrEwpBAGshkH1eMhqSYh4Ut3gVHq85eSKuu2YFHeCHAXN6QW7qfAiiiS4VLSE9E9PPUDdbp3MrDSb52gentZHJiHJHpKggxKs8GYYkqFQmr7rJ8HqVzLmwRRMAYA7TsVopawvFGtXTsbWXg6BK9jCFEPYvD3vNBvW5bVpEGvJgH"
mp2019 = MerkleProof2019()
decoded_proof = mp2019.decode(example_proof_value)
print(decoded_proof)
@llk23r
llk23r / hset_benchmark.rb
Created February 9, 2023 10:32
atomic vs pipelined hset
require "redis"
require "benchmark"
def setup
@redis = Redis.new
@redis.flushdb
end
def teardown
@redis.flushdb
@llk23r
llk23r / greport.css
Created October 17, 2022 03:34
CSS for report
@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap");
*,
body {
font-family: "Poppins", sans-serif;
margin: 0;
width: auto;
overflow-y: scroll;
overflow: auto;
-webkit-overflow-scrolling: touch;
}
@llk23r
llk23r / upload_to_slack.py
Created October 14, 2022 09:09
Upload file to slack using the slack files.upload API.
import requests
from decouple import (
config,
) # decouple is a library that allows you to store your secrets in a .env file
SLACK_FILE_UPLOAD_URL = "https://slack.com/api/files.upload"
def upload_file_to_slack(file_path) -> dict:
"""Uploads a file to slack using the slack api
@llk23r
llk23r / .md
Created March 29, 2022 06:32
view current wifi password on mac
security find-generic-password -ga wifi-ssid-here | grep “password:”
@llk23r
llk23r / cloudSettings
Last active July 17, 2020 08:58
Visual Studio Code Settings Sync Gist
{"lastUpload":"2020-02-17T08:56:20.397Z","extensionVersion":"v3.4.3"}
#!/usr/bin/env bash
sudo apt-get update
clear
echo "--------------UPDATED--------"
sudo apt-get install default-jdk
clear
java -version
echo "-------------JAVA INSTALLED----"
0x14e5b6c2F7e1C8258100AC83DFB1950533E4AE48