Skip to content

Commit e20a10a

Browse files
committed
Almost ready for ship!
1 parent a6806e9 commit e20a10a

File tree

4 files changed

+120
-11
lines changed

4 files changed

+120
-11
lines changed

.goreleaser.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
before:
2+
hooks:
3+
- go mod download
4+
builds:
5+
- env:
6+
- CGO_ENABLED=0
7+
goos:
8+
- freebsd
9+
- windows
10+
- darwin
11+
- linux
12+
goarch:
13+
- amd64
14+
- arm
15+
- arm64
16+
- 386
17+
ldflags:
18+
- -s -w
19+
ignore: # problems with build https://github.com/golang/go/issues/39033
20+
- goos: darwin
21+
goarch: arm64
22+
archives:
23+
- replacements:
24+
darwin: Darwin
25+
linux: Linux
26+
windows: Windows
27+
386: 32-bit
28+
amd64: x86_64
29+
format_overrides:
30+
- goos: windows
31+
format: zip
32+
checksum:
33+
name_template: 'checksums.txt'
34+
snapshot:
35+
name_template: "{{ .Tag }}-next"
36+
changelog:
37+
sort: asc
38+
filters:
39+
exclude:
40+
- '^docs:'
41+
- '^test:'
42+
brews:
43+
-
44+
# Repository to push the tap to.
45+
tap:
46+
owner: quackduck
47+
name: homebrew-tap
48+
49+
homepage: 'https://github.com/quackduck/aces'
50+
51+
description: 'Encode in a character set of your choice'

README.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Aces
2+
3+
[comment]: <> (**A**ny **C**haracter **E**ncoding **S**et)
4+
Any Character Encoding Set
5+
6+
Aces is a command line utility that lets you encode any file to a character set of your choice.
7+
8+
For example, you could encode "Foo Bar" to a combination of these four characters: "HhAa", resulting in this ~~hilarious~~ sequence of laughs:
9+
```text
10+
hHhAhAaahAaaHAHHhHHAhAHhhaHA
11+
```
12+
With Aces installed, you can actually do that with:
13+
```shell
14+
$ echo -n "Foo Bar" | aces HhAa
15+
hHhAhAaahAaaHAHHhHHAhAHhhaHA
16+
```
17+
This was the original use of Aces (it was called `ha`, increased data size by 4X and had no decoder)
18+
19+
If you're on macOS, you can even convert that output to speech:
20+
```shell
21+
$ echo -n "Matthew Stanciu" | aces HhAa | say
22+
```
23+
24+
With Aces, you can see the actual 0s and 1s of files:
25+
```shell
26+
$ aces 01 < $(which echo)
27+
```
28+
You can also write hex/octal/binary/your own format by hand:
29+
```shell
30+
$ echo C2A7 | aces -d 0123456789ABCDEF
31+
$ echo .+=. | aces -d ./+= # try this!
32+
```
33+
34+
## Installing
35+
36+
### macOS or Linux with linuxbrew
37+
```shell
38+
brew install quackduck/tap/aces
39+
```
40+
41+
### Other platforms
42+
Head over to [releases](https://github.com/quackduck/aces/releases) and download the latest binary!

aces.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ func main() {
4646
}
4747
decode = os.Args[1] == "--decode" || os.Args[1] == "-d"
4848
if decode {
49+
if len(os.Args) == 2 {
50+
fmt.Fprintln(os.Stderr, "error: need character set\n"+helpMsg)
51+
os.Exit(1)
52+
}
4953
encodeHaHa = []rune(os.Args[2])
5054
} else {
5155
encodeHaHa = []rune(os.Args[1])

build.sh

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,25 @@
11
#!/usr/bin/env bash
2+
set -e
23
go install
3-
if [ "$(echo "heyheya " | aces 0123456789ABCDEF)" = "68657968657961200A" ]; then
4-
echo passed hex conversion
5-
else
6-
echo you stupid idiot the test failed
7-
fi
8-
9-
if diff <(aces 0123456789ABCDEF < "$(which bash)" | aces -d 0123456789ABCDEF) "$(which bash)"; then
10-
echo whoa man, even the huge binary check worked
11-
else
12-
echo you stupid idiot the binary check failed
13-
fi
4+
#if [ "$(echo "heyheya " | aces 0123456789ABCDEF)" = "68657968657961200A" ]; then
5+
# echo passed hex conversion
6+
#else
7+
# echo you stupid idiot the test failed
8+
#fi
9+
10+
[ "$(echo "heyheya " | aces 0123456789ABCDEF)" = "68657968657961200A" ] || echo HEX CHECK FAILED, slap the programmer
11+
12+
#if diff <(aces 0123456789ABCDEF < "$(which bash)" | aces -d 0123456789ABCDEF) "$(which bash)"; then
13+
# echo whoa man, even the huge binary check worked
14+
#else
15+
# echo you stupid idiot the binary check failed
16+
#fi
17+
18+
diff <(aces 0123456789ABCDEF < "$(which bash)" | aces -d 0123456789ABCDEF) "$(which bash)" || echo big binary check failed, slap the programmer
19+
20+
echo hello world | aces "<>(){}[]" | aces --decode "<>(){}[]" > /dev/null || echo example 1 failed
21+
echo matthew stanciu | aces HhAa > /dev/null || echo example 2 failed
22+
aces " X" < /bin/echo > /dev/null || echo example 3 failed
23+
echo 0100100100100001 | aces -d 01 | aces 01234567 > /dev/null || echo example 4 failed
24+
echo Calculus | aces 01 > /dev/null || echo example 5 failed
25+
echo "Aces™" | base64 | aces -d ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ > /dev/null || echo example 6 failed

0 commit comments

Comments
 (0)