Categorygithub.com/1f604/util
modulepackage
1.91.0
Repository: https://github.com/1f604/util.git
Documentation: pkg.go.dev

# README

util

The code in this project is designed to be reusable across many different Go projects. It's designed to be completely general and can be reused without any adaptation.

This library calls panic in a number of places so you may want to capture both stdout and stderr like this:

go run ./fileserver/main.go 2>stderr.log 1>stdout.log

To run all tests:

go test $(go list ./... | grep -v manual)

For an overview of this package see https://pkg.go.dev/github.com/1f604/util

The AWS dependencies are only needed for the cloudflare stuff.

# Packages

No description provided by the author
No description provided by the author
No description provided by the author
Create 200k files in one directory vs 200k files in 100 separate directories See if speed of accessing files is affected.
No description provided by the author
Defends against directory traversal attacks.

# Functions

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Users MUST keep a reference to the returned listener to ensure it does not get garbage-collected!!! This caveat applies regardless of whether you're using TCP, Unix, or some other socket!!.
https://rosettacode.org/wiki/Determine_if_only_one_instance_is_running#Port.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
This is the one you want to use in production.
This is the one you want to use in production.
The RandomBag steals the slice that you pass to it.
Returns random string consisting of letters and numbers.
Returns random string consisting of letters and numbers.
This function works, I've manually tested it.
This function works, I've manually tested it.
No description provided by the author
No description provided by the author
this function assumes file pointer is valid.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
This function works, I've manually tested it.
No description provided by the author
No description provided by the author
This is the one you want to use in production.
No description provided by the author
pregenerate means strings up to n characters will be pre-generated and stored in RandomBags for fast PopRandom and Push later.
No description provided by the author
No description provided by the author
No description provided by the author
the bucket interval is the all-important parameter that determines the number of buckets and when buckets will be deleted the bucket interval is in Unix time (seconds).
the bucket interval is the all-important parameter that determines the number of buckets and when buckets will be deleted the bucket interval is in Unix time (seconds).
No description provided by the author
Works just like the log rotation library - once log file reaches the max size, create a new log file Except we don't need any clever naming scheme, just an increasing number will do, since we're going to read in every file on startup anyway The increasing number naming scheme is actually good for cloud backups since we can just send the highest numbered file every time.
No description provided by the author
No description provided by the author
the bucket interval is the all-important parameter that determines the number of buckets and when buckets will be deleted the bucket interval is in Unix time (seconds).
No description provided by the author
No description provided by the author
Naive algorithm, only suitable for small b.
calculates a to the power of b mod m.
PrintMemUsage outputs the current, total and OS memory being used.
Shorten long URL into short URL and return the short URL and store the entry both in map and on disk.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Does not tick shift - will run function precisely every X seconds even if function takes some time to run - as long as the function doesn't take too long of course.
https://stackoverflow.com/questions/19965795/how-to-write-log-to-file.
No description provided by the author
No description provided by the author
https://stackoverflow.com/questions/21743841/how-to-avoid-annoying-error-declared-and-not-used.
Returns error if unix timestamp is before 2023 or after the year 20,000 Otherwise returns nil.
Write_Entry_To_File
IMPORTANT: This function DOES NOT close the file handle!!!.

# Constants

No description provided by the author
No description provided by the author

# Variables

No description provided by the author
Character class lookup table.
No description provided by the author
No description provided by the author
No description provided by the author

# Structs

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Custom error types */.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
keys are strings.
No description provided by the author
keys are strings.
No description provided by the author
No description provided by the author
No description provided by the author
Custom error types */.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
inspired by StripeIntentParams.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Interfaces

See https://stackoverflow.com/questions/57993809/how-to-hide-the-default-type-constructor-in-golang.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Users of this map are expected to access it with a mutex.
No description provided by the author
No description provided by the author
No description provided by the author

# Type aliases

============= All this stuff is just to implement the interface required by heap ===================.
No description provided by the author
Define a slice of Person structs.
No description provided by the author