Skip to content

Instantly share code, notes, and snippets.

Avatar

Valentin Deleplace Deleplace

View GitHub Profile
@Deleplace
Deleplace / signdance.go
Last active March 7, 2023 22:37
A web server that generates dancing gopher GIFs
View signdance.go
# Copyright 2019 Google LLC
# SPDX-License-Identifier: Apache-2.0
package main
import (
"fmt"
"image"
"image/color"
"image/draw"
"image/gif"
@Deleplace
Deleplace / mapfunc_test.go
Created November 17, 2022 13:01
Is there a performance penalty when taking a func argument instead of a value argument, in concurrent maps operations?
View mapfunc_test.go
package mapfunc
import (
"sync"
"testing"
"github.com/puzpuzpuz/xsync/v2"
)
const (
@Deleplace
Deleplace / sortstrings_test.go
Created February 17, 2022 16:52
Benchmark for sorting a slice of strings, case-insensitively
View sortstrings_test.go
package bench
import (
"math/rand"
"sort"
"strings"
"testing"
"unicode"
"unicode/utf8"
)
@Deleplace
Deleplace / gist:869094a77a5292b40511704482e3e7d8
Created November 9, 2022 10:07
URL for Google Images search, to be used in Chrome in Settings > Search engine > Add
View gist:869094a77a5292b40511704482e3e7d8
https://www.google.com/search?q=%s&tbm=isch
@Deleplace
Deleplace / stablesort_test.go
Last active November 7, 2022 16:32
Overhead of stable sorting, in Go
View stablesort_test.go
package stablesort
import (
"math/rand"
"sort"
"testing"
"golang.org/x/exp/slices"
)
@Deleplace
Deleplace / stablesort_test.go
Created November 7, 2022 15:30
How much overhead for a STABLE sort of 1000 lowercase letters (26 possible values per letter), compared to a standard sort?
View stablesort_test.go
package stablesort
import (
"math/rand"
"sort"
"testing"
)
const (
M = 500
@Deleplace
Deleplace / roses-are-red.txt
Created September 15, 2022 09:50
Roses Are Red
View roses-are-red.txt
Roses are red
Violets are blue,
Sugar is sweet
And so are you.
@Deleplace
Deleplace / othello.txt
Created September 15, 2022 09:43
Othello
View othello.txt
Othello, the Moore of Venice
ACT I
SCENE I. Venice. A street.
Enter RODERIGO and IAGO
RODERIGO
Tush! never tell me; I take it much unkindly
That thou, Iago, who hast had my purse
As if the strings were thine, shouldst know of this.
IAGO
@Deleplace
Deleplace / hamlet.txt
Created September 15, 2022 09:41
Hamlet
View hamlet.txt
The Tragedy of Hamlet, Prince of Denmark
ACT I
SCENE I. Elsinore. A platform before the castle.
FRANCISCO at his post. Enter to him BERNARDO
BERNARDO
Who's there?
FRANCISCO
Nay, answer me: stand, and unfold yourself.
BERNARDO