From d1c9897a7597c1060654e47b1c88635b53d313f5 Mon Sep 17 00:00:00 2001 From: PIYUSH MISHRA <65788721+PIYUSH-MISHRA-00@users.noreply.github.com> Date: Thu, 13 Oct 2022 19:39:56 +0000 Subject: [PATCH 1/4] Git-Automation-Script Git Automation Script for git clone, pull and push for one time configuration and using git from the terminal using a menu driven approach. --- github.sh/README.md | 39 +++++++++++++ github.sh/github.sh | 136 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 175 insertions(+) create mode 100644 github.sh/README.md create mode 100644 github.sh/github.sh diff --git a/github.sh/README.md b/github.sh/README.md new file mode 100644 index 0000000..97db1cf --- /dev/null +++ b/github.sh/README.md @@ -0,0 +1,39 @@ +# Git-Automation +Script to automate Git from project working directory with a menu to choose from, you just have configure once and the script can be used for the following operations. + +``` +Which Git operations you want to perform ? +(0) Configure +(1) Clone +(2) Pull +(3) Push +(4) Exit +Enter your choice [0-4]: +``` + +# About + +* Use the script **"github.sh"** file inside your project working directory to automate git procedures by **just configuring the script once and use it any number of times.** +* You just have to use the configure option once and if you wish to change the working directory you just have to use the configure option to start working with the new project. + +* Just give the file write access and use the script by running: + +``` +$./github.sh +``` + +# How prepare the file + +Use the file as super user or admin acces and provide the file with write access by : +``` +$ chmod +x github.sh +``` +inside the terminal, in the project working directory. + +# How to use the script + +Keep working on project files and run : +``` +$ ./github.sh +``` +in the project working directory's terminal, while the **"github.sh"** file is present and provided with **write access** and you will be able to handle your project files with git operations using a simple menu driven approach. diff --git a/github.sh/github.sh b/github.sh/github.sh new file mode 100644 index 0000000..61cdb88 --- /dev/null +++ b/github.sh/github.sh @@ -0,0 +1,136 @@ +#! /bin/bash + +### Git automation script for automating git clone, push and pull ### +### Created by PIYUSH-MISHRA-00 ### + +while : +do +echo +echo "Which Git operation you want to perform ?" +echo +echo "GitHub username: $username" +echo "Local repository name: $local_repo" +echo "Remote repository name: $remote" +echo "The default branch you want to work with: $branch" +echo "GPG key value: $GPG" +echo +echo -e "\t(0) Configure (configures the script for continuous uses)" +echo -e "\t(1) Clone" +echo -e "\t(2) Pull" +echo -e "\t(3) Push" +echo -e "\t(4) Exit" +echo -n "Enter your choice [0-4]: " + +read choice + +case $choice in + + 0) echo "Enter the values for future use of the script..." + echo + echo "Enter GitHub username: " + read username + export username + echo "Your username is: $username" + echo + echo "Local repository name: " + read local_repo + export local_repo + echo "Your local repository name is: $local_repo" + echo + echo "Remote repository name: " + read remote + export remote + echo "Remote repository name is: $remote" + echo + echo "The default branch you want to work with: " + read branch + export branch + echo "The default branch you want to work with: $branch" + echo + echo "GPG key value is: $GPG" + echo + echo "GPG key id for signed commits(leave blank if you don't want signed commits)" + read GPG + export GPG + echo "GPG key value is: $GPG" + echo + ;; + + 1) echo "Cloning from GitHub" + echo + echo "Enter the repository https url: " + read clone_url + git clone $echo $clone_url;; + + 2) echo "Pulling from GitHub" + echo + echo "Enter the repository https url: " + read pull_url + echo + echo $pull_url + echo + while : + do + echo "Which type of Git Pull you want ?" + echo -e "\t(1) Merge (the default strategy)" + echo -e "\t(2) Rebase" + echo -e "\t(3) Fast-forward only" + echo -e "\t(4) Return to main menu" + echo -n "Enter your choice [1-4]: " + read pull_choice + case $pull_choice in + 1) + git config pull.rebase false + git pull $echo "$pull_url";; + 2) + git config pull.rebase true + git pull $echo "$pull_url";; + 3) + git config pull.ff only + git pull $echo "$pull_url";; + 4) + break + ;; + *) + echo "Invalid operation" + ;; + esac + done + ;; + + 3) echo "Pushing to GitHub" + declare -A map + + map[$echo"$local_repo"] = $echo"$remote" + + git config --global user.name $echo"$username" + git config --global user.signingkey $echo$GPG + git init + git add . + echo "Enter Commit message: " + read message + git commit -m $echo "$message" + echo "Enter Tag name: (Press enter if you want to skip the tag name)" + read tag + echo "Enter Tag message: (Press enter if you want to skip the tag message)" + read tag_message + git tag -a $echo$tag -m "$echo$tag_message" + git tag -n + + for i in "${!map[@]}" + do + git remote add $i https://github.com/$echo$username/${map[$i]}.git + git push -u $i $echo$branch + done + + git push;; + + 4) echo "Quitting..." + exit + ;; + + *) echo "Invalid operation" + ;; + + esac + done \ No newline at end of file From 4b9ad1bd5d714fc69350c753431705f69dfbab08 Mon Sep 17 00:00:00 2001 From: PIYUSH MISHRA <65788721+PIYUSH-MISHRA-00@users.noreply.github.com> Date: Thu, 13 Oct 2022 19:45:26 +0000 Subject: [PATCH 2/4] ni_sh_a.char IDE for Python A basic Python interpreter to execute your Python codes --- ni_sh_a.char/README.md | 2 ++ ni_sh_a.char/main.py | 69 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+) create mode 100644 ni_sh_a.char/README.md create mode 100644 ni_sh_a.char/main.py diff --git a/ni_sh_a.char/README.md b/ni_sh_a.char/README.md new file mode 100644 index 0000000..26ca978 --- /dev/null +++ b/ni_sh_a.char/README.md @@ -0,0 +1,2 @@ +# ni_sh_a.char-IDE +A simple IDE to execute Python codes diff --git a/ni_sh_a.char/main.py b/ni_sh_a.char/main.py new file mode 100644 index 0000000..8c872c0 --- /dev/null +++ b/ni_sh_a.char/main.py @@ -0,0 +1,69 @@ +from tkinter import * +from tkinter.filedialog import asksaveasfilename, askopenfilename +import subprocess + +compiler = Tk() +compiler.title('ni_sh_a.char IDE') +file_path = '' + + +def set_file_path(path): + global file_path + file_path = path + + +def open_file(): + path = askopenfilename(filetypes=[('Python Files', '*.py')]) + with open(path, 'r') as file: + code = file.read() + editor.delete('1.0', END) + editor.insert('1.0', code) + set_file_path(path) + + +def save_as(): + if file_path == '': + path = asksaveasfilename(filetypes=[('Python Files', '*.py')]) + else: + path = file_path + with open(path, 'w') as file: + code = editor.get('1.0', END) + file.write(code) + set_file_path(path) + + +def run(): + if file_path == '': + save_prompt = Toplevel() + text = Label(save_prompt, text='Please save your code') + text.pack() + return + command = f'python {file_path}' + process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True) + output, error = process.communicate() + code_output.insert('1.0', output) + code_output.insert('1.0', error) + + +menu_bar = Menu(compiler) + +file_menu = Menu(menu_bar, tearoff=0) +file_menu.add_command(label='Open', command=open_file) +file_menu.add_command(label='Save', command=save_as) +file_menu.add_command(label='Save As', command=save_as) +file_menu.add_command(label='Exit', command=exit) +menu_bar.add_cascade(label='File', menu=file_menu) + +run_bar = Menu(menu_bar, tearoff=0) +run_bar.add_command(label='Run', command=run) +menu_bar.add_cascade(label='Run', menu=run_bar) + +compiler.config(menu=menu_bar) + +editor = Text() +editor.pack() + +code_output = Text(height=10) +code_output.pack() + +compiler.mainloop() \ No newline at end of file From deac280212d4420a218339ccd6c6a399ca12e3be Mon Sep 17 00:00:00 2001 From: PIYUSH MISHRA <65788721+PIYUSH-MISHRA-00@users.noreply.github.com> Date: Thu, 13 Oct 2022 19:47:25 +0000 Subject: [PATCH 3/4] Delete ni_sh_a.char directory --- ni_sh_a.char/README.md | 2 -- ni_sh_a.char/main.py | 69 ------------------------------------------ 2 files changed, 71 deletions(-) delete mode 100644 ni_sh_a.char/README.md delete mode 100644 ni_sh_a.char/main.py diff --git a/ni_sh_a.char/README.md b/ni_sh_a.char/README.md deleted file mode 100644 index 26ca978..0000000 --- a/ni_sh_a.char/README.md +++ /dev/null @@ -1,2 +0,0 @@ -# ni_sh_a.char-IDE -A simple IDE to execute Python codes diff --git a/ni_sh_a.char/main.py b/ni_sh_a.char/main.py deleted file mode 100644 index 8c872c0..0000000 --- a/ni_sh_a.char/main.py +++ /dev/null @@ -1,69 +0,0 @@ -from tkinter import * -from tkinter.filedialog import asksaveasfilename, askopenfilename -import subprocess - -compiler = Tk() -compiler.title('ni_sh_a.char IDE') -file_path = '' - - -def set_file_path(path): - global file_path - file_path = path - - -def open_file(): - path = askopenfilename(filetypes=[('Python Files', '*.py')]) - with open(path, 'r') as file: - code = file.read() - editor.delete('1.0', END) - editor.insert('1.0', code) - set_file_path(path) - - -def save_as(): - if file_path == '': - path = asksaveasfilename(filetypes=[('Python Files', '*.py')]) - else: - path = file_path - with open(path, 'w') as file: - code = editor.get('1.0', END) - file.write(code) - set_file_path(path) - - -def run(): - if file_path == '': - save_prompt = Toplevel() - text = Label(save_prompt, text='Please save your code') - text.pack() - return - command = f'python {file_path}' - process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True) - output, error = process.communicate() - code_output.insert('1.0', output) - code_output.insert('1.0', error) - - -menu_bar = Menu(compiler) - -file_menu = Menu(menu_bar, tearoff=0) -file_menu.add_command(label='Open', command=open_file) -file_menu.add_command(label='Save', command=save_as) -file_menu.add_command(label='Save As', command=save_as) -file_menu.add_command(label='Exit', command=exit) -menu_bar.add_cascade(label='File', menu=file_menu) - -run_bar = Menu(menu_bar, tearoff=0) -run_bar.add_command(label='Run', command=run) -menu_bar.add_cascade(label='Run', menu=run_bar) - -compiler.config(menu=menu_bar) - -editor = Text() -editor.pack() - -code_output = Text(height=10) -code_output.pack() - -compiler.mainloop() \ No newline at end of file From 2bdcfa029a93e324e658850f93062af3fc59de33 Mon Sep 17 00:00:00 2001 From: PIYUSH MISHRA <65788721+PIYUSH-MISHRA-00@users.noreply.github.com> Date: Thu, 13 Oct 2022 19:50:56 +0000 Subject: [PATCH 4/4] ni_sh_a.char IDE for Python A simple and basic interpreter to execute Python codes --- README.md | 54 ++-------------------------------- ni_sh_a.char/main.py | 69 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+), 52 deletions(-) create mode 100644 ni_sh_a.char/main.py diff --git a/README.md b/README.md index b6c0250..26ca978 100644 --- a/README.md +++ b/README.md @@ -1,52 +1,2 @@ -# Code-Collection-hacktoberfest2022 -This repository is for everyone who wants to participate in Hacktoberfest 2022. -
-

