Skip to content

Instantly share code, notes, and snippets.

View wolfdale's full-sized avatar

Prakhar Gupta wolfdale

View GitHub Profile
@wolfdale
wolfdale / gist:e00e217afa4375a7d4334ff7bbd19541
Created June 4, 2016 09:55
Tells you TOP 10 commands from 'history'
from collections import Counter
command_list = []
with open ("history.txt",'r') as file_obj:
for line in file_obj:
temp = line.split(' ')
if temp[2] == '':
command_list.append(temp[3].strip())
else:
command_list.append(temp[4].strip())
<script src="https://gist.github.com/b9bfb3541d3d5f831b6f.js"></script>
<noscript><pre><code>
File: YouTubeMP3DownloadScript.py
---------------------------------
import pafy
#warning supress
import logging
logging.getLogger().setLevel(logging.ERROR)
import matplotlib.pyplot as plt
import random
random.seed(5) #with same seed the random function gives same result everytime
for i in range(1,1000):
random.getstate()
x=random.randint(1,1000)
y=random.randint(1,1000)
plt.scatter(x,y)
plt.show()
@wolfdale
wolfdale / YouTubeMP3DownloadScript.py
Created September 6, 2015 14:46
Downloading YouTube Videos as MP3 Audio
import pafy
#warning supress
import logging
logging.getLogger().setLevel(logging.ERROR)
with open('song.txt','r') as file:
for url in file:
video = pafy.new(url)
#audiostreams = video.audiostreams
bestaudio = video.getbestaudio()
bestaudio.download()
@wolfdale
wolfdale / Shoot_namenode
Created March 3, 2015 06:42
Troubleshoot NameNode
Problem Starting Namenode
Follow These TroubleShooting Tips:
1)Format NameNode
/bin/hadoop namenode -format
NOTE:-Do not format a running Hadoop filesystem as you will lose all the data currently in the cluster (in HDFS)!
2)Port is not available for namenode to bind itself (check logs or use command -netstat to check ports )
Port address are specified in core-site.xml, change the port address