Skip to content

Instantly share code, notes, and snippets.

View olix0r's full-sized avatar
🍓

Oliver Gould olix0r

🍓
View GitHub Profile
extern crate rand;
use rand::Rng;
use std::cell::RefCell;
use std::collections::HashMap;
use std::rc::Rc;
use std::thread;
use std::time::Duration;
fn main() {
admin:
port: 9989
metricsIntervalSecs: 10
routers:
- label: default
interpreter:
kind: io.l5d.namerd.http
@olix0r
olix0r / dispatchq.rs
Created June 19, 2017 19:47
single-producer multi-consumer dispatch channel
use futures::{Future, Stream, Poll, Async, AsyncSink, Sink, StartSend};
use futures::unsync::{oneshot, mpsc};
use std::cell::RefCell;
use std::collections::VecDeque;
use std::rc::Rc;
/// Creates a dispatching channel.
///
/// This channel supports a single producer task and many consumers.
/// It is intended to be used by a producer task that pushes T-typed
@olix0r
olix0r / input.txt
Created June 20, 2017 02:26
BSD grep segfault
This file has been truncated, but you can view the full file.
Finished dev [unoptimized + debuginfo] target(s) in 0.0 secs
Running `target/debug/linkerd-tcp example.yml`
DEBUG:linkerd_tcp::balancer::dispatcher: start_send: dispatching waiter
TRACE:linkerd_tcp::balancer::dispatchq : start_send: dispatching sendq=1/1048575 recvq=0
TRACE:linkerd_tcp::balancer::dispatchq : dispatch: took waiter from sendq; polling recvq
TRACE:linkerd_tcp::balancer::dispatchq : dispatch: recvq not ready
TRACE:linkerd_tcp::balancer::dispatchq : start_send: dispatched sendq=1/1048575 recvq=0
DEBUG:linkerd_tcp::balancer::dispatcher: initiating 1 connections
DEBUG:linkerd_tcp::balancer::dispatcher: start_send: dispatched waiter ready=true
DEBUG:linkerd_tcp::balancer::dispatcher: start_send: dispatching waiter
@olix0r
olix0r / thriftcrash.sh
Created July 27, 2017 18:35
Kill your thrift server with this handy dandy command
#!/bin/sh
set -e
echo -n -e \\x00\\x00\\x00\\x08\\x4e\\x49\\x5f\\x50\\x49\\x4e\\x47\\x00 | nc $@
@olix0r
olix0r / lb.yml
Created February 2, 2018 23:36
a K8s config to test load balancing behavior
:; cat ~/b/hello-world.yml
---
apiVersion: v1
kind: Service
metadata:
name: hello
spec:
selector:
app: hello
# Examples:
#
# # Deploy everything
# :; target/cli/conduit-latest-macos inject config/strest.yml \
# | kubectl apply -f - --prune -l 'app=strest'
#
# # Add server instances
# :; kubectl -n strest scale -l 'strest-role=server' --replicas=3
#
# # Stop a specific test
---
apiVersion: v1
kind: Namespace
metadata:
name: bot
---
apiVersion: v1
kind: Service
metadata:
#!/bin/sh
set -eu
DEFAULT_URL="http://localhost:4191/metrics"
DEFAULT_CURL="curl"
curl="${CURL:-$DEFAULT_CURL}"
url="${1:-$DEFAULT_URL}"
while true ; do
# Examples:
#
# # Deploy everything
# :; kubectl apply -f strest.yml --prune -l 'app=strest'
#
# # Add server instances
# :; kubectl -n strest scale -l 'strest-server-profile=fast' --replicas=10
---
kind: Namespace