This project is to collect fun quotes from/by/to Vietnamese developers. Let's make our tough life fun.
Follow https://twitter.com/fortune_vn. This channel is updated by a bot developed and maintained by @tentamen.
Without installing the project file locally, you may need curl
, awk
and sed
tools to get a random quote:
$ curl -Lso- https://raw.githubusercontent.com/icy/fortune-vn/master/fortune-vn \
| awk '{if($0 == "%") {printf("\n");} else { printf("%s<|>", $0); }}' \
| shuf -n 1 \
| sed -e 's#<|>$##g' -e "s#<|>#\\n#g"
This one-liner can be found here and you can download and execute it:
$ curl -Lso- https://raw.githubusercontent.com/icy/fortune-vn/master/bin/oneliner.sh \
| bash
You can even provide cowsay
options to this one-liner. For example to
specify column width:
$ curl -Lso- https://raw.githubusercontent.com/icy/fortune-vn/master/bin/oneliner.sh \
| COWSAY="-W 80" bash
We compile a stable version of all quotes in the file fortune-vn
.
You generate a binary form for this file as below
$ strfile -c "%" fortune
New file fortune-vn.dat
will be created and you can use them:
$ fortune fortune-vn
You can pipe output from fortune
to cowsay
:
$ fortune fortune-vn | cowsay
cowsay
is not maintained anymore. On some distribution (e.g, ArchLinux
)
the program may not handle utf-8
strings correctly. If that's the case,
please install coway
from this repository
https://github.com/icyfork/rank-amateur-cowsay
The whole fortune-vn
data can be used in a single Dlang
binary program.
If you have dlang
and dub
installed, please compile the program
$ dub build -b release fortune-vn
New file binary is created at ./bin/fortune-vn
. The speed is good:
$ time fortune fortune-vn
real 0m0.012s
user 0m0.008s
sys 0m0.004s
$ time ./bin/fortune-vn
real 0m0.004s
user 0m0.005s
sys 0m0.000s
WIP. Stay tuned. Here is our TODO list.
- Compiling
data/*
tofortune(6)
data format so you can see our cookies from your terminal, e.g,fortune
- Having an useful
cli
tool to get random quote from our data set. - Having a simple
API
to generate quote :) - Collecting the first 1k quotes :)
Important: Never commit your changes for fortune-vn
. This file should
be stable and maintained by release engineer.
- Take a look at our simple notes
- Create a custom file under
data/
. For example, data/ngoctrinh.txt - Add quotes there. Use
%
between quotes. - Feel free to add link to the quote. Use http://web.archive.org/ if possible.
The maintainer's environment consists of Ruby
, fortune-mod
and make
programs. Type make all
to compile all things and see a random quote.
Feel free to take a look at the sample Makefile.