Skip to content

Instantly share code, notes, and snippets.

import java.util.concurrent.Executors;
import java.util.concurrent.Callable;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.time.Instant;
import java.util.concurrent.TimeUnit;
public class LoomApp{
public static void main (String [] args) throws Exception{
var thread = Thread.startVirtualThread(() -> System.out.println("virtualthread Hello"));
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Supplier;
public class BeerProcessorChallenger{
private static int drunkenness;
public static void main (String [] args) {
Supplier<Integer> moneBeerSupplier = () -> drunkenness = 5;
drunkenness = 10;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.stream.IntStream;
public class HighCpu{
private static BlockingQueue<String> messageStrings = new LinkedBlockingQueue<>();

end time 2020.1.25

9MWZD5CC4E-eyJsaWNlbnNlSWQiOiI5TVdaRDVDQzRFIiwibGljZW5zZWVOYW1lIjoiMjAxNzY1MDYxQGNxdS5lZHUuY24gLiIsImFzc2lnbmVlTmFtZSI6IiIsImFzc2lnbmVlRW1haWwiOiIiLCJsaWNlbnNlUmVzdHJpY3Rpb24iOiJGb3IgZWR1Y2F0aW9uYWwgdXNlIG9ubHkiLCJjaGVja0NvbmN1cnJlbnRVc2UiOmZhbHNlLCJwcm9kdWN0cyI6W3siY29kZSI6IklJIiwicGFpZFVwVG8iOiIyMDIwLTAxLTI0In0seyJjb2RlIjoiQUMiLCJwYWlkVXBUbyI6IjIwMjAtMDEtMjQifSx7ImNvZGUiOiJEUE4iLCJwYWlkVXBUbyI6IjIwMjAtMDEtMjQifSx7ImNvZGUiOiJQUyIsInBhaWRVcFRvIjoiMjAyMC0wMS0yNCJ9LHsiY29kZSI6IkdPIiwicGFpZFVwVG8iOiIyMDIwLTAxLTI0In0seyJjb2RlIjoiRE0iLCJwYWlkVXBUbyI6IjIwMjAtMDEtMjQifSx7ImNvZGUiOiJDTCIsInBhaWRVcFRvIjoiMjAyMC0wMS0yNCJ9LHsiY29kZSI6IlJTMCIsInBhaWRVcFRvIjoiMjAyMC0wMS0yNCJ9LHsiY29kZSI6IlJDIiwicGFpZFVwVG8iOiIyMDIwLTAxLTI0In0seyJjb2RlIjoiUkQiLCJwYWlkVXBUbyI6IjIwMjAtMDEtMjQifSx7ImNvZGUiOiJQQyIsInBhaWRVcFRvIjoiMjAyMC0wMS0yNCJ9LHsiY29kZSI6IlJNIiwicGFpZFVwVG8iOiIyMDIwLTAxLTI0In0seyJjb2RlIjoiV1MiLCJwYWlkVXBUbyI6IjIwMjAtMDEtMjQifSx7ImNvZGUiOiJEQiIsInBhaWRVcFRvIjoiMjAyMC0wMS0yNCJ9LHsiY29kZSI6IkRDIiwicGFpZ

import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.function.Supplier;
import java.util.stream.Collectors;
public class CompletableFutureChallenge{
static ExecutorService executor = Executors.newCachedThreadPool();
public static void main (String... oracleCodeOneAdventure) {
CompletableFuture<List<String>> adventureStart = new CompletableFuture<>();
#lang typed/racket
(require x64asm)
(define-cast ->int
#:type (-> Integer)
#:ctype (_fun -> _int))
(define-λ! get-1000 ->int
(mov rax (imm32 1000))
(ret))

I've been working with Kafka for over 7 years. I inevitably find myself doing the same set of activities while I'm developing or working with someone else's system. Here's a set of Kafka productivity hacks for doing a few things way faster than you're probably doing them now. 🔥

Get the tools

#lang racket
(require json)
(define filename "combined.json")
(define timezone-data (call-with-input-file filename read-json))
(define (random-sample object [max-size 5])
(cond
((hash? object)
Name Status Libre Alternatives Description
android-sdk-platform-tools nonfree
cowsay nonfree cowsay website of the source code is unavaiable
dropbox nonfree proprietary EULA, built from binaries, unavailable sources, non-free artwork
faac nonfree [FIXME:description] is a GPL'ed package, but has non free code that can't be distributed under the GPL
flashplugin nonfree nonfree, nondistributable, built from binary installers, etc
intel-ucode nonfree no modification, use restrictions
jdk7 nonfree
opencl-nvidia nonfree nonfree, nondistributable, built from binary installers, etc
@cmonkey
cmonkey / eq.rkt
Created October 22, 2014 09:17
eq string
racket@> (= "str" "str")
2|=: contract violation
3| expected: number?
4| given: "str"
5| argument position: 1st
6| other arguments...:
7| "str"
8| context...:
9| /usr/share/racket/collects/racket/private/misc.rkt:87:7