Last active
February 20, 2017 09:57
-
-
Save ninenine/1a016a290b3a8a7bdda30550e41c9473 to your computer and use it in GitHub Desktop.
Bash History Word Cloud
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import pandas as pd | |
import matplotlib.pyplot as plt | |
from wordcloud import WordCloud, STOPWORDS | |
data = pd.read_table('~/.bash_history', header = None, names=["CMD"]) | |
exclude_words = [] | |
exclude_words.extend(STOPWORDS) | |
words = ''.join(data['CMD']) | |
wordcloud = WordCloud( | |
stopwords=set(exclude_words), | |
background_color='black', | |
width=4096, | |
height=2160 | |
).generate(words) | |
plt.imshow(wordcloud) | |
plt.axis("off") | |
plt.savefig('./bash_word_cloud.png', dpi=1000) | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment