├── CNAME ├── AddToSendTo ├── requirements.txt ├── README.md └── add_to_sendTo.py ├── _config.yml ├── favicon.ico ├── open_folder.py ├── folder-maker.py ├── shortcut.py ├── RPSLS ├── README.md └── RPSLS.py ├── LICENSE ├── README.md ├── SetToStartup ├── README.md └── set_to_startup.py ├── AddToTaskabr └── AddToTaskbar.py ├── _layouts └── default.html └── CONTRIBUTE.md /CNAME: -------------------------------------------------------------------------------- 1 | pyscripts.aashutosh.dev -------------------------------------------------------------------------------- /AddToSendTo/requirements.txt: -------------------------------------------------------------------------------- 1 | winshell 2 | pypiwin32 -------------------------------------------------------------------------------- /_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-minimal 2 | title: Python Scripts and Games -------------------------------------------------------------------------------- /favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aashutoshrathi/py-scripts/HEAD/favicon.ico -------------------------------------------------------------------------------- /open_folder.py: -------------------------------------------------------------------------------- 1 | import os 2 | import time 3 | newpath = os.path.join('D:', 'Study', 'Codes', time.strftime("%B %y")) 4 | os.startfile(newpath) -------------------------------------------------------------------------------- /folder-maker.py: -------------------------------------------------------------------------------- 1 | import os 2 | import time 3 | newpath = os.path.join('D:', 'Study', 'Codes', time.strftime("%B %y")) 4 | print(newpath) 5 | if not os.path.exists(newpath): 6 | os.makedirs(newpath) 7 | -------------------------------------------------------------------------------- /shortcut.py: -------------------------------------------------------------------------------- 1 | import os, winshell 2 | from win32com.client import Dispatch 3 | 4 | desktop = winshell.desktop() 5 | path = os.path.join(desktop, "Media Player Classic.lnk") 6 | target = r"D:\Study\Codes\July 17\Battleship.py" 7 | wDir = r"D:\Study\Codes\July 17" 8 | icon = r"D:\Study\Codes\July 17\Battleship.py" 9 | 10 | shell = Dispatch('WScript.Shell') 11 | shortcut = shell.CreateShortCut(path) 12 | shortcut.Targetpath = target 13 | shortcut.WorkingDirectory = wDir 14 | shortcut.IconLocation = icon 15 | shortcut.save() -------------------------------------------------------------------------------- /RPSLS/README.md: -------------------------------------------------------------------------------- 1 | ## RPSLS 2 | [](#) 3 | [![forthebadge](https://forthebadge.com/images/badges/made-with-python.svg)](https://forthebadge.com) 4 | 5 | Rock, Paper, Scissor, Lizard, Spock for you, now in you Terminal / Bash. 6 | 7 | 8 | ## How it Works ? 9 | ![Demo](https://gifyu.com/images/Peek2017-10-0215-09.gif) 10 | 11 | 12 |

Made with ❤ by Aashutosh Rathi

13 | -------------------------------------------------------------------------------- /AddToSendTo/README.md: -------------------------------------------------------------------------------- 1 | ## AddToSendTo 2 | [](#) 3 | [![forthebadge](https://forthebadge.com/images/badges/made-with-python.svg)](https://forthebadge.com) 4 | 5 | Add your favorite Folder to Send To option, when you right-click. 6 | 7 | Works better with Python 3. 8 | 9 | Works with Windows Only. 10 | 11 | ## Requirements and Installation 12 | 13 | Install dependecies using: 14 | `pip install -r requirements.txt` 15 | 16 | and now compile simply as you execute a Python file. 17 | 18 | ## How it Works 19 | 20 | ![Demo](https://media.giphy.com/media/l1J3Utwj7jHc8vSww/giphy.gif) 21 | 22 |

Made with ❤ by Aashutosh Rathi

23 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Aashutosh Rathi 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## Python Scripts 📜 and Games 🎲 2 | [](https://aashutoshrathi.github.io/Python-Scripts-and-Games/) 3 | [![forthebadge](https://forthebadge.com/images/badges/made-with-python.svg)](https://forthebadge.com) 4 | 5 | This is collection of Python scripts which can help you fasten up and some games. 6 | 7 | Name | Description 8 | -------------------- | ------------- 9 | [SetToStartup](SetToStartup) ![image](https://image.ibb.co/hZ8iZk/windows_1.png) | Set any file or folder to startup in easy way. | 10 | [RPSLS 🗿📝✂️🦎🖖](RPSLS) | Rock, Paper, Scissor, Lizard, Spock in Python | 11 | [AddToSendTo](AddToSendTo) ![image](https://image.ibb.co/hZ8iZk/windows_1.png) | Set any folder to SendTo in easy way. | 12 | [Test Case Generator](https://github.com/aashutoshrathi/Testcase-Generator) | An easy Python script to make Test Cases. | 13 | 14 | 15 | 16 |

Made with ❤ by Aashutosh Rathi

17 | -------------------------------------------------------------------------------- /SetToStartup/README.md: -------------------------------------------------------------------------------- 1 | ## SetToStartup 2 | [](#) 3 | [![forthebadge](https://forthebadge.com/images/badges/made-with-python.svg)](https://forthebadge.com) 4 | 5 | Start-up Programs are those which start as soon as computer boots up, this script will help you to add your favorite programs or self made scripts/folders to startup. 6 | 7 | Works better with Python 3. 8 | 9 | Works with Windows Only. 10 | 11 | ## Requirements and Installation 12 | 13 | For this to work, you need to install few modules by following commands. 14 | 15 | | Module | Steps | 16 | |:--------------:|:----------------:| 17 | | winshell |`pip install winshell`| 18 | | OS |`pip install os`| 19 | | win32com |Install from an executable [here](https://drive.google.com/open?id=0B3LWQGcO8qcwV3ltMV9vTGZ5Nms)| 20 | 21 | and now compile simply as you execute a Python file. 22 | 23 | 24 | ## How it Works ? 25 | 26 | ![Demo](https://media.giphy.com/media/xT39DnZWnaTFJBCS3K/giphy.gif) 27 | 28 | 29 |

Made with ❤ by Aashutosh Rathi

30 | -------------------------------------------------------------------------------- /AddToSendTo/add_to_sendTo.py: -------------------------------------------------------------------------------- 1 | """ 2 | Scripts written By : Aashutosh Rathi 3 | Credits : Stack Overflow and Me. 4 | """ 5 | 6 | 7 | import os 8 | import time 9 | import winshell 10 | import shutil 11 | from win32com.client import Dispatch 12 | 13 | 14 | def remove_quotes(string): 15 | """ 16 | This function is used here to remove quotes from 17 | paths used in this script. 18 | 19 | :param string: Path with quotes. 20 | :return: Path without quotes. 21 | """ 22 | if string.startswith('"'): 23 | string = string[1:] 24 | 25 | if string.endswith('"'): 26 | string = string[:-1] 27 | return string 28 | 29 | 30 | def find_symbol(path): 31 | for x in range(len(path)-1): 32 | if path[x] == "\\": 33 | result = x 34 | return result 35 | 36 | 37 | def make_working_dir(file_path): 38 | sym = find_symbol(file_path) 39 | return file_path[:sym] 40 | 41 | 42 | def make_shortcut(file_path, dir_path, name): 43 | you = os.getlogin() 44 | startup = os.path.join('C:\\Users', you, 'AppData', 'Roaming', 45 | 'Microsoft', 'Windows', 'SendTo') 46 | name = name + '.lnk' 47 | path = os.path.join(startup, name) 48 | shell = Dispatch('WScript.Shell') 49 | shortcut = shell.CreateShortCut(path) 50 | shortcut.Targetpath = file_path 51 | shortcut.WorkingDirectory = dir_path 52 | shortcut.IconLocation = file_path 53 | shortcut.save() 54 | 55 | 56 | def main(): 57 | print("\n===== Add Your files or Folders to SendTo in easy way =====") 58 | you = os.getlogin() 59 | print('Hey!', you) 60 | file = input('Path of folder to be added to SendTo : ') 61 | workingDir = make_working_dir(file) 62 | file = remove_quotes(file) 63 | workingDir = remove_quotes(workingDir) 64 | name = input('Folder Name : ') 65 | make_shortcut(file, workingDir, name) 66 | print(name, 'added to SendTo Successfully !!') 67 | 68 | 69 | if __name__ == '__main__': 70 | main() 71 | -------------------------------------------------------------------------------- /SetToStartup/set_to_startup.py: -------------------------------------------------------------------------------- 1 | """ 2 | Scripts written By : Aashutosh Rathi 3 | Credits : Stack Overflow and Me . 4 | 5 | """ 6 | 7 | 8 | import os 9 | import time 10 | import winshell 11 | import shutil 12 | from win32com.client import Dispatch 13 | 14 | 15 | def remove_quotes(string): 16 | """ 17 | This function is used here to remove quotes from 18 | paths used in this script. 19 | 20 | :param string: Path with quotes. 21 | :return: Path without quotes. 22 | """ 23 | if string.startswith('"'): 24 | string = string[1:] 25 | 26 | if string.endswith('"'): 27 | string = string[:-1] 28 | return string 29 | 30 | 31 | def find_symbol(path): 32 | for x in range(len(path)-1): 33 | if path[x] == "\\": 34 | result = x 35 | return result 36 | 37 | 38 | def make_working_dir(file_path): 39 | sym = find_symbol(file_path) 40 | return file_path[:sym] 41 | 42 | 43 | def make_shortcut(file_path, dir_path, name): 44 | you = os.getlogin() 45 | startup = os.path.join('C:\\Users', you, 'AppData', 'Roaming', 46 | 'Microsoft', 'Windows', 'Start Menu', 'Programs', 'Startup') 47 | name = name + '.lnk' 48 | path = os.path.join(startup, name) 49 | shell = Dispatch('WScript.Shell') 50 | shortcut = shell.CreateShortCut(path) 51 | shortcut.Targetpath = file_path 52 | shortcut.WorkingDirectory = dir_path 53 | shortcut.IconLocation = file_path 54 | shortcut.save() 55 | 56 | 57 | def main(): 58 | print("\n===== Add Your files or Folders to startup in easy way =====") 59 | you = os.getlogin() 60 | print('Hey!', you) 61 | file = input('Path of file to be added to startup : ') 62 | workingDir = make_working_dir(file) 63 | file = remove_quotes(file) 64 | workingDir = remove_quotes(workingDir) 65 | name = input('Name your Shortcut : ') 66 | make_shortcut(file, workingDir, name) 67 | print(name, 'added to Startup Successfully !!') 68 | 69 | 70 | if __name__ == '__main__': 71 | main() 72 | -------------------------------------------------------------------------------- /AddToTaskabr/AddToTaskbar.py: -------------------------------------------------------------------------------- 1 | """ 2 | Scripts written By : Aashutosh Rathi 3 | Credits : Stack Overflow and Me. 4 | """ 5 | 6 | 7 | import os 8 | import time 9 | import winshell 10 | import shutil 11 | from win32com.client import Dispatch 12 | 13 | 14 | def remove_quotes(string): 15 | """ 16 | This function is used here to remove quotes from 17 | paths used in this script. 18 | 19 | :param string: Path with quotes. 20 | :return: Path without quotes. 21 | """ 22 | if string.startswith('"'): 23 | string = string[1:] 24 | 25 | if string.endswith('"'): 26 | string = string[:-1] 27 | return string 28 | 29 | 30 | def find_symbol(path): 31 | for x in range(len(path)-1): 32 | if path[x] == "\\": 33 | result = x 34 | return result 35 | 36 | 37 | def make_working_dir(file_path): 38 | sym = find_symbol(file_path) 39 | return file_path[:sym] 40 | 41 | 42 | def addToTaskbar(file_path, dir_path, name): 43 | you = os.getlogin() 44 | startup = os.path.join('C:\\Users', you, 'AppData', 'Roaming', 45 | 'Microsoft', 'Internet Explorer', 'Quick Launch', 46 | 'User Pinned', 'TaskBar') 47 | name = name + '.lnk' 48 | path = os.path.join(startup, name) 49 | shell = Dispatch('WScript.Shell') 50 | shortcut = shell.CreateShortCut(path) 51 | shortcut.Targetpath = file_path 52 | shortcut.WorkingDirectory = dir_path 53 | shortcut.IconLocation = file_path 54 | shortcut.save() 55 | 56 | 57 | def main(): 58 | print("\n===== Add Your files or Folders to Taskbar in easy way =====") 59 | you = os.getlogin() 60 | print('Hey!', you) 61 | file = input('Path of folder to be added to SendTo : ') 62 | workingDir = make_working_dir(file) 63 | file = remove_quotes(file) 64 | workingDir = remove_quotes(workingDir) 65 | name = input('File/Folder Name : ') 66 | addToTaskbar(file, workingDir, name) 67 | print(name, 'added to SendTo Successfully !!') 68 | 69 | 70 | if __name__ == '__main__': 71 | main() 72 | -------------------------------------------------------------------------------- /_layouts/default.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | {% seo %} 8 | 9 | 10 | 11 | 12 | 15 | 16 | 17 |
18 |
19 |

