Skip to content

Instantly share code, notes, and snippets.

@S1M0N38
Last active September 15, 2018 00:42
Show Gist options
  • Save S1M0N38/46e4952a1389ffa4eee9cc8356c3ac7c to your computer and use it in GitHub Desktop.
Save S1M0N38/46e4952a1389ffa4eee9cc8356c3ac7c to your computer and use it in GitHub Desktop.
wisdom dispenser πŸ§™β€β™‚οΈ
# -*- coding: utf-8 -*-
import random
try:
from urllib.request import urlopen
except ImportError:
from urllib2 import urlopen
url = 'https://raw.githubusercontent.com/AntJanus/programmers-proverbs/master/README.md'
response = urlopen(url)
html = response.read()
html = html.decode('utf-8')
proverbs = []
for line in html.split('\n'):
if line.startswith('#### '):
proverbs.append(line[5:])
proverb = random.choice(proverbs)
print('\n πŸš€ {}\n'.format(proverb))
@S1M0N38
Copy link
Author

S1M0N38 commented Sep 5, 2018

Installation

  • move to $HOME directory cd
  • clone gist git clone https://gist.github.com/46e4952a1389ffa4eee9cc8356c3ac7c.git proverbs
  • add python $HOME/proverbs/proverbs.py in your ~/.bashrc

if you have an alternative shell like zsh or fish, python $HOME/proverbs/proverbs.py must be put in ~/.zshrc or in ~/.config/fish/config.fish


preview

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment