Skip to content

Commit 78a0965

Browse files
author
rishabhiitbhu
committed
Type racer speed plot script added
1 parent 7f7bb1c commit 78a0965

File tree

2 files changed

+45
-13
lines changed

2 files changed

+45
-13
lines changed

README.md

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,38 +2,46 @@
22

33
This repository contains my code scripts to automate boring stuff around me.
44

5-
## `WhatsApp_img_notes_extractor`
5+
### `WhatsApp_img_notes_extractor`
66

77
Code to extract study notes from WhatsApp Images folder. I've trained a Convolutional Neural Network model to predict such images and extract them out of WhatsApp Images directory.
88

9-
## `auto_lan_auth`
9+
### `devrant.py`
10+
11+
A Python script to send notifications when you hit a given number of "++"s on [devrant](devrant.com) (requires `BeautifulSoup`)
12+
13+
### `typeracer_plot.py`
14+
15+
A Python script to plot [typeracer](typeracer.com) speed statistics of a given user. (requires `Matplotlib` and `BeautifulSoup` )
16+
17+
### `auto_lan_auth`
1018

1119
A Python script to automate the LAN Authentication process on IIT (BHU) campus.
1220

13-
## `get_bhu_mails.py`
21+
### `get_bhu_mails.py`
1422

1523
A python script to get the emails of all the professors of Banaras Hindu University.
1624

1725
Just run `get_bhu_mails.py` and it will crawl the contact section of BHU website, download all the docs containing details of every department, then use regex to get the emails out and paste it in results.txt.
1826

19-
## `csv_to_vcf.py`
27+
### `csv_to_vcf.py`
2028

21-
A python script to create a vcf file using data (name and phone-number) stored in a csv file.
29+
A python script to create a VCF file using data (name and phone-number) stored in a CSV file.
2230

23-
## `hackerrank_medal.py`
31+
### `hackerrank_medal.py`
2432

25-
A python script to know your medal in any hackerrank contest.
33+
A python script to know your medal in any Hackerrank contest.
2634

27-
## `set_router_ip.py`
35+
### `set_router_ip.py`
2836

29-
A python script to reset IP of any dlink router. The script will check for available IPs of the hostel, it will use admin credentials (set them in script) to login to the router admin portal, create a user session, and set the router IP to the one currently available :)
37+
A python script to reset IP of any Dlink router. The script will check for available IPs of the hostel, and it will use the given admin credentials to log in to the router admin portal, create a user session, and set the router IP to the one currently available :)
3038

31-
## `selenium/send.py`
39+
### `selenium/send.py`
3240

3341
A python script to send messages using WhatsApp web, using selenium.
3442

35-
## `selenium/gmail.py`
43+
### `selenium/gmail.py`
3644

37-
A python script to send emails using gmail web interface, using selenium.
45+
A python script to send emails using the Gmail web interface, using selenium.
3846

39-
Enjoy!
47+
Enjoy!

typeracer_plot.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
###########################################################
2+
## Scipt to plot speed stats of any typeracer user
3+
###########################################################
4+
5+
import requests
6+
from bs4 import BeautifulSoup
7+
from matplotlib import pyplot as plt
8+
9+
username = "agga_daku" # typeracer username
10+
num_races = 1000 # number of last races to plot
11+
url = "https://data.typeracer.com/pit/race_history?user=%s&n=1000&startDate=" % username
12+
13+
response = requests.get(url) # get html content
14+
soup = BeautifulSoup(response.text, "lxml") # make a soup
15+
speed_data = []
16+
for row in soup.find('table', class_="scoresTable").findAll('tr'):
17+
try:
18+
speed_data.append(int(row.findAll('td')[1].contents[0].split(' ')[0]))
19+
except:
20+
pass
21+
speed_data = list(reversed(speed_data))
22+
# plot using matplotlib
23+
plt.plot(range(len(speed_data)), speed_data)
24+
plt.show()

0 commit comments

Comments
 (0)