This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# like surfraw, but not a million fucking lines long. | |
# requires dmenu. | |
# the default search engine is shown at first. | |
# to select another search engine, press enter when | |
# the prompt is empty in dmenu. | |
# name of the default search engine | |
default='Searx' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import "math/rand/v2" | |
func randomBytes(dst []byte) { | |
const charset = "abcdefghijklmnopqrstuvwxyz" + | |
"ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\t\n " | |
for i := 0; i < len(dst); i++ { | |
dst[i] = charset[rand.IntN(len(charset))] | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package seen | |
type Seen[T comparable] struct { | |
Map map[T]struct{} | |
} | |
func New[T comparable](size int) Seen[T] { | |
return Seen[T]{ | |
Map: make(map[T]struct{}, size), | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -eu -o pipefail | |
# This script ensures source code files | |
# have copyright license headers. | |
# | |
# It modifies all source files in place | |
# and avoids adding a license header | |
# to any file that already has one. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package withcloser | |
import "io" | |
type reader struct { | |
io.Reader | |
close func() error | |
} | |
func (r reader) Close() error { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package once | |
import "sync" | |
type Once[T any] struct { | |
sync.Mutex | |
has bool | |
v T | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import "sync" | |
type Nuclear[T any] struct { | |
mu sync.RWMutex | |
v T | |
} | |
func NewNuclear[T any](v T) *Nuclear[T] { | |
return &Nuclear{ | |
v: v, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func permute[T any](v []T) [][]T { | |
switch len(v) { | |
case 0: | |
return [][]T{ | |
{}, | |
} | |
case 1: | |
return [][]T{ | |
{v[0]}, | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func subsets[T any](v []T) [][]T { | |
switch len(v) { | |
case 0: | |
return [][]T{ | |
{}, | |
} | |
case 1: | |
return [][]T{ | |
{v[0]}, | |
{}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -eu -o pipefail | |
# Script that returns a list of DNS-over-HTTPS servers that are accessible directly via IP address. | |
# https://dnscrypt.info/public-servers | |
# https://dnscrypt.info/stamps-specifications | |
main() | |
{ | |
VERBOSE=false |