Skip to content

Instantly share code, notes, and snippets.

@transacid
Created May 3, 2022 07:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save transacid/59909bf9a6b34392cc0c618bd03fdef1 to your computer and use it in GitHub Desktop.
Save transacid/59909bf9a6b34392cc0c618bd03fdef1 to your computer and use it in GitHub Desktop.
base64 without echo
package main
import (
"bufio"
"encoding/base64"
"fmt"
"os"
"strings"
)
func main() {
var i string
if len(os.Args) > 1 {
i = os.Args[1]
} else {
r := bufio.NewReader(os.Stdin)
i, _ = r.ReadString('\n')
}
s := strings.TrimRight(i, "\n")
o, _ := base64.StdEncoding.DecodeString(s)
fmt.Printf("\n%s\n", string(o))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment