Skip to content

Commit

Permalink
Almost ready for ship!
Browse files Browse the repository at this point in the history
  • Loading branch information
quackduck committed Aug 16, 2021
1 parent a6806e9 commit e20a10a
Show file tree
Hide file tree
Showing 4 changed files with 120 additions and 11 deletions.
51 changes: 51 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
before:
hooks:
- go mod download
builds:
- env:
- CGO_ENABLED=0
goos:
- freebsd
- windows
- darwin
- linux
goarch:
- amd64
- arm
- arm64
- 386
ldflags:
- -s -w
ignore: # problems with build https://github.com/golang/go/issues/39033
- goos: darwin
goarch: arm64
archives:
- replacements:
darwin: Darwin
linux: Linux
windows: Windows
386: 32-bit
amd64: x86_64
format_overrides:
- goos: windows
format: zip
checksum:
name_template: 'checksums.txt'
snapshot:
name_template: "{{ .Tag }}-next"
changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'
brews:
-
# Repository to push the tap to.
tap:
owner: quackduck
name: homebrew-tap

homepage: 'https://github.com/quackduck/aces'

description: 'Encode in a character set of your choice'
42 changes: 42 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Aces

[comment]: <> (**A**ny **C**haracter **E**ncoding **S**et)
Any Character Encoding Set

Aces is a command line utility that lets you encode any file to a character set of your choice.

For example, you could encode "Foo Bar" to a combination of these four characters: "HhAa", resulting in this ~~hilarious~~ sequence of laughs:
```text
hHhAhAaahAaaHAHHhHHAhAHhhaHA
```
With Aces installed, you can actually do that with:
```shell
$ echo -n "Foo Bar" | aces HhAa
hHhAhAaahAaaHAHHhHHAhAHhhaHA
```
This was the original use of Aces (it was called `ha`, increased data size by 4X and had no decoder)

If you're on macOS, you can even convert that output to speech:
```shell
$ echo -n "Matthew Stanciu" | aces HhAa | say
```

With Aces, you can see the actual 0s and 1s of files:
```shell
$ aces 01 < $(which echo)
```
You can also write hex/octal/binary/your own format by hand:
```shell
$ echo C2A7 | aces -d 0123456789ABCDEF
$ echo .+=. | aces -d ./+= # try this!
```

## Installing

### macOS or Linux with linuxbrew
```shell
brew install quackduck/tap/aces
```

### Other platforms
Head over to [releases](https://github.com/quackduck/aces/releases) and download the latest binary!
4 changes: 4 additions & 0 deletions aces.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ func main() {
}
decode = os.Args[1] == "--decode" || os.Args[1] == "-d"
if decode {
if len(os.Args) == 2 {
fmt.Fprintln(os.Stderr, "error: need character set\n"+helpMsg)
os.Exit(1)
}
encodeHaHa = []rune(os.Args[2])
} else {
encodeHaHa = []rune(os.Args[1])
Expand Down
34 changes: 23 additions & 11 deletions build.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,25 @@
#!/usr/bin/env bash
set -e
go install
if [ "$(echo "heyheya " | aces 0123456789ABCDEF)" = "68657968657961200A" ]; then
echo passed hex conversion
else
echo you stupid idiot the test failed
fi

if diff <(aces 0123456789ABCDEF < "$(which bash)" | aces -d 0123456789ABCDEF) "$(which bash)"; then
echo whoa man, even the huge binary check worked
else
echo you stupid idiot the binary check failed
fi
#if [ "$(echo "heyheya " | aces 0123456789ABCDEF)" = "68657968657961200A" ]; then
# echo passed hex conversion
#else
# echo you stupid idiot the test failed
#fi

[ "$(echo "heyheya " | aces 0123456789ABCDEF)" = "68657968657961200A" ] || echo HEX CHECK FAILED, slap the programmer

#if diff <(aces 0123456789ABCDEF < "$(which bash)" | aces -d 0123456789ABCDEF) "$(which bash)"; then
# echo whoa man, even the huge binary check worked
#else
# echo you stupid idiot the binary check failed
#fi

diff <(aces 0123456789ABCDEF < "$(which bash)" | aces -d 0123456789ABCDEF) "$(which bash)" || echo big binary check failed, slap the programmer

echo hello world | aces "<>(){}[]" | aces --decode "<>(){}[]" > /dev/null || echo example 1 failed
echo matthew stanciu | aces HhAa > /dev/null || echo example 2 failed
aces " X" < /bin/echo > /dev/null || echo example 3 failed
echo 0100100100100001 | aces -d 01 | aces 01234567 > /dev/null || echo example 4 failed
echo Calculus | aces 01 > /dev/null || echo example 5 failed
echo "Aces™" | base64 | aces -d ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ > /dev/null || echo example 6 failed

0 comments on commit e20a10a

Please sign in to comment.