Skip to content

Instantly share code, notes, and snippets.

@jamesmurdza
jamesmurdza / The Rules of Programming.md
Last active December 28, 2025 17:01
Chris Zimmerman's The Rules of Programming
  1. As Simple as Possible, but No Simpler
  2. Bugs Are Contagious
  3. A Good Name Is the Best Documentation
  4. Generalization Takes Three Examples
  5. The First Lesson of Optimization Is Don’t Optimize
  6. Code Reviews Are Good for Three Reasons
  7. Eliminate Failure Cases
  8. Code That Isn’t Running Doesn’t Work
  9. Write Collapsible Code
  10. Localize Complexity
@jamesmurdza
jamesmurdza / e2b.Dockerfile
Created April 2, 2025 09:13
New Dockerfile
FROM ubuntu:22.04
# Set environment variables
ENV DEBIAN_FRONTEND=noninteractive \
DEBIAN_PRIORITY=high \
PIP_DEFAULT_TIMEOUT=100 \
PIP_DISABLE_PIP_VERSION_CHECK=1 \
PIP_NO_CACHE_DIR=1
# Basic system setup

Imperative Computer Configuration is Playing a Losing Game

I often categorize games into the buckets of winning and losing games. Some games are both winning and losing games simultaneously, depending on your skill level. An example of this is the difference between amateur and pro tennis. When playing amateur tennis, you are usually playing a losing game. That is to mean, don't lose, and you will win! Most games of amateur tennis are decided by the player who has the least un forced errors. You will win the game by making fewer mistakes than your opponent.

The pros, on the other hand, is a much different story. When you watch two pro tennis players face off, they tend to make very few mistakes. This then becomes a winning game where you have to take an action to acheive victory instead of just try to minimize your mistakes.

Using imperative style configuration management tools like Ansible and docker are ultimately losing games.

Wait! I thought Ansible was Declarative and Idempotent

OpenAI

from openai import OpenAI

client = OpenAI()

tools = [{
    "type": "function",
    "function": {
class MistralBaseProvider(OpenAIBaseProvider):
def create_function_def(self, name, details, properties, required):
# Wrap all descriptions to avoid Mistral validation error.
details["description"] = {"type": "string", "description": details.get("description")}
return super().create_function_def(name, details, properties, required)
def call(self, messages, functions=None):
# Make the last message a prefix if its role is assistant.
if messages and messages[-1].get("role") == "assistant":
@jamesmurdza
jamesmurdza / nginx.conf
Created December 31, 2024 12:31
Nginx SSL proxy for NodeJS
server {
listen 443 ssl;
server_name api.sandbox.gitwit.dev;
ssl_certificate /etc/letsencrypt/live/api.sandbox.gitwit.dev/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/api.sandbox.gitwit.dev/privkey.pem; # managed by Certbot
location / {
proxy_pass http://localhost:4000;
proxy_http_version 1.1;
1. Update the System
sudo apt update
sudo apt upgrade
@jamesmurdza
jamesmurdza / main.py
Created September 23, 2024 22:42
Web scraping with E2B + CrewAI
from dotenv import load_dotenv
from crewai import Agent, Task
from crewai_e2b_python.code_interpreter_tool import E2BCodeInterpreterTool
import json
load_dotenv()
def main():
# Initialize the code interpreter tool
@jamesmurdza
jamesmurdza / crewai_hn_scraper_output.txt
Created September 19, 2024 21:24
CrewAI Hacker News Scraper
***Code Interpreting...
!pip install requests beautifulsoup4
import requests
from bs4 import BeautifulSoup
# Fetch the Hacker News homepage
url = 'https://news.ycombinator.com/'
response = requests.get(url)
soup = BeautifulSoup(response.text, 'html.parser')

00:00:02 hey everyone today we're going to be doing cnns or convolutional neural networks

doing cnns or convolutional neural networks and uh those are neural network models designed for processing structured grid data like images

00:00:06 cnns are neural networks that can be used to classify or detect images

networks that can be used to classify or detect images, and that's about all i know. passing it to naid. yeah, just like the simple.

00:00:24 the idea for cnns was inspired by biological networks, similar to simple neural networks