One Paragraph of project description goes here
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.
package main | |
import ( | |
"errors" | |
"fmt" | |
"net" | |
) | |
func main() { | |
localIP, err := getLocalIPFromNetInterfaces() |
import "regexp" | |
// Basic regular expressions for validating strings | |
const ( | |
Email string = "^(((([a-zA-Z]|\\d|[!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~]|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])+(\\.([a-zA-Z]|\\d|[!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~]|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])+)*)|((\\x22)((((\\x20|\\x09)*(\\x0d\\x0a))?(\\x20|\\x09)+)?(([\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x7f]|\\x21|[\\x23-\\x5b]|[\\x5d-\\x7e]|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])|(\\([\\x01-\\x09\\x0b\\x0c\\x0d-\\x7f]|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}]))))*(((\\x20|\\x09)*(\\x0d\\x0a))?(\\x20|\\x09)+)?(\\x22)))@((([a-zA-Z]|\\d|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])|(([a-zA-Z]|\\d|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])([a-zA-Z]|\\d|-|\\.|_|~|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])*([a-zA-Z]|\\d|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])))\\.)+(([a-zA-Z]|[\\ |
-- Two dashes start a one-line comment. | |
--[[ | |
Adding two ['s and ]'s makes it a | |
multi-line comment. | |
--]] | |
---------------------------------------------------- | |
-- 1. Variables and flow control. | |
---------------------------------------------------- |
Peter Naur's classic 1985 essay "Programming as Theory Building" argues that a program is not its source code. A program is a shared mental construct (he uses the word theory) that lives in the minds of the people who work on it. If you lose the people, you lose the program. The code is merely a written representation of the program, and it's lossy, so you can't reconstruct
package main | |
import ( | |
"bytes" | |
"crypto/rand" | |
"crypto/rsa" | |
"crypto/tls" | |
"crypto/x509" | |
"crypto/x509/pkix" | |
"encoding/pem" |
{ | |
"workbench.colorCustomizations": { | |
"editorBracketMatch.border": "#0000", | |
"[Palenight Italic]": { | |
"editorBracketMatch.background": "#030407" | |
} | |
}, | |
"editor.tokenColorCustomizations": { | |
"[Joker Light (rainglow)]": { | |
"functions": "#007CBE", |
var tokenEncoder = base64.RawURLEncoding | |
// parsePublicTokenPayload parses the public (unencrypted) token payload | |
// works even with expired tokens (that do not pass verification) | |
func parsePublicTokenPayload(token string) (*JSONToken, error) { | |
tokenPieces := strings.Split(token, ".") | |
if len(tokenPieces) < 3 { | |
// version.purpose.payload or version.purpose.payload.footer | |
// see: https://tools.ietf.org/id/draft-paragon-paseto-rfc-00.html#rfc.section.2 | |
return nil, errors.New("malformed token: expected at least 3 pieces") |
// Tar takes a source and variable writers and walks 'source' writing each file | |
// found to the tar writer; the purpose for accepting multiple writers is to allow | |
// for multiple outputs (for example a file, or md5 hash) | |
func Tar(src string, writers ...io.Writer) error { | |
// ensure the src actually exists before trying to tar it | |
if _, err := os.Stat(src); err != nil { | |
return fmt.Errorf("Unable to tar files - %v", err.Error()) | |
} |
// Untar takes a destination path and a reader; a tar reader loops over the tarfile | |
// creating the file structure at 'dst' along the way, and writing any files | |
func Untar(dst string, r io.Reader) error { | |
gzr, err := gzip.NewReader(r) | |
if err != nil { | |
return err | |
} | |
defer gzr.Close() |