Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
language: python
python:
- "3.3"
- "3.4"
- "3.5"
install:
- pip install coveralls
- pip install pep8
script:
- pep8 --max-line-length 5000 bin
after_success:
- coveralls
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,14 @@ In case your browser stoped working delete/comment the following line in the scr
#### _Windows_
`os.system("TASKKILL /F /IM " + brow + ".exe")`

* ### Group files by type
- Group files by their extensions
- Files are moved into folders with extension names

#### Usage Instructions
```python
python group_file_by_type.py 'C:\\test\\products'
```

## Release History

Expand Down
8 changes: 4 additions & 4 deletions bin/Blog_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
piu = data[i]
heading = piu.find("a").get_text()
for n in range(84):
print ("-", end=" ")
print ('{}{}'.format(' ' * (int(columns / 2 - len(heading) / 2)), heading))
print("-", end=" ")
print('{}{}'.format(' ' * (int(columns / 2 - len(heading) / 2)), heading))
for n in range(84):
print ("-", end=" ")
print("-", end=" ")
main_content = piu.find(class_="content").get_text()
print (main_content)
print(main_content)
6 changes: 4 additions & 2 deletions bin/ImagetoData.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os, os.path
import os
import os.path
import numpy as np
from PIL import Image

Expand All @@ -16,5 +17,6 @@ def image_classifier(path):

return np.array(imgs)

