GithubHelp home page GithubHelp logo

wiki-welcome's Introduction

wiki-welcome

This repo uses material from Wikipedia, which is released under the Creative Commons Attribution-Share-Alike License 3.0. Respective authorship can be found on the page of each article.

A welcome banner for your shell which selects a few lines from a random Wikipedia article.

I include all Level-5 Vital Wikipedia articles so the topics won't be unimportant.

To install:

git clone --depth=1 https://github.com/chapmanjacobd/wiki-welcome/ ~/bin/wiki-welcome/

Fish

function fish_greeting
    cat /proc/loadavg | cut -d' ' -f 2
    set article (/usr/bin/ls -p  ~/bin/wiki-welcome/articles/ |grep -v / | shuf -n 1)
    set articleURL (string replace '.txt' '' $article)
    set_color -o -u
    echo (string replace '_' ' ' (string unescape --style=url $articleURL)) | sed 's/.*/\L&/; s/[a-z]*/\u&/g' | sed -E 's/ (The|A|Of|I[sn]|For)\b/\L&/g'
    echo "https://en.wikipedia.org/wiki/$articleURL"
    set_color normal
    head -c500 ~/bin/wiki-welcome/articles/$article | cowthink -W 78 -f tux
end

Alternatively, for more randomness you can change head to shuf like this:

shuf -n7 ~/bin/wiki-welcome/articles/$article | cowthink -W 78 -f tux

PRs are welcome. Originally I only had a random 800 articles but following a tip from @_WaylonWalker I found that I could include all 32,000 articles if I only include the top 500 words. Originally this would have required 1300MB which is far too big but now it is only 139MB.

wiki-welcome's People

Contributors

chapmanjacobd avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

wiki-welcome's Issues

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.