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
@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

sudo rm -rf /usr/local/go* && sudo rm -rf /usr/local/go