Skip to content

Commit 90d2470

Browse files
committed
added more utitliy files
1 parent 7614652 commit 90d2470

21 files changed

+397
-11
lines changed

JobSearch.py

100644100755
+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#!/usr/bin/python3.5
12
import notify2
23
import requests
34
import traceback
@@ -29,4 +30,4 @@
2930
notifier.show()
3031

3132
except IndexError as e:
32-
continue
33+
continue

bing_photo_of_the_day.py

100644100755
+20-3
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,34 @@
1+
#!/usr/bin/python3.5
12
import urllib.request
23
import requests
34
from bs4 import BeautifulSoup
5+
import os
6+
import os.path
7+
import datetime
8+
now = datetime.datetime.now()
9+
nm = "/home/rohan/Downloads/Bing_Photo_Of_the_day/" + str(now).replace("-","")[:8]+".jpg"
10+
# print(nm)
411

12+
if os.path.exists(nm):
13+
print("gsettings set org.gnome.desktop.background picture-uri file:" + nm)
14+
os.system("gsettings set org.gnome.desktop.background picture-uri file:" + nm)
15+
exit(0)
16+
517
# Get BingXML file which contains the URL of the Bing Photo of the day
618
# idx = Number days previous the present day. 0 means current day, 1 means yesterday, etc
719
# n = Number of images previous the day given by idx
820
# mkt denotes your location. e.g. en-US means United States. Put in your country code
9-
1021
BingXML_URL = "http://www.bing.com/HPImageArchive.aspx?format=xml&idx=0&n=1&mkt=en-US"
22+
# print(BingXML_URL)
1123
page = requests.get(BingXML_URL)
1224
BingXML = BeautifulSoup(page.text, "lxml")
1325
Images = BingXML.find_all('image')
14-
for pics in Images:
26+
ImageName = ""
27+
for pics in reversed(Images):
1528
ImageURL = "https://www.bing.com" + pics.url.text[:-12] + "1920x1080.jpg"
16-
ImageName = "/home/rohan/Downloads/Bing_Photo_Of_the_day/" + pics.startdate.text + ".jpg"
29+
ImageName = "/home/rohan/Downloads/Bing_Photo_Of_the_day/" +pics.startdate.text + ".jpg"
1730
urllib.request.urlretrieve(ImageURL, ImageName)
31+
change_background = 'gsettings set org.gnome.desktop.background picture-uri file:' + ImageName
32+
# print(change_background)
33+
# os.system("sudo chmod 777 " + ImageName)
34+
os.system(change_background)

blinker.py

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/usr/bin/python3.5
2+
import os
3+
import time
4+
5+
while True:
6+
os.system("xset dpms force off")
7+
time.sleep(20)
8+
os.system("xset dpms force on")
9+
os.system('espeak "Open You eyes"')
10+
time.sleep(300)

cleaner

+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
#!/usr/bin/python3.5
2+
import os
3+
from pathlib import Path
4+
5+
DIRECTORIES = {
6+
"HTML": [".html5", ".html", ".htm", ".xhtml"],
7+
"IMAGES": [".jpeg", ".jpg", ".tiff", ".gif", ".bmp", ".png", ".bpg", "svg",
8+
".heif", ".psd"],
9+
"VIDEOS": [".avi", ".flv", ".wmv", ".mov", ".mp4", ".webm", ".vob", ".mng",
10+
".qt", ".mpg", ".mpeg", ".3gp", ".3gpp", ".mkv"],
11+
"DOCUMENTS": [".oxps", ".epub", ".pages", ".docx", ".doc", ".fdf", ".ods",
12+
".odt", ".pwi", ".xsn", ".xps", ".dotx", ".docm", ".dox",
13+
".rvg", ".rtf", ".rtfd", ".wpd", ".xls", ".xlsx", ".ppt",
14+
".pptx", ".sql", ".pbix"],
15+
"ARCHIVES": [".a", ".ar", ".cpio", ".iso", ".tar", ".gz", ".rz", ".7z",
16+
".dmg", ".rar", ".xar", ".zip"],
17+
"AUDIO": [".aac", ".aa", ".aac", ".dvf", ".m4a", ".m4b", ".m4p", ".mp3",
18+
".msv", "ogg", "oga", ".raw", ".vox", ".wav", ".wma"],
19+
"ARDUINO-FILES": [".ino"],
20+
"PLAINTEXT": [".txt", ".in", ".out"],
21+
"PDF": [".pdf"],
22+
"PYTHON": [".py"],
23+
"XML": [".xml"],
24+
"EXE": [".exe"],
25+
"SHELL": [".sh"]
26+
27+
}
28+
29+
FILE_FORMATS = {file_format: directory
30+
for directory, file_formats in DIRECTORIES.items()
31+
for file_format in file_formats}
32+
33+
34+
def organize_junk():
35+
for entry in os.scandir():
36+
if entry.is_dir():
37+
continue
38+
file_path = Path(entry.name)
39+
file_format = file_path.suffix.lower()
40+
if file_format in FILE_FORMATS:
41+
print("ongoing...:"+str(entry.name))
42+
directory_path = Path(FILE_FORMATS[file_format])
43+
if "bill" in str(file_path) or "Bill" in str(file_path):
44+
directory_path = Path("BILLS")
45+
directory_path.mkdir(exist_ok=True)
46+
if os.path.exists(str(directory_path.joinpath(file_path))):
47+
dirs = str(directory_path.joinpath(file_path))
48+
while os.path.exists(dirs):
49+
dirs = dirs + "(copy)"
50+
file_path.rename(dirs)
51+
else:
52+
file_path.rename(directory_path.joinpath(file_path))
53+
54+
try:
55+
os.mkdir("OTHER-FILES")
56+
except:
57+
pass
58+
59+
for dir in os.scandir():
60+
try:
61+
if dir.is_dir():
62+
os.rmdir(dir)
63+
else:
64+
os.rename(os.getcwd() + '/' + str(Path(dir)), os.getcwd() + '/OTHER-FILES/' + str(Path(dir)))
65+
except:
66+
pass
67+
68+
69+
if __name__ == "__main__":
70+
organize_junk()
71+
print("zala copy...")

