Skip to content

Instantly share code, notes, and snippets.

@andrewjjenkins
andrewjjenkins / animals.pl
Last active March 1, 2022 22:19
A prolog skeleton for a Knights-and-Knaves problem with 8 animals
% Constraint Logic Programming
:- use_module(library(clpb)). % Boolean constraints
animals(1, [Horse, Cow, Chicken, Pig, Sheep, Goat, Swan, Cat]) :-
labeling([Horse, Cow, Chicken, Pig, Sheep, Goat, Swan, Cat]).
/** <examples> Your example queries go here, e.g.
?- animals(1, [Horse, Cow, Chicken, Pig, Sheep, Goat, Swan, Cat]).
*/
@andrewjjenkins
andrewjjenkins / animals.pl
Created March 1, 2022 22:04
A Prolog problem to solve a Knights-and-Knaves example from a teambuilding exercise
% Constraint Logic Programming
:- use_module(library(clpb)). % Boolean constraints
animals(1, [Horse, Cow, Chicken, Pig, Sheep, Goat, Swan, Cat]) :-
sat(card([6],[Horse, Cow, Chicken, Pig, Sheep, Goat, Swan, Cat])),
% Swan: "I'm the only honest bird"
sat(Swan =:= ~Chicken),
% Cow: "You can't trust the cat"
@andrewjjenkins
andrewjjenkins / README.md
Last active August 20, 2019 21:48
Build oneliners

Just a list of one-liners I keep using, forgetting and hunting for in history when building Envoy

bazel test //test/common/upstream/...
bazel test --test_output=errors //test/common/upstream:health_checker_impl_test
tools/bazel-test-gdb //test/common/upstream:health_checker_impl_test -c dbg --test_arg=--gtest_filter=TcpHealthCheckerImplTest.TimeoutAfterDisconnect
tools/bazel-test-gdb //test/common/upstream:health_checker_impl_test -c dbg
bazel build //source/exe:envoy-static -c dbg
bazel-bin/source/exe/envoy-static --config-path configs/google_com_proxy.v2.yaml --component-log-level connection:debug,upstream:debug
@andrewjjenkins
andrewjjenkins / cassandra.yaml
Created February 19, 2019 22:26
an example cassandra config that works for aspenmesh/istio 1.0.4
apiVersion: v1
kind: Namespace
metadata:
name: cassandra
---
apiVersion: v1
kind: Service
metadata:
labels:
app: cassandra
@andrewjjenkins
andrewjjenkins / gist:265fee1f342e8331152625c3712b47d0
Created November 2, 2018 15:40
/clusters for productpage talking to details
outbound|9080||details.default.svc.cluster.local::default_priority::max_connections::1024
outbound|9080||details.default.svc.cluster.local::default_priority::max_pending_requests::1024
outbound|9080||details.default.svc.cluster.local::default_priority::max_requests::1024
outbound|9080||details.default.svc.cluster.local::default_priority::max_retries::3
outbound|9080||details.default.svc.cluster.local::high_priority::max_connections::1024
outbound|9080||details.default.svc.cluster.local::high_priority::max_pending_requests::1024
outbound|9080||details.default.svc.cluster.local::high_priority::max_requests::1024
outbound|9080||details.default.svc.cluster.local::high_priority::max_retries::3
outbound|9080||details.default.svc.cluster.local::added_via_api::true
@andrewjjenkins
andrewjjenkins / dynamo-egress.yaml
Last active March 22, 2018 21:32
Talk to dynamo from Istio mesh
apiVersion: config.istio.io/v1alpha2
kind: EgressRule
metadata:
name: aws-dynamo-us-west-2-egress
namespace: default
spec:
destination:
service: dynamodb.us-west-2.amazonaws.com
ports:
- port: 443
@andrewjjenkins
andrewjjenkins / Dockerfile.minikube
Created January 23, 2018 21:28
Istio-Minikube and Jenkins
# Portions Copyright 2016 The Kubernetes Authors All rights reserved.
# Portions Copyright 2018 AspenMesh
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
@andrewjjenkins
andrewjjenkins / eof.c
Last active August 29, 2015 14:24
EOF is level triggered for read and for kevent
#include <stdio.h>
#include <strings.h>
#include <assert.h>
#include <unistd.h>
#include <errno.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/event.h>
#include <sys/time.h>
#include <sys/socket.h>
@andrewjjenkins
andrewjjenkins / infiniteServer.js
Last active August 29, 2015 14:18
Infinite HTTPS server
var https = require('https');
var cluster = require('cluster');
var fs = require('fs');
var url = require('url');
var core2Dir = process.env.CORE2DIR || '/build/cayman/andrew/lrs_release/core2';
var port = process.env.PORT || 443;
var numCPUs = process.env.NUMCPUS || ('' + (require('os').cpus().length - 1));
numCPUs = parseInt(numCPUs);
var reqSize = process.env.REQSIZE || ('' + 1024*1024*1024);
@andrewjjenkins
andrewjjenkins / infiniteClient.js
Last active August 29, 2015 14:18
HTTP client that POSTs arbitrarily large bodies.
var fs = require('fs');
var reqSize = process.env.REQSIZE || ('' + 1024*1024*1024);
reqSize = parseInt(reqSize);
var genericBlob = (new Array(10240 + 1)).join('0123456789');
//Client part.
function runClient() {