Skip to content

Instantly share code, notes, and snippets.

@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

00:00:08 christopher nolan is a renowned movie director known for blockbuster hits like "the dark knight" and "inception"

the majority of blockbuster hits like the dark knight, inception, interstellar, and oppenheimer are from him. he's considered one of the best directors and one of my favorite founders. he runs a company called syncopy, which only has nine employees.

00:00:39 nolan's production company syncopy employs only nine full-time staff

nolan's movies, from oppenheimer to the rest, are produced by a company with only nine full-time employees. despite movies being massive productions, it's impressive he pulls off such large-scale projects with such a small team. pretty cool.

00:01:00 he hires hundreds or even thousands of people on set for short-term film projects