cleaner.py

100644100755
+6-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11

2+
3+
24
import os
35
from pathlib import Path
46

@@ -7,15 +9,16 @@
79
"IMAGES": [".jpeg", ".jpg", ".tiff", ".gif", ".bmp", ".png", ".bpg", "svg",
810
".heif", ".psd"],
911
"VIDEOS": [".avi", ".flv", ".wmv", ".mov", ".mp4", ".webm", ".vob", ".mng",
10-
".qt", ".mpg", ".mpeg", ".3gp", ".mkv"],
12+
".qt", ".mpg", ".mpeg", ".3gp", ".3gpp", ".mkv"],
1113
"DOCUMENTS": [".oxps", ".epub", ".pages", ".docx", ".doc", ".fdf", ".ods",
1214
".odt", ".pwi", ".xsn", ".xps", ".dotx", ".docm", ".dox",
1315
".rvg", ".rtf", ".rtfd", ".wpd", ".xls", ".xlsx", ".ppt",
14-
".pptx", ".sql"],
16+
".pptx", ".sql", ".pbix"],
1517
"ARCHIVES": [".a", ".ar", ".cpio", ".iso", ".tar", ".gz", ".rz", ".7z",
1618
".dmg", ".rar", ".xar", ".zip"],
1719
"AUDIO": [".aac", ".aa", ".aac", ".dvf", ".m4a", ".m4b", ".m4p", ".mp3",
1820
".msv", "ogg", "oga", ".raw", ".vox", ".wav", ".wma"],
21+
"ARDUINO-FILES": [".ino"],
1922
"PLAINTEXT": [".txt", ".in", ".out"],
2023
"PDF": [".pdf"],
2124
"PYTHON": [".py"],
@@ -25,7 +28,6 @@
2528

2629
}
2730

28-
2931
FILE_FORMATS = {file_format: directory
3032
for directory, file_formats in DIRECTORIES.items()
3133
for file_format in file_formats}
@@ -38,7 +40,7 @@ def organize_junk():
3840
file_path = Path(entry.name)
3941
file_format = file_path.suffix.lower()
4042
if file_format in FILE_FORMATS:
41-
print(entry.name+" ongoing...")
43+
print("ongoing...:"+str(entry.name))
4244
directory_path = Path(FILE_FORMATS[file_format])
4345
if "bill" in str(file_path) or "Bill" in str(file_path):
4446
directory_path = Path("BILLS")

exp.py

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import os
2+
duration = 1 # second
3+
freq = 440 # Hz
4+
5+
os.system('gsettings set org.gnome.desktop.background picture-uri file:/home/rohan/Downloads/Bing_Photo_Of_the_day/20180131.jpg')
6+

file_placer.py

