Skip to content

Instantly share code, notes, and snippets.

Bill Burcham Bill

Block or report user

Report or block Bill

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@Bill
Bill / docker-compose.yml
Last active May 2, 2019
Run a local Hypothes.is annotation server (and the services it needs) via docker-compose
View docker-compose.yml
# This docker-compose.yml will run the Hypothes.is annotation server.
# (adapted from instructions here https://h.readthedocs.org/en/latest/INSTALL.html)
#
# Place this file in the working directory (clone of https://github.com/hypothesis/h)
# run with docker-compose up -d
#
# Now browse to Hypothes.is at http://192.168.59.103:8000/ and create an account
# You'll see the invitation email in Mailcatcher at http://192.168.59.103:1080/
# Click that invitation link and log in on your local Hypothes.is
# And you are ready to annotate!
@Bill
Bill / DoesOptionalObeyFunctorLaws.java
Last active May 1, 2019
Optional, introduced along with Stream and Function, in Java 8, has a map() method. Does it obey the functor laws, particularly the one pertaining to function composition?
View DoesOptionalObeyFunctorLaws.java
import java.util.List;
import java.util.Optional;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;
class Scratch {
/*
A method that converts a String to an Integer.
@Bill
Bill / flatMapNulls.java
Created Apr 24, 2019
Use flatMap() to elide nulls in a Stream
View flatMapNulls.java
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
import java.util.stream.Stream;
class Scratch {
public static void main(String[] args) {
final List<String> original =
Stream.of("a", "b", null, "c")
.collect(Collectors.toList());
@Bill
Bill / EnumSetFormat.java
Created Apr 4, 2019
Creates an EnumSet with a couple elements and prints it in String and OutputStream format.
View EnumSetFormat.java
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.util.EnumSet;
class Scratch {
enum Fruit {APPLE, ORANGE};
public static void main(String[] args) throws IOException {
final EnumSet<Fruit> fruits = EnumSet.of(Fruit.APPLE, Fruit.ORANGE);
@Bill
Bill / haregionqueue.png
Last active Apr 3, 2019
Geode HARegionQueue Class Diagram
@Bill
Bill / Foo.kt
Created Jan 10, 2019
Little dispatcher exerciser
View Foo.kt
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 Oct 30, 2018
This benchmark works against the latest Apache Geode develop branch
View MonitorQueryUnderContentionBenchmark.java
/*
* 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 Oct 17, 2018
Java Future Test
View FutureTest.java
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 Mar 3, 2017
Clojure Collection Processing In Context: Part I: Eager to Process
View part1.clj
;
; 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)
View morse_fsa.rb
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
You can’t perform that action at this time.