Skip to content

Instantly share code, notes, and snippets.

View Bill's full-sized avatar

Bill Burcham Bill

View GitHub Profile
@Bill
Bill / haregionqueue.png
Last active April 3, 2019 16:49
Geode HARegionQueue Class Diagram
haregionqueue.png
@Bill
Bill / Foo.kt
Created January 10, 2019 22:52
Little dispatcher exerciser
import kotlinx.coroutines.*
import kotlinx.coroutines.launch;
import kotlinx.coroutines.scheduling.ExperimentalCoroutineDispatcher
import kotlinx.coroutines.test.setMain
import java.util.concurrent.TimeUnit
import kotlin.coroutines.coroutineContext
suspend fun log(msg: String) = println("[${Thread.currentThread().name} ${coroutineContext[CoroutineName]}] $msg")
fun main(args: Array<String>) = repeat(1) {
@Bill
Bill / MonitorQueryUnderContentionBenchmark.java
Last active October 30, 2018 21:54
This benchmark works against the latest Apache Geode develop branch
/*
* Licensed to the Apache Software Foundation (ASF) under one or more contributor license
* agreements. See the NOTICE file distributed with this work for additional information regarding
* copyright ownership. The ASF licenses this file to You 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 distributed under the License
@Bill
Bill / FutureTest.java
Created October 17, 2018 17:39
Java Future Test
import org.junit.Before;
import org.junit.Test;
import java.util.concurrent.Callable;
import java.util.concurrent.FutureTask;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
public class FutureTest {
@Bill
Bill / part1.clj
Last active March 3, 2017 18:12
Clojure Collection Processing In Context: Part I: Eager to Process
;
; Clojure Collection Processing In Context: Part I: Eager to Process
; © 2017, by Bill Burcham
;
; Slides at: https://docs.google.com/presentation/d/1wKcTN5-f00ZCKk_LpUG5GIorh89AImmuxvG7MiGiF1c
;
(ns ccpic.part1)
(use 'clojure.repl)
@Bill
Bill / morse_fsa.rb
Created May 4, 2012 01:32
Solution to http://www.therubygame.com/challenges/6 that creates its own FSA
require 'singleton'
# This is a parser pattern based on regexp as lexer.
# Express your tokens as parenthesized regexps separated by
# alternation (|). Erroneous input causes immediate return.
module Parse
def parse( s, p, &block)
i = 0
while i < s.length do
require 'singleton'
# This is a parser pattern based on regexp as lexer.
# Express your tokens as parenthesized regexps separated by
# alternation (|). Erroneous input causes immediate return.
module Parse
def parse( s, p, &block)
i = 0
while i < s.length do
# could pass i to match and use block form in newer lib
before_filter :set_database_for_cluster_stuff
# SourceSpecific and subclasses (Content, Cluster) take up a lot of space so we want them in
# their own per-Domain databases. This hook injects the appropriate database connection based
# on the Domain gleaned from the request so subsequent access (during this request)
# will go to the appropriate database.
def set_database_for_cluster_stuff
config = ActiveRecord::Base.configurations[RAILS_ENV]
# Get the database name from the Domain
# capture a yaml dump of an object like this:
# capture { y request }
module Kernel
def capture # pass a block to capture
old_stdout = $stdout
out = StringIO.new
$stdout = out
begin
yield
ensure
# the approved way to add methods to example groups in rspec
# from David Chelimsky's comment here http://www.benmabey.com/2008/06/08/writing-macros-in-rspec/
Spec::Runner.configure do |config|
config.include(AssignMacro, :type => :controllers)
end