top | item 45484532

(no title)

rohan_ | 4 months ago

is this stuff not pretty easy to do with python?

``` python -c "import base64; print(base64.b64encode('$INPUT_STRING'.encode('utf-8')).decode('utf-8'))" ```

discuss

order

landr0id|4 months ago

I love typing python commands that are 10x longer than a shorthand.

Yes it's easy to set up an alias or shell command or whatever, but that's besides the point :p

ksdme9|4 months ago

You don't even have to go that far, `base64` is a coreutil (https://github.com/coreutils/coreutils/blob/ebfd80083b4fe4ae...).

The point of ut is not to replace or invent new tooling. It is meant to be a set of tools that are simple, self exploratory and work out of the box with sane defaults. So, essentially, something that you don't have to remember syntax for or go through help/man pages everytime you want to use it.

klardotsh|4 months ago

If you can remember all of that off the top of your head and find it ergonomic to type out, then sure. But much like how I prefer someone else to do my content syncing as an ergonomic appliance rather than using FTP + curlftpfs + a VCS [1], I quite like this idea of a focused toolbox (written in a language that compiles to native code) and welcome it rather than having to store these massive snippets in my head (or write shell wrappers for them).

[1] https://news.ycombinator.com/item?id=9224

dolmen|4 months ago

Also with Go:

  $ go run github.com/dolmen-go/goeval@master 'fmt.Println(base64.StdEncoding.EncodeToString([]byte(os.Args[1])))' foobar
  Zm9vYmFy

dolmen|4 months ago

Many of this utilities are bundled with the "openssl" tool:

  $ echo -n foobar | openssl base64 -e
  Zm9vYmFy

baq|4 months ago

You can send a heredoc into as in a single line of shell, too.