Skip to content

Instantly share code, notes, and snippets.

View gchavez2's full-sized avatar

gustavo gchavez2

View GitHub Profile
@gchavez2
gchavez2 / you_couldve_invented_openclaw.md
Created March 23, 2026 22:23 — forked from dabit3/you_couldve_invented_openclaw.md
You Could've Invented OpenClaw

See more of my writing here.

In this post, I'll start from scratch and build up to OpenClaw's architecture step by step, showing how you could have invented it yourself from first principles, using nothing but a messaging API, an LLM, and the desire to make AI actually useful outside the chat window.

End goal: understand how persistent AI assistants work, so you can build your own (or become an OpenClaw power user).

First, let's establish the problem

When you use ChatGPT or Claude in a browser, there are several limitations:

for k,v in sorted(foo.items()):
print k, v
for k in sorted(foo.keys()):
print k, foo[k]
More at: https://stackoverflow.com/questions/364519/in-python-how-do-i-iterate-over-a-dictionary-in-sorted-key-order
import json
with open('json_file.json') as f:
data = json.load(f)
print(data)
"""
y2k
19016 -> 01/23/2020
0 = 12/31/1967
1 = 01/01/1968
"""
import sys
from datetime import datetime, timedelta
@gchavez2
gchavez2 / internetSpeed.sh
Created January 25, 2020 06:51
Test internet speed
curl https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py | python -
# Silent version
#curl -s https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py | python -
@gchavez2
gchavez2 / Bash.sh
Created September 26, 2019 05:14
Output to terminal and file
p 15count_coverage.py 2>&1 | tee out.txt
nme = ["aparna", "pankaj", "sudhir", "Geeku"]
deg = ["MBA", "BCA", "M.Tech", "MBA"]
scr = [90, 40, 80, 98]
# New from dictionary
dict = {'name': nme, 'degree': deg, 'score': scr}
df = pd.DataFrame(dict)
clean_df.to_csv(OUTPUT_FILENAME, index=False)
# New dataframe from subset of pandas dataframe
@gchavez2
gchavez2 / Histogram_Python_list.py
Last active August 16, 2019 22:12
histogram_of_list.py
# Histogram of words per document in the first page
import matplotlib.pyplot as plt
plt.style.use("ggplot")
plt.hist([s for s in words_per_doc], bins=10)
plt.xlabel('Documents')
plt.ylabel('Number of words')
plt.show()
@gchavez2
gchavez2 / Dataframe_exploration.py
Last active August 16, 2019 22:33
Dataframe exploration
df = pd.read_csv(FILENAME, names=["id", "title", "text"],
escapechar='\\', encoding='utf-8', header=0)
print(df.describe()) # Summary statistics (count, unique, top, freq) for every column of the dataframe
print(df.info()) # Information about each column on the dataframe, and memory usage
print(df.head()) # Show first 5 rows of dataframe
print(df.head(3)) # Show first 3 rows of dataframe
# Head with only a few columns, with random sampling of 10 rows