Skip to content

Commit e838414

Browse files
committed
Merge remote-tracking branch 'geekcomputers/master'
2 parents e9b1bc2 + c26c191 commit e838414

File tree

5 files changed

+40
-23
lines changed

5 files changed

+40
-23
lines changed

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ In the scripts the comments etc are lined up correctly when they are viewed in [
2727

2828
- `nslookup_check.py` - This very simple script opens the file `server_list.txt` and then does an nslookup for each one to check the DNS entry.
2929

30-
- `osinfo.py` - Displays some information about the OS you are running this script on.
30+
- `osinfo.py` - Displays some information about the OS on which you are running this script.
3131

32-
- `ping_servers.py` - This script will, depending on the arguments supplied, will ping the servers associated with that application group.
32+
- `ping_servers.py` - This script depending on the arguments supplied, will ping the servers associated with that application group.
3333

3434
- `ping_subnet.py` - After supplying the first 3 octets it will scan the final range for available addresses.
3535

@@ -41,22 +41,22 @@ In the scripts the comments etc are lined up correctly when they are viewed in [
4141

4242
- `script_listing.py` - This will list all the files in the given directory, it will also go through all the subdirectories as well.
4343

44-
- `testlines.py` - This very simple script open a file and prints out 100 lines of whatever is set for the line variable.
44+
- `testlines.py` - This very simple script opens a file and prints out 100 lines of whatever is the set for the line variable.
4545

4646
- `tweeter.py` - This script allows you to tweet text or a picture from the terminal.
4747

4848
- `serial_scanner.py` contains a method called ListAvailablePorts which returns a list with the names of the serial ports that are in use in our computer, this method works only on Linux and Windows (can be extended for mac osx). If no port is found, an empty list is returned.
4949

50-
- `get_youtube_view.py` - This is very simple python script to get more views for your youtube videos.Some times I use for repeating my favorite songs by this scripts.
50+
- `get_youtube_view.py` - This is very simple python script to get more views for your youtube videos. Sometimes I use it for repeating my favorite songs by this script.
5151

52-
- `CountMillionCharacter.py` - This Script will,counting character script, count how much character present *any text based file.
52+
- `CountMillionCharacter.py` - This Script is used for 1.counting character script 2.count how much characters are present on any text based file.
5353

54-
- `xkcd_downloader.py` - Downloads the latest XKCD comic and places them in a new folder "comics"
54+
- `xkcd_downloader.py` - Downloads the latest XKCD comic and places them in a new folder "comics".
5555

5656
- `timymodule.py` - A great alternative to Pythons 'timeit' module and easier to use.
5757

5858
- `calculator.py` - Uses Python's eval() function to implement a calculator.
5959

60-
- `Google_News.py` - Uses BeautifulSoup to provide Latest News Headline along with news link
60+
- `Google_News.py` - Uses BeautifulSoup to provide Latest News Headline along with news link.
6161

62-
- `cricket_live_score` - Uses BeautifulSoup to provide live cricket score
62+
- `cricket_live_score` - Uses BeautifulSoup to provide live cricket score.

check_file.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,22 +33,23 @@ def main():
3333
if len(sys.argv) >= 2:
3434
filenames = sys.argv[1:]
3535

36+
filteredfilenames = list(filenames)
3637
# Iterate for each filename passed in command line argument
3738
for filename in filenames:
3839
if not os.path.isfile(filename): # Check the File exists
3940
print('[-] ' + filename + ' does not exist.')
40-
filenames.remove(filename) #remove non existing files from fileNames list
41+
filteredfilenames.remove(filename) #remove non existing files from fileNames list
4142
continue
4243

4344
# Check you can read the file
4445
if not os.access(filename, os.R_OK):
4546
print('[-] ' + filename + ' access denied')
4647
# remove non readable fileNames
47-
filenames.remove(filename)
48+
filteredfilenames.remove(filename)
4849
continue
4950

50-
# Read the content of each file
51-
for filename in filenames:
51+
# Read the content of each file that both exists and is readable
52+
for filename in filteredfilenames:
5253
# Display Message and read the file contents
5354
print('[+] Reading from : ' + filename)
5455
readfile(filename)

dec_to_hex.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
mydict={
2+
'0':'0','1':'1','2':'2','3':'3','4':'4','5':'5','6':'6','7':'7','8':'8','9':'9','10':'A','11':'B',
3+
'12':'C','13':'D','14':'E','15':'F'
4+
}
5+
dec_num=input('Enter the decimal number\n');
6+
dec_num=int(dec_num)
7+
value=""
8+
while dec_num>0:
9+
value+=mydict[str(dec_num%16)]
10+
dec_num=dec_num//16
11+
hex_value=value[::-1]
12+
print(hex_value)

python_sms.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,25 +15,25 @@
1515
import sqlite3
1616
import sys
1717

18-
dropbox= os.getenv("dropbox")
19-
scripts=os.getenv("scripts")
20-
dbfile=("database/maindatabase.db")
21-
master_db=os.path.join(dropbox, dbfile)
18+
dropbox = os.getenv("dropbox")
19+
scripts = os.getenv("scripts")
20+
dbfile = ("database/maindatabase.db")
21+
master_db = os.path.join(dropbox, dbfile)
2222

23-
f=open(scripts+'/output/student.txt','a')
23+
f = open(scripts+'/output/student.txt','a')
2424

25-
tdate=strftime("%d-%m")
25+
tdate = strftime("%d-%m")
2626

2727
conn = sqlite3.connect(master_db)
2828
cursor = conn.cursor()
29-
loc_stmt='SELECT name, number from table'
29+
loc_stmt = 'SELECT name, number from table'
3030
cursor.execute(loc_stmt)
3131
while True:
3232
row = cursor.fetchone()
3333
if row == None:
3434
break
35-
sname=row[0]
36-
snumber=row[1]
35+
sname = row[0]
36+
snumber = row[1]
3737

3838
message = (sname + ' There will be NO training tonight on the ' + tdate + ' Sorry for the late notice, I have sent a mail as well, just trying to reach everyone, please do not reply to this message as this is automated')
3939

@@ -69,7 +69,7 @@
6969
try:
7070
response = urllib2.urlopen(req)
7171
response_url = response.geturl()
72-
if response_url==url:
72+
if response_url == url:
7373
print 'SMS sent!'
7474
except urllib2.URLError, e:
7575
print 'Send failed!'

serial_scanner.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,11 @@ def ListAvailablePorts():
4040
else:
4141
print '''This method was developed only for linux and windows
4242
the current platform isn't recognised'''
43-
return AvailablePorts
43+
if len(AvailablePorts) == 0:
44+
print("NO port in use")
45+
return 0
46+
else:
47+
return AvailablePorts
4448

4549

4650
# EXAMPLE OF HOW IT WORKS

0 commit comments

Comments
 (0)