Skip to content

Instantly share code, notes, and snippets.

View albertocavalcante's full-sized avatar
🌎
BRA -> USA

Alberto Cavalcante albertocavalcante

🌎
BRA -> USA
View GitHub Profile
C:\dev\workspace\rules-multirun-windows-issue>bazel run --platforms @zig_sdk//platform:windows_amd64 //tools:format
WARNING: Build option --platforms has changed, discarding analysis cache (this can be expensive, see https://bazel.build/advanced/performance/iteration-speed).
INFO: ToolchainResolution: Target platform @@hermetic_cc_toolchain++toolchains+zig_sdk//platform:windows_amd64: Selected execution platform //platforms:windows_x86_64_compat,
INFO: ToolchainResolution: Performing resolution of @@buildifier_prebuilt+//buildifier:toolchain for target platform @@hermetic_cc_toolchain++toolchains+zig_sdk//platform:windows_amd64
ToolchainResolution: Toolchain @@buildifier_prebuilt++buildifier_prebuilt_deps_extension+buildifier_prebuilt_toolchains//:buildifier_darwin_amd64 is compatible with target platform, searching for execution platforms:
ToolchainResolution: Incompatible execution platform //platform
package main
import (
"context"
"fmt"
"os/exec"
"strings"
// These are the Bazelisk packages you'd import
"github.com/bazelbuild/bazelisk/config"
@albertocavalcante
albertocavalcante / install.sh
Last active March 5, 2025 10:40
Bazel Dev Container Feature
#!/bin/bash
set -e
# Versions can be overridden with environment variables
BAZELISK_VERSION="${BAZELISK_VERSION:-v1.10.1}"
BUILDIFIER_VERSION="${BUILDIFIER_VERSION:-v6.0.1}"
LOCAL_BIN="/usr/local/bin"
if [ "$(id -u)" -ne 0 ]; then
@albertocavalcante
albertocavalcante / devcontainer-feature-readme.py
Last active March 5, 2025 10:56
Dev Container Feature: Documentation Generator
#!/usr/bin/env python3
# /// script
# requires-python = ">=3.7"
# ///
"""
DevContainer Documentation Generator
This script generates README files for DevContainer features and templates.
This file has been truncated, but you can view the full file.
@albertocavalcante
albertocavalcante / buf.zip.txt
Last active February 7, 2025 23:35
bulldozer windows amd64
This file has been truncated, but you can view the full file.
@albertocavalcante
albertocavalcante / download.py
Last active July 10, 2024 20:28
Fetch ChromeDriver
import requests
import zipfile
import os
from io import BytesIO
def fetch_and_extract_zip(url, extract_to='.'):
# Configure the proxy if needed
proxies = {
'http': 'http://your_proxy:your_proxy_port',
'https': 'http://your_proxy:your_proxy_port'
@albertocavalcante
albertocavalcante / reverse_lollipop.py
Created June 24, 2024 06:57
OpenAI GPT-4o vs GPT-4: Reverse "lollipop"
from openai import OpenAI
from typing import Final
from pprint import pprint
class GPTHelper:
llm = OpenAI()
REVERSE_WORD_SYSTEM_PROMPT: Final = """
Given a word by the user, you must reverse it and display back.
@albertocavalcante
albertocavalcante / pointers.go
Created March 5, 2024 04:27
Go: Playing with Pointers
package main
import "fmt"
func main() {
var a int
var b *int
a = 50
b = &a
@albertocavalcante
albertocavalcante / calico-netpol-kubernetes.md
Created July 31, 2023 03:55
Kubernetes Calico NetworkPolicy: Understanding Selectors with Examples

Understanding Calico Selectors in Kubernetes

In Kubernetes, managing network policies is essential for controlling communication between pods. Calico is a popular open-source tool that offers a powerful and flexible way to create network policies, using selectors to define exactly what traffic is allowed or denied. This blog post will explain how these selectors work, using easy-to-understand examples.

Selector Basics

A Calico selector is like a set of rules that define what kind of pods are matched. Think of it like picking out toys from a toy box based on specific features like color, shape, or size.

Equality