{{ site.title | default: site.github.repository_name }}

20 |

{{ site.description | default: site.github.project_tagline }}

21 | 22 | {% if site.github.is_project_page %} 23 |

View the Project on GitHub {{ github_name }}

24 | {% endif %} 25 | 26 | {% if site.github.is_user_page %} 27 |

View My GitHub Profile

28 | {% endif %} 29 | 30 | {% if site.show_downloads %} 31 | 36 | {% endif %} 37 |
38 |
39 | 40 | {{ content }} 41 | 42 |
43 | 49 |
50 | 51 | 52 | 53 | {% if site.google_analytics %} 54 | 63 | {% endif %} 64 | 65 | 66 | -------------------------------------------------------------------------------- /CONTRIBUTE.md: -------------------------------------------------------------------------------- 1 | **Contributing to Python-Scripts-and-Games** 2 | 3 | :+1::tada: First off, thanks for taking the time to contribute! :tada::+1: 4 | 5 | The following is a set of guidelines for contributing to Python-Scripts-and-Games and its packages, which are hosted in the Python-Scripts-and-Games Organization on GitHub. These are mostly guidelines, not rules. Use your best judgment, and feel free to propose changes to this document in a pull request. 6 | 7 | ### Table Of Contents 8 | 9 | - Code of Conduct 10 | - I don't want to read this whole thing, I just have a question!!! 11 | - What should I know before I get started? 12 | - How Can I Contribute? 13 | - Pull Requests 14 | - Styleguides 15 | - Issue and Pull Request Labels 16 | 17 | ### Code of Conduct 18 | 19 | In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. 20 | 21 | ### I don't want to read this whole thing I just have a question!!! 22 | 23 | Note: Please don't file an issue to ask a question. You'll get faster results by using the resources below. 24 | 25 | Even though Slack is a chat service, sometimes it takes several hours for community members to respond — please be patient! 26 | Use the #scripts channel for general questions or discussion about Scripts 27 | Use the #games channel for questions about Games 28 | Use the #packages channel for questions or discussion about writing or contributing to packages (both core and community) 29 | Use the #ui channel for questions and discussion about UI and themes 30 | 31 | ### Pull Requests 32 | 33 | Do not include issue numbers in the PR title 34 | Include screenshots and animated GIFs in your pull request whenever possible. 35 | Follow the Python styleguides. 36 | Include thoughtfully-worded. 37 | Document new code based on the Documentation Styleguide 38 | End all files with a newline 39 | Avoid platform-dependent code 40 | -Place requires in the following order: 41 | Built in Node Modules (such as path) 42 | Local Modules (using relative paths) 43 | -Place class properties in the following order: 44 | Class methods and properties 45 | Instance methods and properties 46 | 47 | ### Styleguides 48 | 49 | Git Commit Messages 50 | 51 | Use the present tense ("Add feature" not "Added feature") 52 | Use the imperative mood ("Move cursor to..." not "Moves cursor to...") 53 | Limit the first line to 72 characters or less 54 | Reference issues and pull requests liberally after the first line 55 | When only changing documentation 56 | Consider starting the commit message with an applicable emoji: 57 | :art: :art: when improving the format/structure of the code 58 | :racehorse: :racehorse: when improving performance 59 | :non-potable_water: :non-potable_water: when plugging memory leaks 60 | :memo: :memo: when writing docs 61 | :penguin: :penguin: when fixing something on Linux 62 | 63 | ### Issue and Pull Request Labels 64 | 65 | This section lists the labels we use to help us track and manage issues and pull requests. Most labels are used across all repositories. 66 | 67 | GitHub search makes it easy to use labels for finding groups of issues or pull requests you're interested in. 68 | The labels are loosely grouped by their purpose, but it's not required that every issue have a label from every group or that an issue can't have more than one label from the same group. 69 | -------------------------------------------------------------------------------- /RPSLS/RPSLS.py: -------------------------------------------------------------------------------- 1 | # Rock Paper Scissors Lizard Spock Game 2 | # Game Designer : Sam Kass 3 | # Mini Project Idea : Coursera 4 | 5 | from random import randint 6 | import webbrowser 7 | 8 | 9 | def rules(): 10 | print('======= Rules and Regulations =======') 11 | print('Rock CRUSHES Scissor') 12 | print('Rock CRUSHES Lizard') 13 | print('Paper COVERS Rock') 14 | print('Paper DISPROVES Spock') 15 | print('Scissor CUTS Paper') 16 | print('Scissor DECAPITATES Lizard') 17 | print('Lizard POISONS Spock') 18 | print('Lizard EATS Paper') 19 | print('Spock SMASHES Scissor') 20 | print('Spock Vaporises Rock') 21 | print('All TIEs with same.') 22 | 23 | 24 | def what_happened(user, comp): 25 | nuser = name_to_num(user) 26 | ncomp = name_to_num(comp) 27 | if (nuser is 0 and ncomp is 4) or (nuser is 4 and ncomp is 0): 28 | print('Rock CRUSHES Scissor') 29 | elif (nuser is 0 and ncomp is 3) or (nuser is 3 and ncomp is 0): 30 | print('Rock CRUSHES Lizard') 31 | elif (nuser is 2 and ncomp is 0) or (nuser is 0 and ncomp is 2): 32 | print('Paper COVERS Rock') 33 | elif (nuser is 2 and ncomp is 1) or (nuser is 1 and ncomp is 2): 34 | print('Paper DISPROVES Spock') 35 | elif (nuser is 2 and ncomp is 4) or (nuser is 4 and ncomp is 2): 36 | print('Scissor CUTS Paper') 37 | elif (nuser is 3 and ncomp is 4) or (nuser is 4 and ncomp is 3): 38 | print('Scissor DECAPITATES Lizard') 39 | elif (nuser is 3 and ncomp is 1) or (nuser is 1 and ncomp is 3): 40 | print('Lizard POISONS Spock') 41 | elif (nuser is 3 and ncomp is 2) or (nuser is 2 and ncomp is 3): 42 | print('Lizard EATS Paper') 43 | elif (nuser is 1 and ncomp is 4) or (nuser is 4 and ncomp is 1): 44 | print('Spock SMASHES Scissor') 45 | elif (nuser is 1 and ncomp is 0) or (nuser is 0 and ncomp is 1): 46 | print('Spock Vaporises Rock') 47 | else: 48 | print(user + TIES + comp) 49 | 50 | 51 | def num_to_name(num): 52 | if num == 0: 53 | cname = 'rock' 54 | elif num == 1: 55 | cname = 'spock' 56 | elif num == 2: 57 | cname = 'paper' 58 | elif num == 3: 59 | cname = 'lizard' 60 | elif num == 4: 61 | cname = 'scissors' 62 | return cname 63 | 64 | 65 | def name_to_num(name): 66 | if name.lower() == 'rock': 67 | cnum = 0 68 | elif name.lower() == 'spock': 69 | cnum = 1 70 | elif name.lower() == 'paper': 71 | cnum = 2 72 | elif name.lower() == 'lizard': 73 | cnum = 3 74 | elif name.lower() == 'scissors': 75 | cnum = 4 76 | return cnum 77 | 78 | 79 | def rpsls(): 80 | print('====== RPSLC ======') 81 | print('Choose among Rock, Paper, Scissor, Lizard or Spock ?') 82 | try: 83 | name = raw_input() 84 | except NameError: 85 | name = None 86 | if name is None: 87 | name = input() 88 | player = name_to_num(name) 89 | comp = randint(0, 4) 90 | comp_name = num_to_name(comp) 91 | 92 | print('You ->', name.title()) 93 | print('Computer ->', comp_name.title()) 94 | 95 | what_happened(name, comp_name) 96 | 97 | if (comp + 1) % 5 is player or (comp + 2) % 5 is player: 98 | print('You Won !!!') 99 | elif comp is player: 100 | print('You Tried Well, But its a TIE') 101 | else: 102 | print('Hard Luck, Computer Won !!') 103 | 104 | print() 105 | main() 106 | 107 | 108 | def main(): 109 | print('====== Menu ======') 110 | print('1. Play') 111 | print('2. See Source Code') 112 | print('3. Rules') 113 | print('4. Rules dictation by Sheldon Lee Cooper') 114 | print('5. Exit') 115 | inp = int(input('Enter Choice :')) 116 | if inp is 1: 117 | rpsls() 118 | elif inp is 3: 119 | rules() 120 | elif inp is 4: 121 | webbrowser.open('https://goo.gl/kR2653') 122 | elif inp is 5: 123 | exit() 124 | elif inp is 2: 125 | webbrowser.open('https://goo.gl/4TStoZ') 126 | if inp is not 5: 127 | main() 128 | 129 | 130 | if __name__ == "__main__": 131 | main() 132 | --------------------------------------------------------------------------------