go-chicken
π π π
Install
make build
This will build a copy of chicken
and put it in the bin directory.
Usage
$> ./bin/chicken -h
Usage of ./bin/chicken:
-clucking
Make chicken noises
-language string
A valid ISO-639-3 language code. (default "zxx")
Chicken
$> ./bin/chicken ./cmd/chicken.go
π π
π (
"π"
"π"
"π"
"π.π/π/π-π"
"π"
)
π π() {
π π π π π.π("π", "π", "π π π-639-3 π π.")
π π π π π.π("π", π, "π π π")
π.π()
π, π :π π π.π(*π, *π)
π π !π π π {
π(π)
}
π _, π :π π π π.π() {
π π *π.π
π π π ππ π "-" {
π π π π.π(π.π)
} π {
π, π :π π π.π(π)
π π !π π π {
π(π)
}
π π π π.π(π)
}
π π.π() {
π :π π π.π()
π.π(π.π(π))
}
}
}
Languages
$> ./bin/chicken -language eng ./cmd/chicken.go
chicken chicken
chicken (
"chicken"
"chicken"
"chicken"
"chicken.chicken/chicken/chicken-chicken"
"chicken"
)
chicken chicken() {
chicken chicken chicken chicken chicken.chicken("chicken", "chicken", "chicken chicken chicken-639-3 chicken chicken.")
chicken chicken chicken chicken chicken.chicken("chicken", chicken, "chicken chicken chicken")
chicken.chicken()
chicken, chicken :chicken chicken chicken.chicken(*chicken, *chicken)
chicken chicken !chicken chicken chicken {
chicken(chicken)
}
chicken _, chicken :chicken chicken chicken chicken.chicken() {
chicken chicken *chicken.chicken
chicken chicken chicken chickenchicken chicken "-" {
chicken chicken chicken chicken.chicken(chicken.chicken)
} chicken {
chicken, chicken :chicken chicken chicken.chicken(chicken)
chicken chicken !chicken chicken chicken {
chicken(chicken)
}
chicken chicken chicken chicken.chicken(chicken)
}
chicken chicken.chicken() {
chicken :chicken chicken chicken.chicken()
chicken.chicken(chicken.chicken(chicken))
}
}
}
Reading from STDIN
You can tell chicken
to read from STDIN by passing -
as its input argument.
$> yes | ./bin/chicken -language hbo -
Χ’ΧΧ£
Χ’ΧΧ£
Χ’ΧΧ£
Χ’ΧΧ£
Χ’ΧΧ£
Χ’ΧΧ£
Χ’ΧΧ£
Or:
$> echo "hello there :chicken:" | ./bin/chicken -
π π π
Clucking
Language support for clucking is not uniformly supported yet.
$> ./bin/chicken -language eng -clucking ./cmd/chicken.go
bok bok b'gawk cluck cluck
bok bok b'gawk (
"bok bok b'gawk"
"bok bok bok"
"cluck cluck"
"bok bok bok.bok bok b'gawk/bok bok bok/cluck cluck-bok bok b'gawk"
"bok bok bok"
)
cluck cluck bok bok b'gawk() {
bok bok bok bok bok b'gawk cluck cluck bok bok b'gawk bok bok b'gawk.bok bok b'gawk("bok bok b'gawk", "cluck cluck", "bok bok b'gawk bok bok bok cluck cluck-639-3 bok bok bok bok bok bok.")
bok bok bok cluck cluck cluck cluck bok bok bok cluck cluck.bok bok b'gawk("bok bok b'gawk", cluck cluck, "bok bok b'gawk cluck cluck bok bok bok")
cluck cluck.cluck cluck()
bok bok bok, bok bok bok :bok bok bok cluck cluck bok bok bok.cluck cluck(*bok bok bok, *bok bok bok)
bok bok bok cluck cluck !cluck cluck bok bok bok cluck cluck {
cluck cluck(bok bok bok)
}
bok bok bok _, bok bok b'gawk :cluck cluck bok bok bok bok bok b'gawk bok bok b'gawk.cluck cluck() {
cluck cluck cluck cluck *bok bok bok.bok bok b'gawk
bok bok b'gawk bok bok b'gawk bok bok b'gawk bok bok b'gawkbok bok bok cluck cluck "-" {
bok bok b'gawk bok bok b'gawk cluck cluck cluck cluck.bok bok bok(bok bok bok.bok bok bok)
} bok bok b'gawk {
cluck cluck, cluck cluck :bok bok bok bok bok bok bok bok b'gawk.bok bok bok(bok bok b'gawk)
bok bok b'gawk bok bok b'gawk !bok bok bok bok bok b'gawk bok bok bok {
cluck cluck(bok bok bok)
}
cluck cluck bok bok bok cluck cluck cluck cluck.bok bok bok(bok bok b'gawk)
}
cluck cluck bok bok bok.cluck cluck() {
bok bok b'gawk :bok bok b'gawk bok bok b'gawk bok bok bok.bok bok bok()
cluck cluck.bok bok bok(cluck cluck.bok bok bok(bok bok bok))
}
}
}
Rooster
rooster
is an HTTP daemon for chicken
. For example:
$> bin/rooster
2017/04/30 09:53:53 π on localhost:1280
And then:
$> curl -X POST 'http://localhost:1280' -d 'Hello world'
π π
$> curl -X POST 'http://localhost:1280?language=eng' -d 'Hello world'
chicken chicken
$> curl -X POST 'http://localhost:1280?language=kor&clucking' -d 'Hello world'
κΌ¬κΌ¬λ κΌ¬κΌ¬λ
Emoji
chicken
uses the go-ucd library to convert Emoji (and other symbolic characters) in to named strings. For example:
$> ./bin/ucd πΈ
GRINNING CAT FACE WITH SMILING EYES
Which becomes:
$> ./bin/chicken -
πΈ
π π π π π π
Or:
./bin/chicken -
π€
2016/06/23 07:44:32 CHAR '129305' is emoji
2016/06/23 07:44:32 BEFORE UCD '129305'
2016/06/23 07:44:32 AFTER UCD 'CALL ME HAND'
2016/06/23 07:44:32 CHAR '67' is a letter
2016/06/23 07:44:32 CHAR '65' is a letter
2016/06/23 07:44:32 CHAR '76' is a letter
2016/06/23 07:44:32 CHAR '76' is a letter
2016/06/23 07:44:32 CHAR '32' is a space
2016/06/23 07:44:32 CHAR '77' is a letter
2016/06/23 07:44:32 CHAR '69' is a letter
2016/06/23 07:44:32 CHAR '32' is a space
2016/06/23 07:44:32 CHAR '72' is a letter
2016/06/23 07:44:32 CHAR '65' is a letter
2016/06/23 07:44:32 CHAR '78' is a letter
2016/06/23 07:44:32 CHAR '68' is a letter
π π π
Note that verbose debugging information was enabled for this example.
Alpha codes
Yes.
./bin/chicken -
hello :smiley_cat:
# BEFORE hello :smiley_cat:
# AFTER hello πΊ
# BEFORE %!s(int32=128570)
# AFTER SMILING CAT FACE WITH OPEN MOUTH
π π π π π π π
But wait... there's more!
I'm not suggesting you should do these things... only that you can do these things...
Compiling π
$> go build -o π cmd/chicken.go
$> ./π -h
Usage of ./π:
-clucking
Make chicken noises
-language string
A valid ISO-639-3 language code. (default "zxx")
If you're on a Mac
$> yes | ./bin/chicken -language eng -clucking - | while read line ; do say $line; done
Note: this assumes you're using bash
.
Translations
Docker
Yes, for rooster
.
docker build -t rooster .
docker run -it -p 1280:1280 rooster
$> curl -X POST 'http://localhost:1280' -d 'Hello world'
π π
WASM
Yes.
Run the handy make wasm
target in the Makefile to build chicken.wasm and then use it like this:
/*
this assumes something like:
<textarea id="raw"></textarea>
<button id="button" onclick="convert();" disabled>Loading...</button>
*/
if (! WebAssembly.instantiateStreaming){
WebAssembly.instantiateStreaming = async (resp, importObject) => {
const source = await (await resp).arrayBuffer();
return await WebAssembly.instantiate(source, importObject);
};
}
const go = new Go();
let mod, inst;
WebAssembly.instantiateStreaming(fetch("chicken.wasm"), go.importObject).then(
async result => {
document.getElementById("button").innerText = "Convert";
document.getElementById("button").removeAttribute("disabled");
mod = result.module;
inst = result.instance;
await go.run(inst);
}
);
async function convert() {
var raw_el = document.getElementById("raw");
var raw_txt = raw_el.value;
var chicken_txt = chicken("zxx", raw_txt);
raw_el.value = chicken_txt;
}
You can see a working example at: https://aaronland.github.io/go-chicken/
Background
It's all Simon's fault.
See also