Hacktober Fest 2022 For Everyone!πŸ‘‹πŸ‘‹

-
-Its time to contribute!! -

πŸŽ–οΈπŸŽ–οΈRewards ::πŸŽ–οΈπŸŽ–οΈ

-
You can get awesome goodies like T-Shirt and some stickers for FREE!!!🀩🀩
-

πŸ‘¨β€πŸ’»πŸ‘©β€πŸ’»Upload your Projects or DSA related Programs in any LanguageπŸ‘¨β€πŸ’»πŸ‘©β€πŸ’»

-
Use this project to make your first contribution to an open source project on GitHub!!
-
-

What is Hacktoberfest?

-
Hacktoberfest is a month-long celebration of open-source software by DigitalOcean that encourages participation in giving back to the open-source community. Developers get involved by completing pull requests, participating in events, and donating to open source projects.
-
- -
-

Why should you contribute for Hacktoberfest??πŸ€”πŸ€”

-
It encourages developers and also beginners to contribute to open source projects and practice programming by participating in solving problems across projects.
-
- -
-

How to participate??πŸ€”πŸ€”

-

πŸ‘‡πŸ‘‡Steps to follow:πŸ‘‡πŸ‘‡

-

1. Register for Hacktoberfest

-Register Here -

2. Add Project/Program in any Language you like:

