Skip to content

Instantly share code, notes, and snippets.

View adoublef's full-sized avatar

Kristopher adoublef

  • 12:34 (UTC +01:00)
View GitHub Profile
@adoublef
adoublef / bloom.go
Last active December 28, 2024 20:58
Data Structures
// Copyright 2024 Kristopher Rahim Afful-Brown. All rights reserved.
//
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package probabilistic
type Hasher interface {
Hash(p []byte) uint64
}
@adoublef
adoublef / client.go
Last active December 6, 2024 22:23
server-sent events
// Copyright 2024 Kristopher Rahim Afful-Brown. All rights reserved.
//
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Package sse
package sse
import (
"bufio"
// Copyright 2024 Rahim Afful-Brown. All Rights Reserved.
//
// Distributed under MIT license.
// See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
package copy_test
import (
"bufio"
"io"
package aesctr256hmacsha256_test
import (
"crypto/aes"
"crypto/cipher"
"embed"
"encoding/hex"
"io"
"os"
"testing"
@adoublef
adoublef / role.go
Created May 13, 2024 10:43
Roles using enums
package journal
import (
"database/sql/driver"
"errors"
"fmt"
)
type Role int
@adoublef
adoublef / cockroachdb.go
Created March 17, 2024 20:22
Testcontainers
package ccdb
import (
"context"
"fmt"
tc "github.com/testcontainers/testcontainers-go"
"github.com/testcontainers/testcontainers-go/wait"
)
@adoublef
adoublef / client.go
Created March 17, 2024 20:05
Golang SMTP
package smtp
import (
"crypto/tls"
"fmt"
"net/smtp"
"net/url"
"strings"
)
# syntax=docker/dockerfile:1
ARG GO_VERSION=1.21
ARG DISTROLESS=static-debian11:nonroot-amd64
FROM golang:${GO_VERSION} AS base
WORKDIR /usr/src
COPY go.* .
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH=$HOME/.oh-my-zsh
# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
@adoublef
adoublef / keto.go
Last active February 1, 2024 12:04
Keto Testcontainers
package keto
import (
"context"
"fmt"
"net"
"github.com/testcontainers/testcontainers-go"
)