Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ruanyf/fortunes
A collection of fortune database files for Chinese users.
https://github.com/ruanyf/fortunes
Last synced: 13 days ago
JSON representation
A collection of fortune database files for Chinese users.
- Host: GitHub
- URL: https://github.com/ruanyf/fortunes
- Owner: ruanyf
- Created: 2015-04-12T04:28:03.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2021-08-13T07:13:08.000Z (about 3 years ago)
- Last Synced: 2024-08-01T15:09:10.643Z (3 months ago)
- Homepage:
- Size: 3.13 MB
- Stars: 340
- Watchers: 12
- Forks: 84
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## What is Fortune?
Fortune is a simple Unix program that displays a random message from a database of quotations.
```
$ fortune"What we see is mainly what we look for."
~Unknown
```This repo contains some fortune database files, especially useful for Chinese user.
- fortunes: quotes in English, 5437 items
- chinese: quotes in Chinese, 25919 items
- tang300: poems of Tang Dynasty in Chinese, 313 items
- song100: poems of Song Dynasty in Chinese, 95 items
- diet: diet proverbs in Chinese, 123 items## Screenshot
![](./screenshot.png)
## Install
First install [fortune package](http://linux.die.net/man/6/fortune). If your computer has already installed it, skip this step.
```bash
# Debian/Ubuntu
$ sudo apt-get install fortune# Mac
$ brew install fortune
```Then install the repo.
```bash
# Debian/Ubuntu
$ git clone [email protected]:ruanyf/fortunes.git
$ sudo mv fortunes/data/* /usr/share/games/fortunes/# Mac
$ git clone [email protected]:ruanyf/fortunes.git
$ strfile fortunes/data/fortunes
$ strfile fortunes/data/chinese
$ strfile fortunes/data/tang300
$ strfile fortunes/data/song100
$ strfile fortunes/data/diet
$ mv fortunes/data/* /usr/local/share/games/fortunes/
```## Usage
```bash
$ fortune [OPTIONS] [/path/to/fortunes]
```Options
```
- -c Show the cookie file from which the fortune came.
- -f Print out the list of files which would be searched, but don't print a fortune.
- -e Consider all fortune files to be of equal size.
```Example of `-c`
```bash
$ fortune -c(fortunes)
%
"Don't waste life in doubts and fears."
~Ralph Waldo Emerson
```Example of `-f`
```bash
$ fortune -f100.00% /usr/share/games/fortunes
17.21% fortunes
81.51% chinese
0.98% tang300
0.30% song100
```Example of `-e`
```bash
$ fortune -e chinese fortunes
# is equivalent to
$ fortune 50% chinese 50% fortunes$ fortune -e chinese fortunes tang300 song100
# is equivalent to
$ fortune 25% chinese 25% fortunes 25% tang300 25% song100
```## How to automatically launch fortune when opening a shell window
Depending on which shell you use, at the end of your `~/.bashrc` or `~/.zshrc` file, copy the following lines into it.
```bash
echo
echo "=============== Quote Of The Day ==============="
echo
fortune
echo
echo "================================================"
echo
```## How to make your own fortune database file
(1) Write your fortune items into a file.
(2) Append a percent sign (%) after each item. The percent sign should take a new line. The following is an example.
```
A day for firm decisions!!!!! Or is it?
%
A few hours grace before the madness begins again.
%
A gift of a flower will soon be made to you.
%
A long-forgotten loved one will appear soon.Buy the negatives at any price.
%
A tall, dark stranger will have more fun than you.
```(3) Generate the index file.
```bash
strfile -c % your-fortune-file your-fortune-file.dat
```(4) Move the fortune file and its index file into `/usr/share/games/fortunes/`.
## License
BSD licensed