Skip to content

Instantly share code, notes, and snippets.

View rgarcia's full-sized avatar

Rafael rgarcia

View GitHub Profile
@rgarcia
rgarcia / viewport-debug.sh
Created January 22, 2026 00:48
Debug script for Kernel browser viewport dimensions
#!/bin/bash
#
# Viewport Debug Script for Kernel Browsers
#
# This script demonstrates the difference between:
# 1. Creating a browser WITH viewport set at creation time
# 2. Creating a browser WITHOUT viewport (uses default 1920x1080)
#
# Usage: ./viewport-debug.sh
#
@rgarcia
rgarcia / test-kernel-provider.sh
Created January 22, 2026 00:36
Kernel provider integration test for agent-browser
#!/bin/bash
#
# Kernel Provider Integration Test
# Tests agent-browser CLI with Kernel cloud browser provider
#
# Usage:
# KERNEL_API_KEY="your-api-key" ./test-kernel-provider.sh
#
# Requirements:
# - agent-browser built (npm run build && npm run build:native)
#!/usr/bin/env bash
set -e
cd /tmp
rm -rf /tmp/mock
mkdir /tmp/mock
cd /tmp/mock
git clone https://github.com/golang/mock mock-before
package main
import (
"fmt"
"log"
"gopkg.in/yaml.v2"
)
const withAlias = `foo:
@rgarcia
rgarcia / circuit_breakers.md
Last active October 20, 2022 07:18
go circuit breakers
func New(errorThreshold, successThreshold int, timeout time.Duration) *Breaker

New constructs a new circuit-breaker that starts closed. From closed, the breaker opens if "errorThreshold" errors are seen without an error-free period of at least "timeout". From open, the breaker half-closes after "timeout". From half-open, the breaker closes after "successThreshold" consecutive successes, or opens on a single error.

@rgarcia
rgarcia / main.go
Created September 19, 2016 23:56
net/http server context object does not cancel on closed connections, need to listen for closenotify
package main
import (
"context"
"fmt"
"log"
"net/http"
"time"
"golang.org/x/net/context/ctxhttp"
@rgarcia
rgarcia / diff.txt
Created March 26, 2016 23:06
ldclient-node eventsource patch
*** 171,176 ****
--- 171,177 ----
req.on('error', onConnectionClosed);
req.setNoDelay(true);
+ req.setSocketKeepAlive(true);
req.end();
}
@rgarcia
rgarcia / b.go
Created March 14, 2016 21:21
mocking a vendored dependency
// $GOPATH/src/a/vendor/b/b.go
package b
import "log"
type Type int
type Interface interface {
InterfaceMethod(Type)
}
@rgarcia
rgarcia / openvpn.json
Last active February 5, 2016 01:29
OpenVPN
{
"AWSTemplateFormatVersion" : "2010-09-09",
"Description" : "Launch OpenVPN Server in an existing Virtual Private Cloud (VPC).",
"Parameters" : {
"InstanceType" : {
"Description" : "Instance type for OpenVPN Server",
"Type" : "String",
"Default" : "t2.micro",
"AllowedValues" : [ "t2.micro","t2.small","t2.medium","m3.medium","m3.large","m3.xlarge","m3.2xlarge"],
"ConstraintDescription" : "must be a valid EC2 instance type."
@rgarcia
rgarcia / vpc.json
Created February 5, 2016 01:10
VPC
{
"AWSTemplateFormatVersion" : "2010-09-09",
"Description" : "VPC with two public subnets and two private subnets in different AZs, and a NAT to enable instances in private subnets to access the internet",
"Parameters" : {
"KeyName" : {
"Description" : "Name of an existing EC2 KeyPair to enable SSH access to the bastion host",
"Type" : "AWS::EC2::KeyPair::KeyName"
}