Giter VIP home page Giter VIP logo

fortunes's Introduction

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

Install

First install fortune package. If your computer has already installed it, skip this step.

# Debian/Ubuntu
$ sudo apt-get install fortune

# Mac
$ brew install fortune

Then install the repo.

# 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

$ 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

$ fortune -c

(fortunes)
%
"Don't waste life in doubts and fears."
  ~Ralph Waldo Emerson

Example of -f

$ fortune -f

100.00% /usr/share/games/fortunes
    17.21% fortunes
    81.51% chinese
     0.98% tang300
     0.30% song100

Example of -e

$ 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.

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.

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

fortunes's People

Contributors

acntwww avatar akuma avatar davidy22 avatar henryhu avatar huqi avatar koogoo avatar laggardkernel avatar liaozd avatar noname007 avatar ruanyf avatar sgrimm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fortunes's Issues

show Chinese data wrong with brew on OSX

$ brew -v
Homebrew 0.9.5

$ brew info fortune
fortune: stable 9708 (bottled)
http://ftp.ibiblio.org/pub/linux/games/amusements/fortune/!INDEX.html
/usr/local/Cellar/fortune/9708 (122 files, 7.0M) *
Poured from bottle
From: https://github.com/Homebrew/homebrew/blob/master/Library/Formula/fortune.rb
==> Options
--without-offensive
Don't install potentially offensive fortune files

Reproduce steps:
1, brew install fortunes.
2, git clone ...
3, mv data to /usr/local/share/games/fortunes
4, fortune -e fortunes chinese tang300 song100
5, fortune

Output:
fortune will output English data right.
but seems output all Chinese content with '%'.

整理英文 fortunes

我将那个包含英文箴言的文件 fortunes 重新整理了一下放在这了:
https://github.com/jakwings/cookies (misc)

主要是去除不影响韵律的强制换行(改由 fold --width=N 自动处理),移除 Unknown 之类比较没意义的来源说明,去重,改善标点和统一排版。若是有需要我可以发个 PR。也对中文内容做了类似整理,不过没上传。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.