• Stars
    star
    335
  • Rank 123,487 (Top 3 %)
  • Language
  • Created over 9 years ago
  • Updated almost 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A collection of fortune database files for Chinese users.

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

More Repositories

1

weekly

科技爱好者周刊,每周五发布
33,058
star
2

es6tutorial

《ECMAScript 6入门》是一本开源的 JavaScript 语言教程,全面介绍 ECMAScript 6 新增的语法特性。
JavaScript
20,881
star
3

jstraining

全栈工程师培训材料
18,959
star
4

react-demos

a collection of simple demos of React.js
JavaScript
16,171
star
5

free-books

互联网上的免费书籍
13,692
star
6

document-style-guide

中文技术文档的写作规范
10,968
star
7

webpack-demos

a collection of simple demos of Webpack
JavaScript
9,588
star
8

jstutorial

Javascript tutorial book
CSS
5,421
star
9

simple-bash-scripts

A collection of simple Bash scripts
Shell
1,415
star
10

reading-list

Some books I read
1,309
star
11

react-babel-webpack-boilerplate

a boilerplate for React-Babel-Webpack project
JavaScript
1,154
star
12

articles

personal articles
921
star
13

loppo

an extremely easy static site generator of markdown documents
JavaScript
707
star
14

wechat-miniprogram-demos

微信小程序教程库
599
star
15

book-computer-networks

Free E-Book: Computer Networks - A Systems Approach
596
star
16

koa-demos

A collection of simple demos of Koa
485
star
17

extremely-simple-flux-demo

Learn Flux from an extremely simple demo
JavaScript
442
star
18

css-modules-demos

a collection of simple demos of CSS Modules
JavaScript
395
star
19

survivor

博客文集《未来世界的幸存者》
CSS
325
star
20

chrome-extension-demo

how to create a Chrome extension
JavaScript
302
star
21

node-oauth-demo

A very simple demo of OAuth2.0 using node.js
JavaScript
301
star
22

mocha-demos

a collection of simple demos of Mocha
JavaScript
254
star
23

tiny-browser-require

A tiny, simple CommonJS require() implemetation in browser-side
JavaScript
237
star
24

react-testing-demo

A tutorial of testing React components
JavaScript
214
star
25

road

博客文集《前方的路》
CSS
150
star
26

sina-news

新浪全球实时新闻
JavaScript
133
star
27

github-actions-demo

a demo of GitHub actions for a simple React App
JavaScript
132
star
28

weather-action

An example of GitHub Actions
Shell
107
star
29

user-tracking-demos

demos of tracking users with JavaScript
JavaScript
90
star
30

travis-ci-demo

A beginner tutorial of Travis CI for Node projects
75
star
31

openrecord-demos

an ORM tutorial for nodejs
73
star
32

website

HTML
63
star
33

markdown-it-image-lazy-loading

a markdown-it plugin supporting Chrome 75's native image lazy-loading
JavaScript
54
star
34

flux-todomvc-demo

A simplified version of Flux's official TodoMVC demo
CSS
49
star
35

Google-Calendar-Lite

A single-page webapp of Google Calendar, based on its API.
CSS
41
star
36

nilka

a command-line utility to resize images in batches
JavaScript
39
star
37

webpack-static-site-demo

a demo of generating a static site with React, React-Router, and Webpack
JavaScript
32
star
38

turpan

a wrapped markdown renderer based on markdown-it
JavaScript
27
star
39

hn

A personalized Hacker News
JavaScript
26
star
40

koa-simple-server

A simple koa server demo of logging HTTP request Headers and body
JavaScript
25
star
41

rpio-led-demo

controlling an LED with Raspberry Pi's GPIO
JavaScript
25
star
42

jekyll_demo

A very simple demo of Jekyll
22
star
43

node-systemd-demo

run a Node app as a daemon with Systemd
JavaScript
20
star
44

lvv2-feed

Lvv2.com's RSS feed
JavaScript
16
star
45

blog-stylesheet

my blog's stylesheet
CSS
14
star
46

loppo-theme-oceandeep

the default theme of Loppo
JavaScript
13
star
47

tarim

a template engine, using Lodash's template syntax and supporting including other templates
JavaScript
13
star
48

loppo-theme-ryf

个人网站的 Loppo 主题
CSS
11
star
49

Formula-Online-Generator

using Google Chart api to generate mathematical formulas in a webpage
10
star
50

turpan-remove-space

remove the space between English word and Chinese characters in markdown files
JavaScript
9
star
51

eslint-plugin-ignoreuglify

exclude uglified files from ESLint's linting
JavaScript
3
star
52

slides

JavaScript
3
star