Skip to content

Commit e656929

Browse files
authored
Merge branch 'main' into main
2 parents 460d6e0 + dbac59e commit e656929

File tree

109 files changed

+2242
-87
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

109 files changed

+2242
-87
lines changed

.github/CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
Thank you for showing interest in our project. Any contribution you make means a lot to us and will be reflected in the contributors tab on our repostiroy.
44

5-
This document will give you a detailed overview over how to contribute to our project and have your Pull Request accepted. Please,make sure you have read through thisdocumentation and followed the correct steps before making your first Pull Request in our repository. If you fail to follow the steps mentioned here, it might lead to your Pull Request being declined.
5+
This document will give you a detailed overview over how to contribute to our project and have your Pull Request accepted. Please,make sure you have read through this documentation and followed the correct steps before making your first Pull Request in our repository. If you fail to follow the steps mentioned here, it might lead to your Pull Request being declined.
66

77

88
## New contributors guide
99

10-
See the [README](README.md) to get an overview of the project and find other necessary information. Here are some great resources to get you comfortable with open source contributions:
10+
See the [README](https://github.com/GDSC-RCCIIT/General-Purpose-Scripts/blob/main/README.md) to get an overview of the project and find other necessary information. Here are some great resources to get you comfortable with open source contributions:
1111
- [Finding ways to contribute to open source on GitHub](https://docs.github.com/en/get-started/exploring-projects-on-github/finding-ways-to-contribute-to-open-source-on-github)
1212
- [Set up Git](https://docs.github.com/en/get-started/quickstart/set-up-git)
1313
- [GitHub flow](https://docs.github.com/en/get-started/quickstart/github-flow)

README.md

Lines changed: 57 additions & 33 deletions
Large diffs are not rendered by default.

scripts/Audio Recorder/README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
## How to run
2+
1. Clone the repository
3+
```
4+
git clone [email protected]:GDSC-RCCIIT/General-Purpose-Scripts.git
5+
```
6+
2. Install the script requirements
7+
```
8+
pip install -r requirements.txt
9+
```
10+
3. Navigate to `Audio Recorder` directory
11+
```
12+
cd General-Purpose-Scripts/scripts/Audio Recorder
13+
```
14+
4. Run the script to record audio
15+
```
16+
python audio.py
17+
```

scripts/Audio Recorder/audio.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import time
2+
import sounddevice as sd
3+
import wavio as wv
4+
5+
# Sampling frequency
6+
freq = 45000
7+
8+
# Recording duration
9+
duration = int(input("Enter the duration (in seconds): "))
10+
11+
print("Recording...")
12+
# Start recorder with the given values of duration and sample frequency
13+
recording = sd.rec(int(duration * freq), samplerate=freq, channels=2)
14+
15+
# View timer and record audio for the given number of seconds
16+
while duration:
17+
mins, secs = divmod(duration, 60)
18+
timer = "{:02d}:{:02d}".format(mins, secs)
19+
print(timer, end="\r")
20+
time.sleep(1)
21+
duration -= 1
22+
23+
print("Done!")
24+
num = input("Enter a number for your file name: ")
25+
26+
# Convert the NumPy array to audio file
27+
wv.write("recording" + num + ".wav", recording, freq, sampwidth=2)
28+
29+
print("Saved file as recording" + num + ".wav in the present directory.")
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
sounddevice==0.4.3
2+
wavio==0.0.4

scripts/Auto-Backup/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Auto_Backup
2+
3+
Backups the folder as given by yourself as a path in the input.
4+
Run the script to get a backup in zip format.

scripts/Auto-Backup/autobackup.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import os
2+
import zipfile
3+
4+
5+
def backup(folder):
6+
7+
zip_name = os.path.basename(folder) + ".zip"
8+
destination = input("Enter the destination folder:\n")
9+
10+
print(f"Creating file {zip_name}")
11+
backupzip = zipfile.ZipFile(f"{destination}\\{zip_name}", "w")
12+
13+
for files in os.listdir(folder):
14+
if files.endswith(".zip"):
15+
continue
16+
backupzip.write(files)
17+
if os.path.isdir(files):
18+
for f in os.listdir(files):
19+
backupzip.write(f"{files}\\{f}")
20+
21+
backupzip.close()
22+
print("The zip file has been created in your destination folder.")
23+
24+
25+
source_folder = input("Enter the path of the source folder:\n")
26+
os.chdir(source_folder)
27+
backup(source_folder)
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
## How to run
2+
3+
1. Clone the repository
4+
```
5+
git clone [email protected]:GDSC-RCCIIT/General-Purpose-Scripts.git
6+
```
7+
2. Install the script requirements
8+
```
9+
pip install -r requirements.txt
10+
```
11+
3. Navigate to `Copy to clipboard` directory
12+
```
13+
cd General-Purpose-Scripts/scripts/Copy to clipboard
14+
```
15+
4. Run the script to copy text from the desired file to your clipboard
16+
```
17+
python clipboard.py <file_name>
18+
```
19+
### Note
20+
Replace <file_name> with the name of the file present in the same directory as the script or replace it with the path of the file.
21+
For Linux users, install [xclip](https://linoxide.com/copy-paste-commands-output-xclip-linux/) in your system before running the script.
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import os
2+
import sys
3+
import platform
4+
import subprocess
5+
import pyperclip
6+
7+
# Seeing if the file exists
8+
if os.path.exists(sys.argv[1]):
9+
f = open(sys.argv[1], "r")
10+
f_contents = f.read()
11+
f.close()
12+
else:
13+
print(
14+
"Usage: python clipboard.py file_name\n OR\n python clipboard.py 'path_of_the_file'"
15+
)
16+
exit(1)
17+
18+
whatos = platform.system()
19+
20+
if whatos == "Darwin":
21+
subprocess.run("pbcopy", universal_newlines=True, input=f_contents)
22+
print("Success! Copied to clipboard.")
23+
elif whatos == "Linux":
24+
pyperclip.copy(f_contents)
25+
print("Success! Copied to clipboard.")
26+
elif whatos == "Windows":
27+
subprocess.run("clip", universal_newlines=True, input=f_contents)
28+
print("Success! Copied to clipboard.")
29+
else:
30+
print("Failed! Clipboard not supported.")
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pyperclip==1.8.2

0 commit comments

Comments
 (0)