Skip to content

Instantly share code, notes, and snippets.

View x0a1b's full-sized avatar

x0a1b

  • DoorDash
  • San Francisco, CA
View GitHub Profile
@x0a1b
x0a1b / example1.kt
Last active January 21, 2020 03:43
Greeter service snippets
val person = Person.newBuilder()
.setName("Hello Kitty")
.setAddress(
Address.newBuilder()
.setNumber(123)
.setStreet("Hello Kitty Street")
.setPostcode("N304SD")
.build())
.build()
import io.lettuce.core.TimeoutOptions;
import io.lettuce.core.cluster.ClusterClientOptions;
import io.lettuce.core.cluster.ClusterTopologyRefreshOptions;
import java.time.Duration;
public class LettuceConfigFactory {
public static final int DEFAULT_TIMEOUT_MILLIS = 1000;
public static final int DEFAULT_REFRESH_TRIGGERS_RECONNECT_ATTEMPTS = 3;
@x0a1b
x0a1b / ClusteredSlidingWindowRateLimiter.kt
Created April 12, 2020 07:01
Rolling window rate limiter
import io.lettuce.core.ScriptOutputType
import io.lettuce.core.cluster.api.StatefulRedisClusterConnection
import kotlinx.coroutines.future.asDeferred
import java.time.Duration
import java.util.UUID
class ClusteredSlidingWindowRateLimiter(
redisClient: StatefulRedisClusterConnection<String, String>
) : RateLimiter {
companion object {
@x0a1b
x0a1b / LICENSE
Last active October 11, 2022 19:46
Writing delightful middlewares in Go
Copyright (c) 2019 DoorDash
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all