Skip to content

Commit fcd8242

Browse files
Merge pull request #1 from harshareddy794/harsha
Harsha
2 parents 81ba2d1 + 8561554 commit fcd8242

File tree

14 files changed

+226
-2
lines changed

14 files changed

+226
-2
lines changed

HTML_to_Markdown/README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
## HTML to Markdown converter
2+
3+
This script converts HTML Files into Markdown.
4+
5+
## Requirements for this script:
6+
7+
1.html2markdown
8+
9+
install this by running the following command:
10+
11+
pip install -r requirements.txt
12+
13+
## How to use this script?
14+
15+
Just type the following in your command prompt:
16+
17+
python html_to_markdown.py
18+
19+
## Sample of the script in action:
20+
21+
<p align = "center">
22+
<img src="how_to_use.PNG" alt="score">
23+
</p>
24+
<p align = "center">
25+
<img src="sample.PNG" alt="score">
26+
</p>

HTML_to_Markdown/how_to_use.PNG

10.7 KB
Loading

HTML_to_Markdown/html_to_markdown.py

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import html2markdown
2+
import sys
3+
4+
5+
def convert_me_to_markdown(input_html, output_md):
6+
"""This function take an HTML file as input and
7+
converts it into a markdown file. The name of
8+
the markdown file is set according to the
9+
output_md string.
10+
11+
Args:
12+
input_html (string): The input HTML file
13+
output_md (string): The name of the output markdown file
14+
"""
15+
16+
# Used context manger to open the input and output files.
17+
with open(input_html, 'r') as input_file:
18+
with open(output_md, 'w') as output_file:
19+
for data in input_file:
20+
# Writing the conveted data to the output file.
21+
output_file.write(html2markdown.convert(data))
22+
23+
24+
def main():
25+
26+
# The html file which undergoes conversion
27+
input_html = input("Enter your html file please: ")
28+
29+
# To make sure the user inputs only html files
30+
# HMTL files can end with .html or .htm
31+
if any(input_html.endswith(s) for s in ['.html', '.htm']):
32+
# To have a matching file name for the output file
33+
output_md = input_html.split('.')[0] + ".md"
34+
convert_me_to_markdown(input_html, output_md)
35+
else:
36+
sys.exit("Bruh this script takes html files only")
37+
38+
39+
if __name__ == "__main__":
40+
main()
41+
print("Your HTML file has been converted to Markdown successfully!!")

HTML_to_Markdown/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
html2markdown==0.1.7

HTML_to_Markdown/sample.PNG

83.6 KB
Loading

Hashing file/app.py

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
import sys
2+
import hashlib
3+
4+
methods = {
5+
'1':'md5',
6+
'2':'sha1',
7+
'3':'sha256',
8+
'4':'sha512',
9+
}
10+
11+
def help():
12+
print("Usage: python app.py filename")
13+
print("""
14+
Available hash methods
15+
[1] MD5
16+
[2] SHA1
17+
[3] SHA256
18+
[4] SHA512
19+
""")
20+
21+
22+
def file_read(filename):
23+
try:
24+
content = open(filename, "r").read()
25+
content = content.encode('utf-8')
26+
return content
27+
except:
28+
print("Openning file error")
29+
exit(0)
30+
31+
def hash_text(content,method):
32+
return hashlib.new(methods[method],content).hexdigest()
33+
34+
35+
def write_content(hashed_content):
36+
new_file=open('Hased data.txt','w')
37+
new_file.write(hashed_content)
38+
new_file.close()
39+
40+
41+
42+
43+
if __name__ == "__main__":
44+
help()
45+
if len(sys.argv) < 2:
46+
help()
47+
print("No file specified")
48+
exit(0)
49+
50+
filename = sys.argv[1]
51+
52+
content = file_read(filename)
53+
method=int(input())
54+
if(method > 4 or method < 1):
55+
print("No method or wrong method specified. Using default md5 hashing method")
56+
method = 1
57+
58+
hashed_content = hash_text(content,str(method))
59+
60+
write_content(hashed_content)

Hashing file/readme.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
Hashing a file is a python script which takes data from a text file and hash it with some algorithms
2+
3+
### Encryption algorithms
4+
* MD5
5+
* SHA1
6+
* SHA256
7+
* SHA512
8+
9+
10+
It will store all the hashed data into a new text file called as **Hased data.txt**

Hashing file/requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
hashlib
2+
sys

IPL score/README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
## IPL Score Scrapper
2+
3+
This script provides live ipl score on the command line.
4+
5+
## Requirements for this script:
6+
7+
1. BeautifulSoup4
8+
2. requests
9+
10+
install these two by running the following command:
11+
12+
pip install -r requirements.txt
13+
14+
## How to use this script?
15+
16+
Just type the following in your command prompt:
17+
18+
python ipl_score.py
19+
20+
## Sample of the script in action:
21+
22+
<p align = "center">
23+
<img src="first.PNG" alt="score">
24+
</p>
25+
<p align = "center">
26+
<img src="second.PNG" alt="score">
27+
</p>

IPL score/first.PNG

16.8 KB
Loading

0 commit comments

Comments
 (0)