Skip to content

Instantly share code, notes, and snippets.

@pims
pims / envoy.yaml
Created January 24, 2024 20:48
envoy stats
stats_config:
stats_matcher:
exclusion_list:
patterns:
- suffix: upstream_cx_length_ms #statsd format
histogram_bucket_settings:
- match:
suffix: upstream_rq_time
# defaul buckets with 600000,1800000,3600000 dropped
buckets: [0.5,1,5,10,25,50,100,250,500,1000,2500,5000,10000,30000,60000,300000]
@pims
pims / app.py
Last active January 3, 2024 20:26
Example of running a python script via python-wasi using the wasmtime wasm runtime
print("hello from a python script")
[
"abogado",
"ac",
"academy",
"accountant",
"accountants",
"actor",
"ad",
"adult",
"ae",
@pims
pims / hello.ts
Last active March 29, 2021 20:48
function handleRequest(request) {
const NAME = "experiment-0"
// The Responses below are placeholders. You can set up a custom path for each test (e.g. /control/somepath ).
const TEST_RESPONSE = new Response("Test group") // e.g. await fetch("/test/sompath", request)
const CONTROL_RESPONSE = new Response("Control group") // e.g. await fetch("/control/sompath", request)
// Determine which group this requester is in.
const cookie = request.headers.get("cookie")
if (cookie && cookie.includes(`${NAME}=control`)) {
import kopf
import kubernetes
import yaml
@kopf.on.create('zalando.org', 'v1', 'databases')
def create_fn(body, spec, **kwargs):
# Get info from Database object
name = body['metadata']['name']
namespace = body['metadata']['namespace']
type = spec['type']
@pims
pims / http.go
Created December 13, 2019 21:45
var httpClient = &http.Client{
Timeout: defaultHTTPTimeout,
// There is a bug in Go's HTTP/2 implementation that occasionally causes it
// to send an empty body when it receives a `GOAWAY` message from a server:
//
// https://github.com/golang/go/issues/32441
//
// This is particularly problematic for this library because the empty body
// results in no parameters being sent, which usually results in a 400,
#/usr/bin/env python
import math
class RunningCorrelation:
def __init__(self):
self.n = 0.0
self.mean_x = 0.0
self.mean_y = 0.0
self.m2_x = 0.0
self.m2_y = 0.0
@pims
pims / itunes.log
Created August 29, 2017 05:39
Blank page for iTunes store.
Aug 28 21:34:01 home-2 com.apple.usbmuxd[103]: error MuxTCPSendNextSegmentOverNetwork Unexpected EOF, client 21-iTunes:0 -> 1-fe80::1ce6:e723:fbee:7396:0:0
Aug 28 21:34:02 home-2 com.apple.usbmuxd[103]: error MuxTCPSendNextSegmentOverNetwork Unexpected EOF, client 37-iTunes:0 -> 1-fe80::1ce6:e723:fbee:7396:0:0
Aug 28 21:34:02 home-2 com.apple.usbmuxd[103]: error MuxTCPSendNextSegmentOverNetwork Unexpected EOF, client 43-iTunes:0 -> 1-fe80::1ce6:e723:fbee:7396:0:0
Aug 28 21:34:02 home-2 com.apple.usbmuxd[103]: error MuxTCPSendNextSegmentOverNetwork Unexpected EOF, client 51-iTunes:0 -> 1-fe80::1ce6:e723:fbee:7396:0:0
Aug 28 21:34:04 home-2 com.apple.usbmuxd[103]: error MuxTCPSendNextSegmentOverNetwork Unexpected EOF, client 10-iTunes:0 -> 1-fe80::1ce6:e723:fbee:7396:0:0
Aug 28 21:34:07 home-2 com.apple.usbmuxd[103]: error MuxTCPSendNextSegmentOverNetwork Unexpected EOF, client 78-iTunes:0 -> 1-fe80::1ce6:e723:fbee:7396:0:0
Aug 28 21:34:09 home-2 com.apple.usbmuxd[103]: error MuxTCPS
// Copyright 2015 The Gorilla WebSocket Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build ignore
package main
import (
"flag"
#!/usr/bin/env python
# encoding: utf-8
"""
Example of friendships computing for mapreduce
inspired by this post : http://stevekrenzel.com/finding-friends-with-mapreduce
"""
__author__ = "Tim Bart"
__copyright__ = "No copyright"