# converts all images in a particular directory to a 64*64*3 (3 for the rgb value of image) dimension vector
# converts all images in a particular directory to a 64*64*3
# (3 for the rgb value of image) dimension vector
# use - in machine learning and image processing
32 changes: 17 additions & 15 deletions bin/Lost Robot/Solution.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
#According to question we can only instruct robot up or down or left or right. So in his current coordiantes and home coordinates one of the/
#coordinate either X or Y must be same.
for _ in range(int(input()):
x1,y1,x2,y2=map(int,input().split())#This will parse input to x1,y1,x2 and y2
if x1!=x2 and y1!=y2:
print('sad')
elif x1==x2 and y1<y2:
print('up')
elif x1==x2 and y1>y2:
print('down')
elif y1==y2 and x1<x2:
print('right')
elif y1==y2 and x1>x2:
print('left')

# According to question we can only instruct robot up or down or left or right.
# So in his current coordiantes and home coordinates one of the/
# coordinate either X or Y must be same.


for _ in range(int(input())):
x1, y1, x2, y2 = map(int, input().split()) # This will parse input to x1,y1,x2 and y2
if x1 != x2 and y1 != y2:
print('sad')
elif x1 == x2 and y1 < y2:
print('up')
elif x1 == x2 and y1 > y2:
print('down')
elif y1 == y2 and x1 < x2:
print('right')
elif y1 == y2 and x1 > x2:
print('left')
14 changes: 7 additions & 7 deletions bin/Pyfirebase.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import requests.packages.urllib3
requests.packages.urllib3.disable_warnings()
import serial
import json
from firebase import firebase

arduinoData = serial.Serial('com31',9600)
requests.packages.urllib3.disable_warnings()
arduinoData = serial.Serial('com31', 9600)

from firebase import firebase

firebase = firebase.FirebaseApplication('https://___YOUR_PROJECT_NAME____.firebaseio.com/')
firebase = firebase.FirebaseApplication(
'https://___YOUR_PROJECT_NAME____.firebaseio.com/')

while 1:
myData = (arduinoData.readline().strip())
myData = (myData.decode('utf-8'))
myData = float(myData)
result = firebase.put('MainNode/Leaf','temp',myData)
print 'Data : ',result

result = firebase.put('MainNode/Leaf', 'temp', myData)
print 'Data : ', result
61 changes: 31 additions & 30 deletions bin/Video-downloader/vid.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,29 @@
# Master dictionary--will be expanding in future iterations of the project
# version 1 of vid.py
master = {
'Audio': {
'format': 'bestaudio/best',
'noplaylist': True,
'postprocessors': [{
'key': 'FFmpegExtractAudio',
'preferredcodec': 'mp3',
'preferredquality': '192',
}]
},
'Video': {
'format': 'bestvideo+bestaudio/best',
'noplaylist': True,
'postprocessors': [{
'key': 'FFmpegVideoConvertor',
'preferedformat': 'mp4',
# 'preferredquality': '137',
}]
},
'list': {
'listsubtitles': True
'Audio': {
'format': 'bestaudio/best',
'noplaylist': True,
'postprocessors': [{
'key': 'FFmpegExtractAudio',
'preferredcodec': 'mp3',
'preferredquality': '192',
}]
},
'listformat': {
'lisformats': True
'Video': {
'format': 'bestvideo+bestaudio/best',
'noplaylist': True,
'postprocessors': [{
'key': 'FFmpegVideoConvertor',
'preferedformat': 'mp4',
# 'preferredquality': '137',
}]
},
'list': {
'listsubtitles': True
},
'listformat': {
'lisformats': True
}
}

Expand Down Expand Up @@ -69,7 +69,7 @@ def check(link):
return False


def download(link,data):
def download(link, data):
try:
with youtube_dl.YoutubeDL(data) as ydl:
ydl.download([link])
Expand All @@ -87,21 +87,22 @@ def main():
print("2.Download a Video playlist")
print("3.Download a Single Audio")
print("4.Download a single video file")
ch=int(input("Enter your choice: "))
if ch in [1,2,3,4]:
ch = int(input("Enter your choice: "))
if ch in [1, 2, 3, 4]:
if ch == 1:
master['Audio']['noplaylist'] = False
download(link,master['Audio'])
download(link, master['Audio'])
elif ch == 2:
master['Video']['noplaylist'] = False
download(link,master['Video'])
download(link, master['Video'])
elif ch == 4:
download(link,master['Video'])
download(link, master['Video'])
else:
download(link,master['Audio'])
download(link, master['Audio'])
else:
print("Bad choice")
ch = str(input("do you want to continue?(Y/n)"))

if __name__=="__main__":

if __name__ == "__main__":
main()
11 changes: 7 additions & 4 deletions bin/air-quality.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,13 @@
url = "https://api.waqi.info/feed/here/?token=" + sys.argv[1]
response = req.get(url, verify=False)
if response.json()['status'] == "ok":
print("The air quality is "+ str(response.json()['data']['aqi']))
print("The data was fetched from " + response.json()['data']['city']['name'])
print("The pollutant measured was " + str(response.json()['data']['dominentpol']))
print("The air quality is " + str(response.json()['data']['aqi']))
print("The data was fetched from " +
response.json()['data']['city']['name'])
print("The pollutant measured was " +
str(response.json()['data']['dominentpol']))
elif response.json()['status'] == "error":
print("The server returned an error. The message is " + response.json()['data'])
print("The server returned an error. The message is " +
response.json()['data'])
else:
print("Cannot fetch AQI without token")
3 changes: 2 additions & 1 deletion bin/bulk_add_twitter_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@
for i in range(len(screen_name))[::chunk_size]:
# split to chunk size
sn = ','.join(screen_name[i:i+chunk_size])
tw.lists.members.create_all(owner_screen_name='your_screen_name_here', slug='your_list', screen_name=sn)
tw.lists.members.create_all(
owner_screen_name='your_screen_name_here', slug='your_list', screen_name=sn)
10 changes: 6 additions & 4 deletions bin/caesar_cipher.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
key = 'abcdefghijklmnopqrstuvwxyz'


def encrypt(n, plaintext):
"""Encrypt the string and return the ciphertext"""
result = ''
Expand Down Expand Up @@ -27,6 +28,7 @@ def decrypt(n, ciphertext):

return result


print("Encrypt or decrypt?")
ans = input()
ans = ans.lower()
Expand All @@ -35,8 +37,8 @@ def decrypt(n, ciphertext):
print("Enter rotation number")
nn = int(input())
if ans == 'encrypt':
ret = encrypt(nn,k)
print ('Encrytped: %s' % ret)
ret = encrypt(nn, k)
print('Encrytped: %s' % ret)
else:
ret = decrypt(nn,k)
print ('Decrytped: %s' % ret)
ret = decrypt(nn, k)
print('Decrytped: %s' % ret)
4 changes: 2 additions & 2 deletions bin/dice_simulator.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import random # random is a python built-in module
import random # random is a python built-in module


def roll_dice():
Expand All @@ -7,4 +7,4 @@ def roll_dice():


if __name__ == '__main__':
roll_dice()
roll_dice()
29 changes: 17 additions & 12 deletions bin/end_to_end.py
Original file line number Diff line number Diff line change
@@ -1,39 +1,44 @@
import time
a = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
a = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']


def encrypt(msg):
off = 3
enc = ""
for i in msg:
enc = enc + (a[(a.index(i)+off)%26])
enc = enc + (a[(a.index(i)+off) % 26])
return enc


def decrypt(msg):
off = 3
dec = ""
for i in msg:
dec = dec + (a[(a.index(i)-off)%26])
dec = dec + (a[(a.index(i)-off) % 26])
return dec

#Client Side(Sender)

# Client Side(Sender)
msg = input("Enter Message To Send: ")
f = open('server.txt','w+')
f = open('server.txt', 'w+')
print("Encrypting..........")
time.sleep(2)
enc = encrypt(msg)
print("Message Sent Is: ",enc)
print("Message Sent Is: ", enc)

#Server Side
# Server Side
f.write(enc)
f.close()

print()
#Client Side(Reciever)
# Client Side(Reciever)
print("Reciever Is Recieving.........")
time.sleep(2)
f = open('server.txt','r+')
f = open('server.txt', 'r+')
msg = f.read()
print("Message Recieved Is: ",msg)
print("Message Recieved Is: ", msg)
print("Decrypting........")
time.sleep(2)
dec = decrypt(msg)
print("Message Displayed Is: ",dec)

print("Message Displayed Is: ", dec)
Loading