Skip to content

Instantly share code, notes, and snippets.

@ninenine
Last active February 20, 2017 09:57
Show Gist options
  • Save ninenine/1a016a290b3a8a7bdda30550e41c9473 to your computer and use it in GitHub Desktop.
Save ninenine/1a016a290b3a8a7bdda30550e41c9473 to your computer and use it in GitHub Desktop.
Bash History Word Cloud
#!/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