Skip to content

Instantly share code, notes, and snippets.

View ehfeng's full-sized avatar

Eric Feng ehfeng

View GitHub Profile
@ehfeng
ehfeng / README.md
Created May 4, 2026 18:42
Kernel session usage export CLI — queries the Kernel API for past browser sessions and outputs CSV

Session Usage Export

CLI tool that queries the Kernel API for past browser sessions and exports them to CSV.

Setup

npm install
@ehfeng
ehfeng / README.md
Last active April 30, 2026 17:43
CDP connection drop repro — stress tests + upstream traffic analysis

CDP Connection Drop Repro

Slack: https://onkernel.slack.com/archives/C0925PJ42R4/p1777402605274079 Gist: https://gist.github.com/ehfeng/95a8d8ff04f066552ed243e1a351ab67

Felicity (org au2d7qfvqkhaxcqzmbd9xvch) reported CDP connections dropping with code 1006 during page.evaluate on tickertrends.io. They run two CDP connections (Stagehand + Playwright) with a screenshot loop every ~1s.

Root cause: OOM killer silently kills the Chrome renderer

We ran oom-forensics.mjs which triggers OOM inside the VM and then inspects dmesg. The Linux OOM killer SIGKILL's the Chrome renderer process — and it looks exactly like the customer's symptoms:

{"chrome_policy": {
"ShowHomeButton": true,
"HomepageLocation": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
"HomepageIsNewTabPage": false,
"RestoreOnStartup": 4,
"RestoreOnStartupURLs": ["https://www.youtube.com/watch?v=dQw4w9WgXcQ"],
"NewTabPageLocation": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
"BookmarkBarEnabled": true,
"ManagedBookmarks": [
{"toplevel_name": "Never Gonna Give You Up"},
@ehfeng
ehfeng / sequences.go
Created April 20, 2024 02:20
badgerdb sequences
package main
import (
"encoding/binary"
"fmt"
"sync"
"sync/atomic"
"github.com/dgraph-io/badger/v4"
)
@ehfeng
ehfeng / badgerdb.go
Created April 20, 2024 01:22
simple badger usage
package main
import (
"encoding/binary"
"fmt"
"sync"
"github.com/dgraph-io/badger/v4"
)
@ehfeng
ehfeng / v8_internal_fields_and_getters.go
Last active October 30, 2023 04:15
Verified getters work with internal fields in v8
package main
import (
v8 "rogchap.com/v8go"
)
type v8BuiltIns struct {
Object struct {
create *v8.Function
defineProperty *v8.Function
@ehfeng
ehfeng / bbolt_nil_value.go
Created August 30, 2023 00:30
You can store nil values in bbolt. In ForEach, the only way to determine if a key is a nil value or bucket is by attempting to cast it as a bucket.
package main
import (
"fmt"
"go.etcd.io/bbolt"
)
var bucketName = []byte("MyBucket")
@ehfeng
ehfeng / v8_complex_fn_perf.go
Created June 27, 2023 18:22
Performance cost of slightly complicated function call
package main
import (
"encoding/json"
"fmt"
"runtime"
"sync"
"time"
v8 "rogchap.com/v8go"
@ehfeng
ehfeng / v8_json_parse_perf.go
Created June 27, 2023 17:22
Parallelism, JSON parsing, and v8
package main
import (
"encoding/json"
"fmt"
"runtime"
"sync"
"time"
v8 "rogchap.com/v8go"
@ehfeng
ehfeng / v8_startup_parallelism.go
Created June 27, 2023 17:12
Performance cost of starting isolates in parallel
package main
import (
"fmt"
"runtime"
"sync"
"time"
v8 "rogchap.com/v8go"
)