diff --git a/.all-contributorsrc b/.all-contributorsrc
index 6d905e8..07a3236 100644
--- a/.all-contributorsrc
+++ b/.all-contributorsrc
@@ -12,7 +12,8 @@
"avatar_url": "https://avatars.githubusercontent.com/u/65337802?v=4",
"profile": "http://mpotane.github.io",
"contributions": [
- "maintenance"
+ "maintenance",
+ "test"
]
},
{
@@ -86,9 +87,18 @@
"contributions": [
"doc"
]
+ },
+ {
+ "login": "VishMaster17",
+ "name": "VishMaster17",
+ "avatar_url": "https://avatars.githubusercontent.com/u/74035077?v=4",
+ "profile": "https://github.com/VishMaster17",
+ "contributions": [
+ "doc"
+ ]
}
],
- "contributorsPerLine": 7,
+ "contributorsPerLine": 3,
"skipCi": true,
"repoType": "github",
"repoHost": "https://github.com",
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
new file mode 100644
index 0000000..11925d6
--- /dev/null
+++ b/.github/workflows/main.yml
@@ -0,0 +1,19 @@
+name: Learning GitHub Script
+
+on:
+ issues:
+ types: [opened]
+
+jobs:
+ comment:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/github-script@v6
+ with:
+ script: |
+ github.rest.issues.createComment({
+ issue_number: context.issue.number,
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ body: 'π Thanks for reporting!'
+ })
diff --git a/README.md b/README.md
index 3142814..b82422c 100644
--- a/README.md
+++ b/README.md
@@ -1,9 +1,11 @@
## PythonScriptPH π΅π
-[](#contributors-)
+[](#contributors-)
-[](https://www.python.org/) [](https://www.gnu.org/licenses/gpl-3.0.en.html)
+ 
+
+[](https://www.python.org/) [](https://www.gnu.org/licenses/gpl-3.0.en.html)
---
@@ -13,23 +15,31 @@
- [Searching](https://github.com/mpotane/PythonScriptPH/tree/main/Algorithms/Searching)
- [Sorting](https://github.com/mpotane/PythonScriptPH/tree/main/Algorithms/Sorting)
- [Btc To Php](https://github.com/mpotane/PythonScriptPH/tree/main/btc-to-php)
+- [Compress Photo](https://github.com/mpotane/PythonScriptPH/tree/main/compress-photo)
- [Csv To Excel](https://github.com/mpotane/PythonScriptPH/tree/main/csv-to-excel)
- [Csv To Json](https://github.com/mpotane/PythonScriptPH/tree/main/csv-to-json)
- [Detect Language](https://github.com/mpotane/PythonScriptPH/tree/main/detect-language)
- [Filecopy](https://github.com/mpotane/PythonScriptPH/tree/main/filecopy)
- [Img To Pdf](https://github.com/mpotane/PythonScriptPH/tree/main/img-to-pdf)
+- [Json To YAML](https://github.com/mpotane/PythonScriptPH/tree/main/json-to-yaml)
+- [Pdf to docx](https://github.com/mpotane/PythonScriptPH/tree/main/pdf-to-docx)
- [Philippine Flag](https://github.com/mpotane/PythonScriptPH/tree/main/Philippine-flag)
+- [Proof Reader](https://github.com/mpotane/PythonScriptPH/tree/main/proof-reader)
- [Qrcode](https://github.com/mpotane/PythonScriptPH/tree/main/qrcode)
- [Remove Background Image](https://github.com/mpotane/PythonScriptPH/tree/main/remove-background-image)
- [Speed Test](https://github.com/mpotane/PythonScriptPH/tree/main/speed-test)
- [Text To Tagalog](https://github.com/mpotane/PythonScriptPH/tree/main/text-to-tagalog)
- [Usd To Peso](https://github.com/mpotane/PythonScriptPH/tree/main/usd-to-peso)
-- [Youtube Video Downloader](https://github.com/mpotane/PythonScriptPH/tree/main/Youtube-Video-Downloader)
+- [Youtube Video Downloader](https://github.com/mpotane/PythonScriptPH/tree/main/youtube-video-downloader)
+
---
### π― Contribute
-Open for contributions. Create a pull request and I will review the code. π§
+Open for contributions. Create a pull request and I will review the code. [Contributor Guide](./CODE_OF_CONDUCT.md) π§
+
+### π Code of Conduct
+This project and everyone participating in it are governed by the [Contributor Covenant Code of Conduct](./CODE_OF_CONDUCT.md). By participating, you agree to abide by this code of conduct.
---
@@ -41,18 +51,23 @@ Open for contributions. Create a pull request and I will review the code. π§
+
+
diff --git a/Algorithms/Searching/bin_search.py b/algorithms/Searching/bin_search.py
similarity index 100%
rename from Algorithms/Searching/bin_search.py
rename to algorithms/Searching/bin_search.py
diff --git a/Algorithms/Sorting/bubble_sort.py b/algorithms/Sorting/bubble_sort.py
similarity index 100%
rename from Algorithms/Sorting/bubble_sort.py
rename to algorithms/Sorting/bubble_sort.py
diff --git a/Algorithms/Sorting/insertion_sort.py3 b/algorithms/Sorting/insertion_sort.py3
similarity index 100%
rename from Algorithms/Sorting/insertion_sort.py3
rename to algorithms/Sorting/insertion_sort.py3
diff --git a/Algorithms/Sorting/selection_sort.py b/algorithms/Sorting/selection_sort.py
similarity index 100%
rename from Algorithms/Sorting/selection_sort.py
rename to algorithms/Sorting/selection_sort.py
diff --git a/compress-photo/requirements.txt b/compress-photo/requirements.txt
new file mode 100644
index 0000000..dc7fba5
--- /dev/null
+++ b/compress-photo/requirements.txt
@@ -0,0 +1,2 @@
+tkinter
+Pillow
\ No newline at end of file
diff --git a/compress-photo/script.py b/compress-photo/script.py
new file mode 100644
index 0000000..8ed543b
--- /dev/null
+++ b/compress-photo/script.py
@@ -0,0 +1,8 @@
+import PIL
+from PIL import Image
+from tkinter.filedialog import *
+
+
+fl=askopenfilenames()
+img = Image.open(fl[0])
+img.save("output.jpg", "JPEG", optimize = True, quality = 10)
\ No newline at end of file
diff --git a/csv-to-json/script.py b/csv-to-json/script.py
index 9976cd6..55be48a 100644
--- a/csv-to-json/script.py
+++ b/csv-to-json/script.py
@@ -1,5 +1,12 @@
import pandas as pd
# Reading the csv file and converting it to a json file.
-df = pd.read_csv('sample.csv')
-df.to_json('sample.json')
\ No newline at end of file
+
+
+def main():
+ df = pd.read_csv('sample.csv')
+ df.to_json('sample.json')
+
+
+if __name__ == '__main__':
+ main()
diff --git a/json-to-yaml/json-to-yaml.py b/json-to-yaml/json-to-yaml.py
index 5755098..5c96a12 100644
--- a/json-to-yaml/json-to-yaml.py
+++ b/json-to-yaml/json-to-yaml.py
@@ -1,32 +1,18 @@
import json
-import os
-import sys
import yaml
-if len(sys.argv)> 1:
- if os.path.exists(sys.argv[1]):
- source_file = open(sys.argv[1], "r")
- source_content = json.load(source_file)
- source_file.close()
+def main():
+ with open('sample.json', 'r') as file1:
+ with open('sample.yaml', 'w') as file2:
+ json_data = json.loads(file1.read())
+ converted_json_data = json.dumps(json_data)
- else:
- print("ERROR: " + sys.argv[1] + " not found")
- exit(1)
+ yaml_data = yaml.safe_load(converted_json_data)
+ converted_yaml_data = yaml.dump(yaml_data)
-else:
- print("Usage: json2yaml.py [target_file.yaml]")
+ file2.write(converted_yaml_data)
-output = yaml.dump(source_content)
-if len(sys.argv) < 3: - print(output) - -elif os.path.exists(sys.argv[2]): - print("ERROR: " + sys.argv[2] + " already exists") - exit(1) - -else: - target_file = open(sys.argv[2], "w") - target_file.write(output) - target_file.close() \ No newline at end of file +if __name__ == '__main__': + main() diff --git a/json-to-yaml/readme.md b/json-to-yaml/readme.md index 25631b4..ec756b3 100644 --- a/json-to-yaml/readme.md +++ b/json-to-yaml/readme.md @@ -1,6 +1,18 @@ -## JSON to YAML convertor +The code will help to convert json to yaml file. -A simple python script to convert a file from JSON to YAML. +## Installation -Just open the **json-to-yaml.py** file and run it. -Give the name of the folder and other instructions asked. \ No newline at end of file +- Install Python to your system. + +- Install the module **pyyaml** + +- Do it by typing this on Power Shell (for Windows) or Bash (for Linux) + +```bash +python3 -m pip install pyyaml +``` + +Once **pytube** is installed, you can use the script to convert json to yaml. + +###### If you wish to run the program you should delete: +> sample.yaml
\ No newline at end of file
diff --git a/json-to-yaml/requirements.txt b/json-to-yaml/requirements.txt
new file mode 100644
index 0000000..4818cc5
--- /dev/null
+++ b/json-to-yaml/requirements.txt
@@ -0,0 +1 @@
+pyyaml
\ No newline at end of file
diff --git a/json-to-yaml/sample.json b/json-to-yaml/sample.json
new file mode 100644
index 0000000..a354d1c
--- /dev/null
+++ b/json-to-yaml/sample.json
@@ -0,0 +1,5 @@
+{
+ "name" : { "0": "John Doe", "1": "Jane Doe", "2": "Smith" },
+ "age": { "0": 30, "1": 28, "2": 40 },
+ "id": { "0": "111", "1": "222", "2": "333"}
+}
\ No newline at end of file
diff --git a/json-to-yaml/sample.yaml b/json-to-yaml/sample.yaml
new file mode 100644
index 0000000..2259431
--- /dev/null
+++ b/json-to-yaml/sample.yaml
@@ -0,0 +1,12 @@
+age:
+ '0': 30
+ '1': 28
+ '2': 40
+id:
+ '0': '111'
+ '1': '222'
+ '2': '333'
+name:
+ '0': John Doe
+ '1': Jane Doe
+ '2': Smith
diff --git a/pdf-to-docx/requirements.txt b/pdf-to-docx/requirements.txt
new file mode 100644
index 0000000..9c2b9de
--- /dev/null
+++ b/pdf-to-docx/requirements.txt
@@ -0,0 +1 @@
+pdf2docx
\ No newline at end of file
diff --git a/pdf-to-docx/rickroll_4k.docx b/pdf-to-docx/rickroll_4k.docx
new file mode 100644
index 0000000..63d29a5
Binary files /dev/null and b/pdf-to-docx/rickroll_4k.docx differ
diff --git a/pdf-to-docx/rickroll_4k.pdf b/pdf-to-docx/rickroll_4k.pdf
new file mode 100644
index 0000000..8723527
Binary files /dev/null and b/pdf-to-docx/rickroll_4k.pdf differ
diff --git a/pdf-to-docx/script.py b/pdf-to-docx/script.py
new file mode 100644
index 0000000..aebaa0b
--- /dev/null
+++ b/pdf-to-docx/script.py
@@ -0,0 +1,13 @@
+from pdf2docx import Converter
+
+
+def main():
+ pdf_file = 'rickroll_4k.pdf'
+ docx_file = 'rickroll_4k.docx'
+ cv = Converter(pdf_file)
+ cv.convert(docx_file)
+ cv.close()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/Philippine-flag/phflag.py b/philippine-flag/phflag.py
similarity index 100%
rename from Philippine-flag/phflag.py
rename to philippine-flag/phflag.py
diff --git a/proof-reader/requirements.txt b/proof-reader/requirements.txt
new file mode 100644
index 0000000..39941b8
--- /dev/null
+++ b/proof-reader/requirements.txt
@@ -0,0 +1 @@
+lmproof
\ No newline at end of file
diff --git a/proof-reader/script.py b/proof-reader/script.py
new file mode 100644
index 0000000..1797492
--- /dev/null
+++ b/proof-reader/script.py
@@ -0,0 +1,10 @@
+import lmproof
+
+
+def proofread(text):
+ proofread = lmproof.load("en")
+ correction = proofread.proofread(text)
+ print("Original: {}".format(text))
+ print("Correction: {}".format(correction))
+
+proofread("Your Text")
\ No newline at end of file
diff --git a/soundrecorder/script.py b/soundrecorder/script.py
new file mode 100644
index 0000000..5c7a153
--- /dev/null
+++ b/soundrecorder/script.py
@@ -0,0 +1,14 @@
+import sounddevice
+from scipy.io.wavfile import write
+
+
+def main():
+ fs = 44100 # Sample rate
+ seconds = 10 # Duration of recording
+
+ myrecording = sounddevice.rec(int(seconds * fs), samplerate=fs, channels=2)
+ sounddevice.wait() # Wait until recording is finished
+ write("output.wav", fs, myrecording) # Save as WAV file
+
+if __name__ == "__main__":
+ main()
\ No newline at end of file
diff --git a/Youtube-Video-Downloader/README.md b/youtube-video-downloader/README.md
similarity index 100%
rename from Youtube-Video-Downloader/README.md
rename to youtube-video-downloader/README.md
diff --git a/Youtube-Video-Downloader/download_video.py b/youtube-video-downloader/download_video.py
similarity index 100%
rename from Youtube-Video-Downloader/download_video.py
rename to youtube-video-downloader/download_video.py
diff --git a/Youtube-Video-Downloader/requirements.txt b/youtube-video-downloader/requirements.txt
similarity index 100%
rename from Youtube-Video-Downloader/requirements.txt
rename to youtube-video-downloader/requirements.txt