+102
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
import os
2+
from pathlib import Path
3+
import notify2
4+
5+
DIRECTORIES = {
6+
"HTML": [".html5", ".html", ".htm", ".xhtml"],
7+
"IMAGES": [".jpeg", ".jpg", ".tiff", ".gif", ".bmp", ".png", ".bpg", "svg",
8+
".heif",".ico", ".psd"],
9+
"VIDEOS": [".avi", ".flv", ".wmv", ".mov", ".mp4", ".webm", ".vob", ".mng",
10+
".qt", ".mpg", ".mpeg", ".3gp", ".mkv"],
11+
"DOCUMENTS": [".oxps", ".epub", ".pages", ".docx", ".doc", ".fdf", ".ods",
12+
".odt", ".pwi", ".xsn", ".xps", ".dotx", ".docm", ".dox",
13+
".rvg", ".rtf", ".rtfd", ".wpd", ".xls", ".xlsx", ".ppt",
14+
".pptx", ".sql"],
15+
"ARCHIVES": [".a", ".ar", ".cpio", ".iso", ".tar", ".gz", ".rz", ".7z",
16+
".dmg", ".rar", ".xar", ".zip", ".tgz"],
17+
"AUDIO": [".aac", ".aa", ".aac", ".dvf", ".m4a", ".m4b", ".m4p", ".mp3",
18+
".msv", "ogg", "oga", ".raw", ".vox", ".wav", ".wma"],
19+
"PLAINTEXT": [".txt", ".in", ".out"],
20+
"PDF": [".pdf"],
21+
"PYTHON": [".py"],
22+
"XML": [".xml"],
23+
"ARDUINO-FILES": [".ino"],
24+
"EXE": [".exe"],
25+
"SCRIPTS": [".js"],
26+
"SHELL": [".sh"]
27+
}
28+
29+
my_dirs = [
30+
"/home/rohan/Documents/",
31+
"/home/rohan/Downloads/",
32+
"/home/rohan/Downloads/Kachra"
33+
]
34+
35+
FILE_FORMATS = {file_format: directory
36+
for directory, file_formats in DIRECTORIES.items()
37+
for file_format in file_formats}
38+
39+
40+
def organize_junk(dd):
41+
fatherpath = Path(dd)
42+
# print("fatherpath:" + str(fatherpath.absolute()))
43+
44+
for entry in os.scandir(dd):
45+
if entry.is_dir():
46+
continue
47+
file_path = Path(entry.name)
48+
file_format = file_path.suffix.lower()
49+
file_name = file_path.stem.title() # os.path.splitext(os.path.basename(dd+file_path.name.title()))[0]
50+
# print("file_path:" + str(file_path))
51+
# print("filename:" + file_name)
52+
# print("fileformat:" + file_format)
53+
54+
if file_format in FILE_FORMATS:
55+
# print("FolderName:" + FILE_FORMATS[file_format])
56+
directory_path = fatherpath.joinpath(Path(FILE_FORMATS[file_format]))
57+
# print("directorypath:" + str(directory_path.absolute()))
58+
59+
# directory_path = dd + str(directory_path)
60+
if "bill" in file_name.lower():
61+
directory_path = fatherpath.joinpath(Path("BILLS"))
62+
directory_path.mkdir(exist_ok=True)
63+
# print("comparison:" + str(directory_path.joinpath(file_path).absolute()))
64+
if os.path.exists(str(directory_path.joinpath(file_path).absolute())):
65+
dirs = str(directory_path.joinpath(file_path).absolute())
66+
ver = 0
67+
while os.path.exists(dirs):
68+
dirs = str(directory_path.absolute()) + "/" + file_name + "(" + str(ver) + ")" + file_format
69+
# print("dir is: " + dirs)
70+
ver = ver + 1
71+
# print("os rename arguments: " + str(fatherpath.absolute()) + "/" + str(file_path) + "," + dirs)
72+
os.rename(str(fatherpath.absolute()) + "/" + str(file_path), dirs)
73+
# file_path.rename(dirs)
74+
else:
75+
# print("os rename arguments: " + str(fatherpath.absolute()) + "/" + str(file_path) + " , " +
76+
# str(directory_path.absolute()) + "/" + file_name)
77+
os.rename(str(fatherpath.absolute()) + "/" + str(file_path),
78+
str(directory_path.absolute()) + "/" + file_name + file_format)
79+
# file_path.rename(directory_path.joinpath(file_path))
80+
notify2.init("foo")
81+
msg = notify2.Notification("Moving file '" + file_name + "'",str(fatherpath.absolute()) + "/" + str(file_path) + "\n to \n" +str(directory_path.absolute()) + "/" + file_name + file_format)
82+
msg.show()
83+
84+
try:
85+
os.mkdir("OTHER-FILES")
86+
except:
87+
pass
88+
89+
for dir in os.scandir(dd):
90+
try:
91+
if dir.is_dir():
92+
os.rmdir(dir)
93+
else:
94+
os.rename(os.getcwd() + '/' + str(Path(dir)), os.getcwd() + '/OTHER-FILES/' + str(Path(dir)))
95+
except:
96+
pass
97+
98+
99+
if __name__ == "__main__":
100+
for dir in my_dirs:
101+
organize_junk(dir)
102+
print("zala kaam...")