-
Add any of your simple or complex Project/Program in any language you like in this repository by clicking "Add File -> Create new File".
- -

4. Create Pull Request:

-
Once you have completed these steps, you are ready to start contributing by clicking on Create Pull Request.
-

5. Give this Project a Star:

-
If you liked working on this project, please share this project as much as you can and star this project to help as many people in opensource as you can.
-

πŸ“πŸ“Notes :: πŸ“πŸ“

-
1. Don't Create Pull Request to update "readme.md" File.
-
2. Upload or Create File in Specified Folders.
-
3. If Specified Folder not Found then Create Folder and then Upload or Create File.
-
4. In case you need to add an external package, install it by using npm. Don't push the complete package file here.
-

- 5. If you are uploading a Leetcode / GFG problem, then please mention it and upload it in the corresponding folder. And also give the file name same as the problem name. -

-
-
-
-
-

Contributors ::

-
- - - -
Thanks for contributing. It's an amazing experience to collaborate with you all!
-
- +# ni_sh_a.char-IDE +A simple IDE to execute Python codes diff --git a/ni_sh_a.char/main.py b/ni_sh_a.char/main.py new file mode 100644 index 0000000..8c872c0 --- /dev/null +++ b/ni_sh_a.char/main.py @@ -0,0 +1,69 @@ +from tkinter import * +from tkinter.filedialog import asksaveasfilename, askopenfilename +import subprocess + +compiler = Tk() +compiler.title('ni_sh_a.char IDE') +file_path = '' + + +def set_file_path(path): + global file_path + file_path = path + + +def open_file(): + path = askopenfilename(filetypes=[('Python Files', '*.py')]) + with open(path, 'r') as file: + code = file.read() + editor.delete('1.0', END) + editor.insert('1.0', code) + set_file_path(path) + + +def save_as(): + if file_path == '': + path = asksaveasfilename(filetypes=[('Python Files', '*.py')]) + else: + path = file_path + with open(path, 'w') as file: + code = editor.get('1.0', END) + file.write(code) + set_file_path(path) + + +def run(): + if file_path == '': + save_prompt = Toplevel() + text = Label(save_prompt, text='Please save your code') + text.pack() + return + command = f'python {file_path}' + process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True) + output, error = process.communicate() + code_output.insert('1.0', output) + code_output.insert('1.0', error) + + +menu_bar = Menu(compiler) + +file_menu = Menu(menu_bar, tearoff=0) +file_menu.add_command(label='Open', command=open_file) +file_menu.add_command(label='Save', command=save_as) +file_menu.add_command(label='Save As', command=save_as) +file_menu.add_command(label='Exit', command=exit) +menu_bar.add_cascade(label='File', menu=file_menu) + +run_bar = Menu(menu_bar, tearoff=0) +run_bar.add_command(label='Run', command=run) +menu_bar.add_cascade(label='Run', menu=run_bar) + +compiler.config(menu=menu_bar) + +editor = Text() +editor.pack() + +code_output = Text(height=10) +code_output.pack() + +compiler.mainloop() \ No newline at end of file