geckodriver

Whitespace-only changes.

home.rar

1.73 MB
Binary file not shown.

indian_bing_photo_of_the_day.py

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/usr/bin/python3.5
2+
import urllib.request
3+
import requests
4+
from bs4 import BeautifulSoup
5+
import os
6+
import os.path
7+
import datetime
8+
now = datetime.datetime.now()
9+
nm = "/home/rohan/Downloads/Bing_Photo_Of_the_day_indian/" + str(now).replace("-","")[:8]+".jpg"
10+
# print(nm)
11+
12+
if os.path.exists(nm):
13+
print("gsettings set org.gnome.desktop.background picture-uri file:" + nm)
14+
os.system("gsettings set org.gnome.desktop.background picture-uri file:" + nm)
15+
exit(0)
16+
17+
# Get BingXML file which contains the URL of the Bing Photo of the day
18+
# idx = Number days previous the present day. 0 means current day, 1 means yesterday, etc
19+
# n = Number of images previous the day given by idx
20+
# mkt denotes your location. e.g. en-US means United States. Put in your country code
21+
BingXML_URL = "http://www.bing.com/HPImageArchive.aspx?format=xml&idx=0&n=1&mkt=en-IN"
22+
# print(BingXML_URL)
23+
page = requests.get(BingXML_URL)
24+
BingXML = BeautifulSoup(page.text, "lxml")
25+
Images = BingXML.find_all('image')
26+
ImageName = ""
27+
for pics in reversed(Images):
28+
ImageURL = "https://www.bing.com" + pics.url.text[:-12] + "1920x1080.jpg"
29+
ImageName = "/home/rohan/Downloads/Bing_Photo_Of_the_day_indian/" +pics.startdate.text + ".jpg"
30+
urllib.request.urlretrieve(ImageURL, ImageName)
31+
change_background = 'gsettings set org.gnome.desktop.background picture-uri file:' + ImageName
32+
# print(change_background)
33+
# os.system("sudo chmod 777 " + ImageName)
34+
os.system(change_background)

routerChaLocha.sh

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/bash
2+
sudo ifconfig wlp2s0 down
3+
echo "wifi band hotay jara vel thamba..."
4+
sleep 2
5+
sudo ifconfig wlp2s0 up
6+
echo "wifi chalu zala..."

screenshot.py

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/usr/bin/python3.5
2+
import pyscreenshot
3+
import time
4+
while True:
5+
pyscreenshot.grab_to_file("/home/rohan/Downloads/Kachra/aspire/" + str(time.ctime()).replace(" ", "_") + ".jpeg")
6+
time.sleep(30)

spot_ur_train

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#!/usr/bin/python3.5
2+
import requests
3+
from bs4 import BeautifulSoup
4+
5+
chakra = True
6+
trial = 5
7+
8+
# train_no = 22104
9+
train_no = int(input("Enter the train no."))
10+
days = int(
11+
input("enter the starting day number..('0' for today, '1' for yesterday, 2 for day before yesterday and so "
12+
"on...)")) * -1
13+
# days = -1
14+
15+
while chakra and trial >= 0:
16+
try:
17+
sc = requests.get("http://spoturtrain.com/status.php?tno=" + str(train_no) + "&date=+" + str(days))
18+
soup = BeautifulSoup(sc.text, 'lxml')
19+
tr = soup.find_all("tr")
20+
for td in tr[1].find_all("font"):
21+
print(td.getText().strip("\t").strip("\n") + "\n")
22+
print("-----------------------------------------------------------------------------------\n\n")
23+
print("Station -> ETA")
24+
print("--------------")
25+
for i in range(3, len(tr)):
26+
rows = tr[i]
27+
str = ""
28+
flag = True
29+
for td in rows.find_all("td"):
30+
str = str + td.getText().strip('\n') + " "
31+
if flag:
32+
str = str + "-> "
33+
flag = False
34+
print(str)
35+
chakra = False
36+
trial -= 1
37+
except:
38+
trial -= 1
39+
print("Kuch toh locha hai... reattempting")
40+
if chakra:
41+
print("Successfully Failed... Please try again")

spot_ur_train.py

100644100755
File mode changed.

start_torrent.sh

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/bin/bash
2+
utserver -settingspath /opt/utorrent-server-alpha-v3_3/

start_torrent.sh.save

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/bash
2+
/home/rohan/D
3+
ownloads/utorrent-server-alpha-v3_3/utserver
4+

0 commit comments

Comments
 (0)