Merge branch 'master' of https://github.com/devtayade/daily-python-scripts
38
.github/workflows/checker.yml
vendored
Normal file
|
@ -0,0 +1,38 @@
|
|||
name: PR has a valid Issue?
|
||||
|
||||
on:
|
||||
pull_request_target:
|
||||
types: [ edited, synchronize, opened, reopened ]
|
||||
|
||||
jobs:
|
||||
checker:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Issue Validator
|
||||
uses: HarshCasper/validate-issues-over-pull-requests@v0.1.1
|
||||
id: validator
|
||||
with:
|
||||
prbody: ${{ github.event.pull_request.body }}
|
||||
prurl: ${{ github.event.pull_request.url }}
|
||||
|
||||
- name: PR has a valid Issue
|
||||
if: ${{ steps.validator.outputs.valid == 1 }}
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
PRNUM: ${{ github.event.pull_request.number }}
|
||||
run: |
|
||||
gh pr edit $PRNUM --add-label "PR:Ready-to-Review"
|
||||
gh pr edit $PRNUM --add-label "hacktoberfest-accepted"
|
||||
gh pr edit $PRNUM --remove-label "PR:No-Issue"
|
||||
|
||||
- name: PR has no valid Issue
|
||||
if: ${{ steps.validator.outputs.valid == 0 }}
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
PRNUM: ${{ github.event.pull_request.number }}
|
||||
run: |
|
||||
gh pr comment $PRNUM --body "PR is not linked to any issue, please make the corresponding changes in the body."
|
||||
gh pr edit $PRNUM --add-label "PR:No-Issue"
|
12
.github/workflows/greetings.yml
vendored
|
@ -17,9 +17,11 @@ jobs:
|
|||
issue-message: |
|
||||
Thank you for opening your first issue in our repository, one of our maintainers will get in touch with you soon.
|
||||
|
||||
*PLEASE DON'T FORGET TO ADD YOUR EMAIL USING THE AUTH LINK*
|
||||
|
||||
We at Metafy have some special rewards and swags for the top contributors in general repos and every contributor in web3 repos
|
||||
For being eligible for that, please authenticate yourself using this link:
|
||||
https://hacktoberfest.auth.metafy.social
|
||||
https://metafy.social/signup
|
||||
|
||||
Rewards : T-shirts & NFT ( for blockchain contributions )
|
||||
|
||||
|
@ -27,12 +29,14 @@ jobs:
|
|||
For further queries you can join our discord for support : https://discord.gg/W6PmEjjQsA
|
||||
pr-message: |
|
||||
Thank you for opening your first pull request in our repository, one of our maintainers will get in touch with you soon.
|
||||
|
||||
|
||||
*PLEASE DON'T FORGET TO ADD YOUR EMAIL USING THE AUTH LINK*
|
||||
|
||||
We at Metafy have some special rewards and swags for the top contributors in general repos and every contributor in web3 repos
|
||||
For being eligible for that, please authenticate yourself using this link:
|
||||
https://hacktoberfest.auth.metafy.social
|
||||
https://metafy.social/signup
|
||||
|
||||
Rewards : T-shirts & NFT ( for blockchain contributions )
|
||||
|
||||
Best of luck on your Contributions
|
||||
For further queries you can join our discord for support : https://discord.gg/W6PmEjjQsA
|
||||
For further queries you can join our discord for support : https://discord.gg/W6PmEjjQsA
|
||||
|
|
2
.gitignore
vendored
|
@ -127,3 +127,5 @@ dmypy.json
|
|||
|
||||
# Pyre type checker
|
||||
.pyre/
|
||||
|
||||
.idea
|
||||
|
|
|
@ -29,8 +29,8 @@ You can sign up anytime between October 1 and October 31. Just be sure to sign u
|
|||
* Pull requests that are disruptive e.g. taking someone else's branch/commits and making a pull request.
|
||||
* Pull requests that are regarded by a project maintainer as a hindrance vs. helping.
|
||||
* Something that's clearly an attempt to simply +1 your pull request count for October.
|
||||
* Last but not least, one pull request to fix a typo is fine, but 5 pull requests to remove a stray whitespace is not.
|
||||
|
||||
|
||||
### Note
|
||||
|
||||
**A pull request is considered approved once it has an overall approving review from maintainers, or has been merged by maintainers, or has been given the 'hacktoberfest-accepted' label. A pull request with any label containing the word 'spam' or 'invalid' will be considered ineligible for Hacktoberfest.**
|
||||
**A pull request is considered approved once it has an overall approving review from maintainers, or has been merged by maintainers, or has been given the 'hacktoberfest-accepted' label. A pull request with any label containing the word 'spam' or 'invalid' will be considered ineligible for Hacktoberfest.**
|
||||
|
|
518
README.md
|
@ -52,6 +52,20 @@ Thanks a lot for spending your time helping! Keep rocking 🍻
|
|||
<sub><b>Advaita Saha</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/bartick">
|
||||
<img src="https://avatars.githubusercontent.com/u/69100224?v=4" width="100;" alt="bartick"/>
|
||||
<br />
|
||||
<sub><b>Bartick Maiti</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/PGautam27">
|
||||
<img src="https://avatars.githubusercontent.com/u/92343715?v=4" width="100;" alt="PGautam27"/>
|
||||
<br />
|
||||
<sub><b>P Gautam</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/priddhesh">
|
||||
<img src="https://avatars.githubusercontent.com/u/109747774?v=4" width="100;" alt="priddhesh"/>
|
||||
|
@ -60,10 +74,46 @@ Thanks a lot for spending your time helping! Keep rocking 🍻
|
|||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/bartick">
|
||||
<img src="https://avatars.githubusercontent.com/u/69100224?v=4" width="100;" alt="bartick"/>
|
||||
<a href="https://github.com/agnxsh">
|
||||
<img src="https://avatars.githubusercontent.com/u/80243668?v=4" width="100;" alt="agnxsh"/>
|
||||
<br />
|
||||
<sub><b>Bartick Maiti</b></sub>
|
||||
<sub><b>Agnish Ghosh</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/rahulkarda">
|
||||
<img src="https://avatars.githubusercontent.com/u/76204863?v=4" width="100;" alt="rahulkarda"/>
|
||||
<br />
|
||||
<sub><b>Rahul Karda</b></sub>
|
||||
</a>
|
||||
</td></tr>
|
||||
<tr>
|
||||
<td align="center">
|
||||
<a href="https://github.com/muratonuryildirim">
|
||||
<img src="https://avatars.githubusercontent.com/u/77264793?v=4" width="100;" alt="muratonuryildirim"/>
|
||||
<br />
|
||||
<sub><b>Murat Onur Yildirim</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/Ayudh-65">
|
||||
<img src="https://avatars.githubusercontent.com/u/68161774?v=4" width="100;" alt="Ayudh-65"/>
|
||||
<br />
|
||||
<sub><b>Null</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/vallabhiaf">
|
||||
<img src="https://avatars.githubusercontent.com/u/10003129?v=4" width="100;" alt="vallabhiaf"/>
|
||||
<br />
|
||||
<sub><b>Vallabh Chugh</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/N00rAhmed">
|
||||
<img src="https://avatars.githubusercontent.com/u/86896171?v=4" width="100;" alt="N00rAhmed"/>
|
||||
<br />
|
||||
<sub><b>Noor Ahmed</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
|
@ -73,6 +123,21 @@ Thanks a lot for spending your time helping! Keep rocking 🍻
|
|||
<sub><b>Abhishek Kushwaha</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/Khushi260">
|
||||
<img src="https://avatars.githubusercontent.com/u/94845508?v=4" width="100;" alt="Khushi260"/>
|
||||
<br />
|
||||
<sub><b>Khushi Jha</b></sub>
|
||||
</a>
|
||||
</td></tr>
|
||||
<tr>
|
||||
<td align="center">
|
||||
<a href="https://github.com/yunghog">
|
||||
<img src="https://avatars.githubusercontent.com/u/41548444?v=4" width="100;" alt="yunghog"/>
|
||||
<br />
|
||||
<sub><b>YUNGH OG</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/Farhan-2222">
|
||||
<img src="https://avatars.githubusercontent.com/u/87274221?v=4" width="100;" alt="Farhan-2222"/>
|
||||
|
@ -80,6 +145,27 @@ Thanks a lot for spending your time helping! Keep rocking 🍻
|
|||
<sub><b>Md Farhan Sajid</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/HVbajoria">
|
||||
<img src="https://avatars.githubusercontent.com/u/62978274?v=4" width="100;" alt="HVbajoria"/>
|
||||
<br />
|
||||
<sub><b>Harshavardhan Bajoria</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/raihankhan-rk">
|
||||
<img src="https://avatars.githubusercontent.com/u/34377027?v=4" width="100;" alt="raihankhan-rk"/>
|
||||
<br />
|
||||
<sub><b>Raihan Khan</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/SiddheshKukade">
|
||||
<img src="https://avatars.githubusercontent.com/u/65951872?v=4" width="100;" alt="SiddheshKukade"/>
|
||||
<br />
|
||||
<sub><b>Siddhesh Bhupendra Kuakde</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/ArshErgon">
|
||||
<img src="https://avatars.githubusercontent.com/u/40994679?v=4" width="100;" alt="ArshErgon"/>
|
||||
|
@ -89,10 +175,10 @@ Thanks a lot for spending your time helping! Keep rocking 🍻
|
|||
</td></tr>
|
||||
<tr>
|
||||
<td align="center">
|
||||
<a href="https://github.com/Ayudh-65">
|
||||
<img src="https://avatars.githubusercontent.com/u/68161774?v=4" width="100;" alt="Ayudh-65"/>
|
||||
<a href="https://github.com/Kunalp02">
|
||||
<img src="https://avatars.githubusercontent.com/u/95534553?v=4" width="100;" alt="Kunalp02"/>
|
||||
<br />
|
||||
<sub><b>Null</b></sub>
|
||||
<sub><b>Kunal Patil</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
|
@ -103,17 +189,39 @@ Thanks a lot for spending your time helping! Keep rocking 🍻
|
|||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/muratonuryildirim">
|
||||
<img src="https://avatars.githubusercontent.com/u/77264793?v=4" width="100;" alt="muratonuryildirim"/>
|
||||
<a href="https://github.com/Mr-DJ">
|
||||
<img src="https://avatars.githubusercontent.com/u/28898632?v=4" width="100;" alt="Mr-DJ"/>
|
||||
<br />
|
||||
<sub><b>Murat Onur Yildirim</b></sub>
|
||||
<sub><b>Samuel Jonathan</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/agnxsh">
|
||||
<img src="https://avatars.githubusercontent.com/u/80243668?v=4" width="100;" alt="agnxsh"/>
|
||||
<a href="https://github.com/shreyan-naskar">
|
||||
<img src="https://avatars.githubusercontent.com/u/93477634?v=4" width="100;" alt="shreyan-naskar"/>
|
||||
<br />
|
||||
<sub><b>Agnish Ghosh</b></sub>
|
||||
<sub><b>Shreyan Naskar</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/Icelain">
|
||||
<img src="https://avatars.githubusercontent.com/u/50962640?v=4" width="100;" alt="Icelain"/>
|
||||
<br />
|
||||
<sub><b>Null</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/AFZL210">
|
||||
<img src="https://avatars.githubusercontent.com/u/79896602?v=4" width="100;" alt="AFZL210"/>
|
||||
<br />
|
||||
<sub><b>Mohd Afzal Khan</b></sub>
|
||||
</a>
|
||||
</td></tr>
|
||||
<tr>
|
||||
<td align="center">
|
||||
<a href="https://github.com/MSVelan">
|
||||
<img src="https://avatars.githubusercontent.com/u/92083282?v=4" width="100;" alt="MSVelan"/>
|
||||
<br />
|
||||
<sub><b>Null</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
|
@ -124,19 +232,126 @@ Thanks a lot for spending your time helping! Keep rocking 🍻
|
|||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/HVbajoria">
|
||||
<img src="https://avatars.githubusercontent.com/u/62978274?v=4" width="100;" alt="HVbajoria"/>
|
||||
<a href="https://github.com/Sourodip20kar">
|
||||
<img src="https://avatars.githubusercontent.com/u/104223444?v=4" width="100;" alt="Sourodip20kar"/>
|
||||
<br />
|
||||
<sub><b>Harshavardhan Bajoria</b></sub>
|
||||
<sub><b>Sourodip Kar</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/varunKT001">
|
||||
<img src="https://avatars.githubusercontent.com/u/83509023?v=4" width="100;" alt="varunKT001"/>
|
||||
<br />
|
||||
<sub><b>Varun Tiwari</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/Prajwol-Shrestha">
|
||||
<img src="https://avatars.githubusercontent.com/u/70046321?v=4" width="100;" alt="Prajwol-Shrestha"/>
|
||||
<br />
|
||||
<sub><b>Prajwol Shrestha</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/ighoshsubho">
|
||||
<img src="https://avatars.githubusercontent.com/u/93722719?v=4" width="100;" alt="ighoshsubho"/>
|
||||
<br />
|
||||
<sub><b>Null</b></sub>
|
||||
</a>
|
||||
</td></tr>
|
||||
<tr>
|
||||
<td align="center">
|
||||
<a href="https://github.com/Dishant10">
|
||||
<img src="https://avatars.githubusercontent.com/u/84343829?v=4" width="100;" alt="Dishant10"/>
|
||||
<br />
|
||||
<sub><b>Dishant Nagpal</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/Mysterious-Owl">
|
||||
<img src="https://avatars.githubusercontent.com/u/66870959?v=4" width="100;" alt="Mysterious-Owl"/>
|
||||
<br />
|
||||
<sub><b>Mysterious-Owl</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/PritamP20">
|
||||
<img src="https://avatars.githubusercontent.com/u/102867939?v=4" width="100;" alt="PritamP20"/>
|
||||
<br />
|
||||
<sub><b>Null</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/srishti011">
|
||||
<img src="https://avatars.githubusercontent.com/u/48403800?v=4" width="100;" alt="srishti011"/>
|
||||
<br />
|
||||
<sub><b>Srishti</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/Tiagupt03">
|
||||
<img src="https://avatars.githubusercontent.com/u/98590820?v=4" width="100;" alt="Tiagupt03"/>
|
||||
<br />
|
||||
<sub><b>Tiya Gupta</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/avyayjain">
|
||||
<img src="https://avatars.githubusercontent.com/u/63355322?v=4" width="100;" alt="avyayjain"/>
|
||||
<br />
|
||||
<sub><b>Avyay Jain</b></sub>
|
||||
</a>
|
||||
</td></tr>
|
||||
<tr>
|
||||
<td align="center">
|
||||
<a href="https://github.com/drk1rd">
|
||||
<img src="https://avatars.githubusercontent.com/u/58465650?v=4" width="100;" alt="drk1rd"/>
|
||||
<br />
|
||||
<sub><b>Drk1rd</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/lordvader501">
|
||||
<img src="https://avatars.githubusercontent.com/u/60027612?v=4" width="100;" alt="lordvader501"/>
|
||||
<br />
|
||||
<sub><b>Null</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/rohitgarud21">
|
||||
<img src="https://avatars.githubusercontent.com/u/115347445?v=4" width="100;" alt="rohitgarud21"/>
|
||||
<br />
|
||||
<sub><b>Null</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/tolgakurtuluss">
|
||||
<img src="https://avatars.githubusercontent.com/u/22731161?v=4" width="100;" alt="tolgakurtuluss"/>
|
||||
<br />
|
||||
<sub><b>Null</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/srinjoy-26">
|
||||
<img src="https://avatars.githubusercontent.com/u/91176055?v=4" width="100;" alt="srinjoy-26"/>
|
||||
<br />
|
||||
<sub><b>Srinjoy Pati</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/Shradha-Suman">
|
||||
<img src="https://avatars.githubusercontent.com/u/103067896?v=4" width="100;" alt="Shradha-Suman"/>
|
||||
<br />
|
||||
<sub><b>Shradha</b></sub>
|
||||
</a>
|
||||
</td></tr>
|
||||
<tr>
|
||||
<td align="center">
|
||||
<a href="https://github.com/NishantPacharne">
|
||||
<img src="https://avatars.githubusercontent.com/u/71060551?v=4" width="100;" alt="NishantPacharne"/>
|
||||
<br />
|
||||
<sub><b>Nishant Pacharne</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/thegeekyb0y">
|
||||
|
@ -153,10 +368,75 @@ Thanks a lot for spending your time helping! Keep rocking 🍻
|
|||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/SiddheshKukade">
|
||||
<img src="https://avatars.githubusercontent.com/u/65951872?v=4" width="100;" alt="SiddheshKukade"/>
|
||||
<a href="https://github.com/Hemant2801">
|
||||
<img src="https://avatars.githubusercontent.com/u/87967889?v=4" width="100;" alt="Hemant2801"/>
|
||||
<br />
|
||||
<sub><b>Siddhesh Bhupendra Kuakde</b></sub>
|
||||
<sub><b>Hemant</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/MayuriKolhe-2003">
|
||||
<img src="https://avatars.githubusercontent.com/u/77161474?v=4" width="100;" alt="MayuriKolhe-2003"/>
|
||||
<br />
|
||||
<sub><b>Mayuri Kolhe</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/theadeyemiolayinka">
|
||||
<img src="https://avatars.githubusercontent.com/u/64863320?v=4" width="100;" alt="theadeyemiolayinka"/>
|
||||
<br />
|
||||
<sub><b>Olayinka Adeyemi</b></sub>
|
||||
</a>
|
||||
</td></tr>
|
||||
<tr>
|
||||
<td align="center">
|
||||
<a href="https://github.com/parinzee">
|
||||
<img src="https://avatars.githubusercontent.com/u/30139280?v=4" width="100;" alt="parinzee"/>
|
||||
<br />
|
||||
<sub><b>Parinthapat P.</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/iamrahul8">
|
||||
<img src="https://avatars.githubusercontent.com/u/72541381?v=4" width="100;" alt="iamrahul8"/>
|
||||
<br />
|
||||
<sub><b>Rahul Kumar</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/riyaroy2086">
|
||||
<img src="https://avatars.githubusercontent.com/u/89868832?v=4" width="100;" alt="riyaroy2086"/>
|
||||
<br />
|
||||
<sub><b>Riya Roy</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/royninja">
|
||||
<img src="https://avatars.githubusercontent.com/u/26019882?v=4" width="100;" alt="royninja"/>
|
||||
<br />
|
||||
<sub><b>Sayan Roy</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/Tanya-1109">
|
||||
<img src="https://avatars.githubusercontent.com/u/107848751?v=4" width="100;" alt="Tanya-1109"/>
|
||||
<br />
|
||||
<sub><b>Tanya Mohanka</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/YashIndane">
|
||||
<img src="https://avatars.githubusercontent.com/u/53041219?v=4" width="100;" alt="YashIndane"/>
|
||||
<br />
|
||||
<sub><b>Yash Indane</b></sub>
|
||||
</a>
|
||||
</td></tr>
|
||||
<tr>
|
||||
<td align="center">
|
||||
<a href="https://github.com/ambushneupane">
|
||||
<img src="https://avatars.githubusercontent.com/u/56769633?v=4" width="100;" alt="ambushneupane"/>
|
||||
<br />
|
||||
<sub><b>Ambush</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
|
@ -166,21 +446,35 @@ Thanks a lot for spending your time helping! Keep rocking 🍻
|
|||
<sub><b>Aswin Shailajan</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/jrafaaael">
|
||||
<img src="https://avatars.githubusercontent.com/u/70046023?v=4" width="100;" alt="jrafaaael"/>
|
||||
<br />
|
||||
<sub><b>Null</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/noobyysauraj">
|
||||
<img src="https://avatars.githubusercontent.com/u/81681419?v=4" width="100;" alt="noobyysauraj"/>
|
||||
<br />
|
||||
<sub><b>Sauraj</b></sub>
|
||||
</a>
|
||||
</td></tr>
|
||||
<tr>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/srinjoy-26">
|
||||
<img src="https://avatars.githubusercontent.com/u/91176055?v=4" width="100;" alt="srinjoy-26"/>
|
||||
<a href="https://github.com/accodes21">
|
||||
<img src="https://avatars.githubusercontent.com/u/101868279?v=4" width="100;" alt="accodes21"/>
|
||||
<br />
|
||||
<sub><b>Srinjoy Pati</b></sub>
|
||||
<sub><b>Aarya Chopkar</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/aimanaisha">
|
||||
<img src="https://avatars.githubusercontent.com/u/94171436?v=4" width="100;" alt="aimanaisha"/>
|
||||
<br />
|
||||
<sub><b>Aiman Aisha</b></sub>
|
||||
</a>
|
||||
</td></tr>
|
||||
<tr>
|
||||
<td align="center">
|
||||
<a href="https://github.com/akashJainAJ11">
|
||||
<img src="https://avatars.githubusercontent.com/u/94193834?v=4" width="100;" alt="akashJainAJ11"/>
|
||||
|
@ -188,12 +482,98 @@ Thanks a lot for spending your time helping! Keep rocking 🍻
|
|||
<sub><b>Akash Jain</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/Rancho2002">
|
||||
<img src="https://avatars.githubusercontent.com/u/92109154?v=4" width="100;" alt="Rancho2002"/>
|
||||
<br />
|
||||
<sub><b>Arijit Ghosh</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/Yaswanth820">
|
||||
<img src="https://avatars.githubusercontent.com/u/55750562?v=4" width="100;" alt="Yaswanth820"/>
|
||||
<br />
|
||||
<sub><b>Balaji Yaswanth Vankala</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/Danuragtiwari">
|
||||
<img src="https://avatars.githubusercontent.com/u/86867000?v=4" width="100;" alt="Danuragtiwari"/>
|
||||
<br />
|
||||
<sub><b>ANURAG TIWARI</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/dishant-yadav">
|
||||
<img src="https://avatars.githubusercontent.com/u/97543666?v=4" width="100;" alt="dishant-yadav"/>
|
||||
<br />
|
||||
<sub><b>DISHANT YADAV</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/donheshanthaka">
|
||||
<img src="https://avatars.githubusercontent.com/u/61963664?v=4" width="100;" alt="donheshanthaka"/>
|
||||
<br />
|
||||
<sub><b>Heshanthaka</b></sub>
|
||||
</a>
|
||||
</td></tr>
|
||||
<tr>
|
||||
<td align="center">
|
||||
<a href="https://github.com/Gokul-Ks">
|
||||
<img src="https://avatars.githubusercontent.com/u/73174047?v=4" width="100;" alt="Gokul-Ks"/>
|
||||
<br />
|
||||
<sub><b>Gokul_Zuzu</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/KuSantosh100">
|
||||
<img src="https://avatars.githubusercontent.com/u/97560663?v=4" width="100;" alt="KuSantosh100"/>
|
||||
<br />
|
||||
<sub><b>KUMAR SANTOSH</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/Manice18">
|
||||
<img src="https://avatars.githubusercontent.com/u/91601706?v=4" width="100;" alt="Manice18"/>
|
||||
<br />
|
||||
<sub><b>Manice18</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/NebulaAnish">
|
||||
<img src="https://avatars.githubusercontent.com/u/50112251?v=4" width="100;" alt="NebulaAnish"/>
|
||||
<br />
|
||||
<sub><b>Null</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/LEO1612D">
|
||||
<img src="https://avatars.githubusercontent.com/u/46849277?v=4" width="100;" alt="LEO1612D"/>
|
||||
<br />
|
||||
<sub><b>Nikunj R. Prajapati</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/Morbius00">
|
||||
<img src="https://avatars.githubusercontent.com/u/102956488?v=4" width="100;" alt="Morbius00"/>
|
||||
<br />
|
||||
<sub><b>Raj Saha </b></sub>
|
||||
</a>
|
||||
</td></tr>
|
||||
<tr>
|
||||
<td align="center">
|
||||
<a href="https://github.com/ramonsaraiva">
|
||||
<img src="https://avatars.githubusercontent.com/u/5559120?v=4" width="100;" alt="ramonsaraiva"/>
|
||||
<br />
|
||||
<sub><b>Ramon Saraiva</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/riyajaiswal25">
|
||||
<img src="https://avatars.githubusercontent.com/u/84279900?v=4" width="100;" alt="riyajaiswal25"/>
|
||||
<br />
|
||||
<sub><b>Riya Jaiswal</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/sarthakroy2002">
|
||||
|
@ -202,12 +582,41 @@ Thanks a lot for spending your time helping! Keep rocking 🍻
|
|||
<sub><b>Sarthak Roy</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/Shreejan-35">
|
||||
<img src="https://avatars.githubusercontent.com/u/93109967?v=4" width="100;" alt="Shreejan-35"/>
|
||||
<br />
|
||||
<sub><b>Shreejan Dolai</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/Tejaswi-Kumar">
|
||||
<img src="https://avatars.githubusercontent.com/u/67323842?v=4" width="100;" alt="Tejaswi-Kumar"/>
|
||||
<br />
|
||||
<sub><b>Tejaswi Kumar</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/anjali1102">
|
||||
<img src="https://avatars.githubusercontent.com/u/56559378?v=4" width="100;" alt="anjali1102"/>
|
||||
<br />
|
||||
<sub><b>Anjali Chauhan</b></sub>
|
||||
</a>
|
||||
</td></tr>
|
||||
<tr>
|
||||
<td align="center">
|
||||
<a href="https://github.com/anshrusia200">
|
||||
<img src="https://avatars.githubusercontent.com/u/85791796?v=4" width="100;" alt="anshrusia200"/>
|
||||
<br />
|
||||
<sub><b>Ansh Rusia</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/arpitbhardwaj">
|
||||
<img src="https://avatars.githubusercontent.com/u/23013825?v=4" width="100;" alt="arpitbhardwaj"/>
|
||||
<br />
|
||||
<sub><b>Arpit Bhardwaj</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/artemis-i-guess">
|
||||
|
@ -215,13 +624,41 @@ Thanks a lot for spending your time helping! Keep rocking 🍻
|
|||
<br />
|
||||
<sub><b>Nafis Adnan Mondal</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/biv720">
|
||||
<img src="https://avatars.githubusercontent.com/u/76109778?v=4" width="100;" alt="biv720"/>
|
||||
<br />
|
||||
<sub><b>Null</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/codeswithroh">
|
||||
<img src="https://avatars.githubusercontent.com/u/77570394?v=4" width="100;" alt="codeswithroh"/>
|
||||
<br />
|
||||
<sub><b>Rohit Purkait</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/devtayade">
|
||||
<img src="https://avatars.githubusercontent.com/u/84332795?v=4" width="100;" alt="devtayade"/>
|
||||
<br />
|
||||
<sub><b>Null</b></sub>
|
||||
</a>
|
||||
</td></tr>
|
||||
<tr>
|
||||
<td align="center">
|
||||
<a href="https://github.com/lordvader501">
|
||||
<img src="https://avatars.githubusercontent.com/u/60027612?v=4" width="100;" alt="lordvader501"/>
|
||||
<a href="https://github.com/yashbrid03">
|
||||
<img src="https://avatars.githubusercontent.com/u/65955929?v=4" width="100;" alt="yashbrid03"/>
|
||||
<br />
|
||||
<sub><b>Null</b></sub>
|
||||
<sub><b>Yash Nilesh Brid</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/mclmza">
|
||||
<img src="https://avatars.githubusercontent.com/u/7353871?v=4" width="100;" alt="mclmza"/>
|
||||
<br />
|
||||
<sub><b>Michele Mazza</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
|
@ -231,6 +668,28 @@ Thanks a lot for spending your time helping! Keep rocking 🍻
|
|||
<sub><b>Null</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/MubeenAhmad571">
|
||||
<img src="https://avatars.githubusercontent.com/u/56739319?v=4" width="100;" alt="MubeenAhmad571"/>
|
||||
<br />
|
||||
<sub><b>Mubeen Ahmad</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/nabroleonx">
|
||||
<img src="https://avatars.githubusercontent.com/u/84567489?v=4" width="100;" alt="nabroleonx"/>
|
||||
<br />
|
||||
<sub><b>Abel Ayalew</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/neocollege">
|
||||
<img src="https://avatars.githubusercontent.com/u/86466839?v=4" width="100;" alt="neocollege"/>
|
||||
<br />
|
||||
<sub><b>Prathamesh Nayak</b></sub>
|
||||
</a>
|
||||
</td></tr>
|
||||
<tr>
|
||||
<td align="center">
|
||||
<a href="https://github.com/smit-sms">
|
||||
<img src="https://avatars.githubusercontent.com/u/52400400?v=4" width="100;" alt="smit-sms"/>
|
||||
|
@ -244,6 +703,13 @@ Thanks a lot for spending your time helping! Keep rocking 🍻
|
|||
<br />
|
||||
<sub><b>Sameer Sahu</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/shatanikmahanty">
|
||||
<img src="https://avatars.githubusercontent.com/u/67138059?v=4" width="100;" alt="shatanikmahanty"/>
|
||||
<br />
|
||||
<sub><b>Shatanik Mahanty</b></sub>
|
||||
</a>
|
||||
</td></tr>
|
||||
</table>
|
||||
<!-- readme: contributors -end -->
|
11
scripts/Amazon_price_tracker/README.md
Normal file
|
@ -0,0 +1,11 @@
|
|||
# Amazon Price Tracker
|
||||
|
||||
A price tracker app in python that will keep track your product price and will mail you when the price wents down.
|
||||
|
||||
|
||||
## Usage/Examples
|
||||
|
||||
|
||||
* 3 packages required requests, beautifulsoup, smtplib
|
||||
* Use pip install requests, pip install bs4 and pip install secure-smtplib
|
||||
* run scap.py file
|
50
scripts/Amazon_price_tracker/scap.py
Normal file
|
@ -0,0 +1,50 @@
|
|||
import time
|
||||
import requests # Will help us to get out url directed
|
||||
from bs4 import BeautifulSoup # Will help us to scrap us the data
|
||||
|
||||
import os
|
||||
import smtplib # this module is used for sending mail
|
||||
from email.message import EmailMessage
|
||||
|
||||
email_id = os.environ.get("EMAIL_ADDR")
|
||||
email_pass = os.environ.get("EMAIL_PASS")
|
||||
|
||||
# I have used this since I have hidden my credentials
|
||||
|
||||
URL = "https://www.amazon.in/Apple-MacBook-Chip-13-inch-256GB/dp/B08N5W4NNB/ref=sr_1_3?crid=3BF9J6OT56GW0&keywords=macbook+m1&qid=1665331351&qu=eyJxc2MiOiIzLjgzIiwicXNhIjoiMi43NiIsInFzcCI6IjEuNTIifQ%3D%3D&sprefix=macbook+m1%2Caps%2C3675&sr=8-3"
|
||||
|
||||
def check_price():
|
||||
#Copy url of the product that you are looking for
|
||||
headers = {"user-Agents" : 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36'}
|
||||
|
||||
# Now lets print our product title to veerify that its working
|
||||
page = requests.get(URL, headers = headers)
|
||||
soup = BeautifulSoup(page.content, 'html.parser')
|
||||
|
||||
title = soup.find(class_ = "a-size-large product-title-word-break").get_text()
|
||||
price = soup.find(class_ = "a-price-whole").get_text()
|
||||
converted_price = price[:6].replace(",","") # We don't want comma so we replaced with ""
|
||||
|
||||
print(title.strip())
|
||||
print(converted_price)
|
||||
|
||||
# Now we will send mail if the converted price is less than present price
|
||||
|
||||
if(converted_price < 92890):
|
||||
send_mail()
|
||||
|
||||
def send_mail():
|
||||
message = EmailMessage()
|
||||
message['Subject'] = "Your favourite product is now at cheaper price!!😍"
|
||||
message['From'] = email_id
|
||||
message['to'] = "mobir99513@lutota.com" #Any random email you can give whom you want to send the email
|
||||
message.set_content("Hey check this amazon link : https://www.amazon.in/Apple-MacBook-Chip-13-inch-256GB/dp/B08N5W4NNB/ref=sr_1_3?crid=3BF9J6OT56GW0&keywords=macbook+m1&qid=1665331351&qu=eyJxc2MiOiIzLjgzIiwicXNhIjoiMi43NiIsInFzcCI6IjEuNTIifQ%3D%3D&sprefix=macbook+m1%2Caps%2C3675&sr=8-3")
|
||||
|
||||
|
||||
with smtplib.SMTP_SSL('smtp.gmail.com',465) as smtp: #465 is the port number
|
||||
smtp.login(email_id, email_pass)
|
||||
smtp.send_message(message)
|
||||
|
||||
while True:
|
||||
check_price()
|
||||
time.sleep(10)
|
28
scripts/AudioConverter/README.md
Normal file
|
@ -0,0 +1,28 @@
|
|||
# Audio Converter
|
||||
|
||||
CLI tool to convert an audio file from one extension to another (e.g. mp3 to wav)
|
||||
|
||||
## Requirements
|
||||
- [FFmpeg](https://ffmpeg.org/)
|
||||
|
||||
## Usage
|
||||
|
||||
### Convert all audio files in a specific directory
|
||||
```bash
|
||||
python3 audio-converter.py -p <YOUR-PATH-WAS-HERE> -e <THE-DESIRED-EXTENSION>
|
||||
```
|
||||
|
||||
e.g.
|
||||
```bash
|
||||
python3 audio-converter.py -p /home/username/Music -e .wav
|
||||
```
|
||||
|
||||
### Convert specific audio file
|
||||
```bash
|
||||
python3 audio-converter.py -p <YOUR-PATH-WAS-HERE> -e <THE-DESIRED-EXTENSION>
|
||||
```
|
||||
|
||||
e.g.
|
||||
```bash
|
||||
python3 audio-converter.py -p /home/username/Music/test.mp3 -e .wav
|
||||
```
|
51
scripts/AudioConverter/audio-converter.py
Normal file
|
@ -0,0 +1,51 @@
|
|||
import subprocess
|
||||
import os
|
||||
import argparse
|
||||
|
||||
|
||||
parser = argparse.ArgumentParser(
|
||||
description='A program to convert audio to another audio format'
|
||||
)
|
||||
parser.add_argument(
|
||||
'-p',
|
||||
'--path',
|
||||
type=str,
|
||||
help='''
|
||||
The full path of file to convert OR
|
||||
the full path of folder that contains all files to convert'
|
||||
''',
|
||||
required=True
|
||||
)
|
||||
parser.add_argument(
|
||||
'-e',
|
||||
'--extension',
|
||||
type=str,
|
||||
help='The type of extension to convert the audio',
|
||||
default='.mp3',
|
||||
required=False
|
||||
)
|
||||
|
||||
|
||||
def convert(file, extension):
|
||||
file_name, _ = file.split('.')
|
||||
output_name = file_name + extension
|
||||
subprocess.run(['ffmpeg', '-i', file, output_name])
|
||||
|
||||
|
||||
def convert_all(path, extension):
|
||||
for _, _, files in os.walk(path):
|
||||
for file in files:
|
||||
convert(file, extension)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
args = parser.parse_args()
|
||||
path = args.path
|
||||
extension = args.extension
|
||||
|
||||
os.chdir(os.path.dirname(path))
|
||||
|
||||
if (os.path.isdir(path)):
|
||||
convert_all(path=path, extension=extension)
|
||||
else:
|
||||
convert(file=path, extension=extension)
|
95
scripts/Authentication System using Flask/main.py
Normal file
|
@ -0,0 +1,95 @@
|
|||
from flask import Flask, render_template, redirect, url_for, flash
|
||||
from flask_sqlalchemy import SQLAlchemy
|
||||
from flask_login import UserMixin, LoginManager, login_user, login_required, current_user, logout_user
|
||||
from flask_wtf import FlaskForm
|
||||
from wtforms import StringField, PasswordField, SubmitField
|
||||
from wtforms.validators import ValidationError, InputRequired, Length
|
||||
from flask_bcrypt import Bcrypt
|
||||
|
||||
app = Flask(__name__)
|
||||
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///database.db'
|
||||
db = SQLAlchemy(app)
|
||||
app.config['SECRET_KEY'] = 'YOUR_SECRET_KEY'
|
||||
bcrypt = Bcrypt(app)
|
||||
|
||||
login_manager = LoginManager()
|
||||
login_manager.init_app(app)
|
||||
login_manager.login_view = "login"
|
||||
|
||||
@login_manager.user_loader
|
||||
def load_user(user_id):
|
||||
return User.query.get(int(user_id))
|
||||
|
||||
|
||||
class User(db.Model, UserMixin):
|
||||
id = db.Column(db.Integer, primary_key=True)
|
||||
username = db.Column(db.String(20), nullable=False, unique=True)
|
||||
password = db.Column(db.String(80), nullable=False)
|
||||
|
||||
class RegistrationForm(FlaskForm):
|
||||
username = StringField(validators=[InputRequired(), Length(min=4, max=20)], render_kw={"placeholder": "Username"})
|
||||
password = PasswordField(validators=[InputRequired(), Length(min=4, max=20)], render_kw={"placeholder": "Password"})
|
||||
submit = SubmitField("Register")
|
||||
|
||||
def validate_username(self, username):
|
||||
existing_user_username = User.query.filter_by(username=username.data).first()
|
||||
if existing_user_username:
|
||||
raise ValidationError("That username already exists! Try a different one.")
|
||||
|
||||
class LoginForm(FlaskForm):
|
||||
username = StringField(validators=[InputRequired(), Length(min=4, max=20)], render_kw={"placeholder": "Username"})
|
||||
password = PasswordField(validators=[InputRequired(), Length(min=4, max=20)], render_kw={"placeholder": "Password"})
|
||||
submit = SubmitField("Login")
|
||||
|
||||
@app.route('/')
|
||||
def home():
|
||||
return render_template('home.html')
|
||||
|
||||
@app.route('/dashboard', methods=["GET", "POST"])
|
||||
@login_required
|
||||
def dashboard():
|
||||
return render_template('dashboard.html')
|
||||
|
||||
@app.route('/logout', methods=["GET", "POST"])
|
||||
@login_required
|
||||
def logout():
|
||||
logout_user()
|
||||
return redirect(url_for('login'))
|
||||
|
||||
@app.route('/login', methods=["GET", "POST"])
|
||||
def login():
|
||||
if current_user.is_authenticated:
|
||||
return redirect(url_for('dashboard'))
|
||||
|
||||
form = LoginForm()
|
||||
|
||||
if form.validate_on_submit():
|
||||
user = User.query.filter_by(username=form.username.data).first()
|
||||
if user:
|
||||
if bcrypt.check_password_hash(user.password, form.password.data):
|
||||
login_user(user)
|
||||
return redirect(url_for('dashboard'))
|
||||
else:
|
||||
flash("Incorrect Password! Please Try again")
|
||||
else:
|
||||
flash("This email is not registered. Try Signing Up!")
|
||||
|
||||
return render_template('login.html', form=form)
|
||||
|
||||
@app.route('/register', methods=["GET", "POST"])
|
||||
def register():
|
||||
if current_user.is_authenticated:
|
||||
return redirect(url_for('dashboard'))
|
||||
form = RegistrationForm()
|
||||
|
||||
if form.validate_on_submit():
|
||||
hashed_password = bcrypt.generate_password_hash(form.password.data)
|
||||
new_user = User(username=form.username.data, password=hashed_password)
|
||||
db.session.add(new_user)
|
||||
db.session.commit()
|
||||
return redirect(url_for('login'))
|
||||
|
||||
return render_template('register.html', form=form)
|
||||
|
||||
if __name__ == '__main__':
|
||||
app.run(debug=True)
|
16
scripts/BMI/bmi.py
Normal file
|
@ -0,0 +1,16 @@
|
|||
Height=float(input("Enter your height in centimeters: "))
|
||||
Weight=float(input("Enter your Weight in Kg: "))
|
||||
Height = Height/100
|
||||
BMI=Weight/(Height*Height)
|
||||
print("your Body Mass Index is: ",BMI)
|
||||
if(BMI>0):
|
||||
if(BMI<=16):
|
||||
print("you are severely underweight")
|
||||
elif(BMI<=18.5):
|
||||
print("you are underweight")
|
||||
elif(BMI<=25):
|
||||
print("you are Healthy")
|
||||
elif(BMI<=30):
|
||||
print("you are overweight")
|
||||
else: print("you are severely overweight")
|
||||
else:("enter valid details")
|
4
scripts/BMI/readme.md
Normal file
|
@ -0,0 +1,4 @@
|
|||
BMI calculator with PYTHON
|
||||
|
||||
#Steps :
|
||||
Run - python bmi.py
|
After Width: | Height: | Size: 57 B |
8
scripts/Base_Conversion/README.md
Normal file
|
@ -0,0 +1,8 @@
|
|||
# BASE CONVERSION IN PYTHON
|
||||
- Various functions for interconversion of bases
|
||||
- Conversion of Binary to Decimal
|
||||
- Conversion of Octal to Decimal
|
||||
- Conversion of Hexadecimal to Decimal
|
||||
- Conversion of Decimal to Binary
|
||||
- Conversion of Decimal to Octal
|
||||
- Conversion of Decimal to Hexaecimal
|
162
scripts/Base_Conversion/main.py
Normal file
|
@ -0,0 +1,162 @@
|
|||
|
||||
#Function to calculate x raised to the power y
|
||||
def Power( x , y ) :
|
||||
|
||||
if (y == 0) :
|
||||
return 1
|
||||
|
||||
else :
|
||||
|
||||
ans = x**y
|
||||
return ans
|
||||
|
||||
|
||||
#Function to convert Binary to Decimal
|
||||
def BinaryToDecimal( n ) :
|
||||
|
||||
ans = 0
|
||||
x = 1
|
||||
m = int(n)
|
||||
|
||||
while m > 0 :
|
||||
b = m%10
|
||||
ans += b*x
|
||||
x = x*2
|
||||
m = m//10
|
||||
|
||||
return ans
|
||||
|
||||
|
||||
#Function to convert Octal to Decimal
|
||||
def OctalToDecimal( n ) :
|
||||
|
||||
ans = 0
|
||||
x = 1
|
||||
m = int(n)
|
||||
|
||||
while m > 0 :
|
||||
b = m%10
|
||||
ans += b*x
|
||||
x = x*8
|
||||
m = m//10
|
||||
|
||||
return ans
|
||||
|
||||
|
||||
#Function to convert Hexadecimal to Decimal
|
||||
def HexadecimalToDecimal( n ):
|
||||
|
||||
ans = 0
|
||||
x = 1
|
||||
s = len( n )
|
||||
|
||||
for i in range( s-1 , -1 , -1 ) :
|
||||
if n[i] >= '0' and n[i] <= '9' :
|
||||
ans += x*(int(n[i]))
|
||||
|
||||
elif n[i] >= 'A' and n[i] <= 'F' :
|
||||
ans += x*(ord(n[i]) - ord('A') + 10)
|
||||
|
||||
x = x*16
|
||||
|
||||
return ans
|
||||
|
||||
|
||||
#Function to convert Decimal to Binary
|
||||
def DecimalToBinary( n ) :
|
||||
L = []
|
||||
while(n>0):
|
||||
rem = n%2
|
||||
L.append(rem)
|
||||
n = n//2
|
||||
#L = L[::-1]
|
||||
|
||||
dec = 0
|
||||
for i in range(0,len(L)):
|
||||
dec = dec + L[i]*(10**i)
|
||||
|
||||
return dec
|
||||
|
||||
#Function to convert Decimal to Octal
|
||||
def DecimalToOctal( n ) :
|
||||
|
||||
ans = 0
|
||||
count = 0
|
||||
|
||||
while (n > 0) :
|
||||
lastDigit = n%8
|
||||
ans += lastDigit*(10**(count))
|
||||
n = n//8
|
||||
|
||||
count += 1
|
||||
|
||||
return ans
|
||||
|
||||
|
||||
#Function to convert Decimal to Hexadecimal
|
||||
def DecimaltoHexadecimal( n ) :
|
||||
|
||||
ans = ''
|
||||
|
||||
while (n > 0) :
|
||||
lastDigit = n%16
|
||||
if (lastDigit >= 0 and lastDigit <=9 ) :
|
||||
ans = ans + str(lastDigit)
|
||||
|
||||
elif (lastDigit >= 10 and lastDigit <= 15) :
|
||||
a = chr(ord('A') + (lastDigit-10))
|
||||
ans = ans + a
|
||||
|
||||
n = n//16
|
||||
|
||||
return ans[::-1]
|
||||
|
||||
while True:
|
||||
print('1 -> Calculate Exponents')
|
||||
print('2 -> convert Binary to Decimal ')
|
||||
print('3 -> convert Octal to Decimal ')
|
||||
print('4 -> convert Hexadecimal to Decimal ')
|
||||
print('5 -> convert Decimal to Binary ')
|
||||
print('6 -> convert Decimal to Octal ')
|
||||
print('7 -> convert Decimal to Hexadecimal ')
|
||||
print('0 -> Exit')
|
||||
|
||||
|
||||
n = int(input('\nEnter: '))
|
||||
|
||||
if n == 1:
|
||||
a,b = int(input("Enter Base :\n")),int(input("Enter Superscript : \n"))
|
||||
print("The result is : ",Power(a,b), "\n")
|
||||
|
||||
elif n == 2:
|
||||
b = int(input("Enter Binary Number:\n"))
|
||||
print("Corresponding Decimal Number is : ", BinaryToDecimal(b), "\n")
|
||||
|
||||
elif n == 3:
|
||||
b = int(input("Enter Octal Number:\n"))
|
||||
print("Corresponding Decimal Number is : ", OctalToDecimal(b), "\n")
|
||||
|
||||
elif n == 4:
|
||||
b = (input("Enter Hexadecimal Number:\n"))
|
||||
print("Corresponding Decimal Number is : ", HexadecimalToDecimal(b), "\n")
|
||||
|
||||
elif n == 5:
|
||||
b = int(input("Enter Decimal Number:\n"))
|
||||
print("Corresponding Binary Number is : ", DecimalToBinary(b), "\n")
|
||||
|
||||
elif n == 6:
|
||||
b = int(input("Enter Decimal Number:\n"))
|
||||
print("Corresponding Octal Number is : ", DecimalToOctal(b), "\n")
|
||||
|
||||
elif n == 7:
|
||||
b = int(input("Enter Decimal Number:\n"))
|
||||
print("Corresponding Hexadecimal Number is : ", DecimaltoHexadecimal(b), "\n")
|
||||
|
||||
elif n == 0:
|
||||
|
||||
exit()
|
||||
|
||||
else:
|
||||
print("\nNo such option exists!! ")
|
||||
|
||||
|
13
scripts/Blackjack/README.md
Normal file
|
@ -0,0 +1,13 @@
|
|||
RULES OF THE GAME:
|
||||
|
||||
1. The goal of the game is to add up your cards to the largest number without going over 21.
|
||||
|
||||
2. If the cards in your hand add up to more than 21, then it's called a bust. It means that you lose immediately.
|
||||
|
||||
3. All the cards from 2 to 10 count as their face value.
|
||||
|
||||
4. Jack, Queen and King each count as 10.
|
||||
|
||||
5. Ace is a special card. The Ace can either count as a one towards your total, or it can count as an 11.
|
||||
|
||||
6. Depending on whether, if you've gone over 21 or whether if you're under 21, you can decide which value you want your Ace to represent.
|
11
scripts/Blackjack/art.py
Normal file
|
@ -0,0 +1,11 @@
|
|||
|
||||
logo = """
|
||||
.------. _ _ _ _ _
|
||||
|A_ _ |. | | | | | | (_) | |
|
||||
|( \/ ).-----. | |__ | | __ _ ___| | ___ __ _ ___| | __
|
||||
| \ /|K /\ | | '_ \| |/ _` |/ __| |/ / |/ _` |/ __| |/ /
|
||||
| \/ | / \ | | |_) | | (_| | (__| <| | (_| | (__| <
|
||||
`-----| \ / | |_.__/|_|\__,_|\___|_|\_\ |\__,_|\___|_|\_\\
|
||||
| \/ K| _/ |
|
||||
`------' |__/
|
||||
"""
|
86
scripts/Blackjack/main.py
Normal file
|
@ -0,0 +1,86 @@
|
|||
import random
|
||||
from art import logo
|
||||
|
||||
|
||||
def deal_card():
|
||||
"""Returns a random card from the deck."""
|
||||
cards = [11, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 10, 10]
|
||||
card = random.choice(cards)
|
||||
return card
|
||||
|
||||
|
||||
def calculate_score(cards):
|
||||
"""Take a list of cards and return the score calculated from the cards"""
|
||||
|
||||
if sum(cards) == 21 and len(cards) == 2:
|
||||
return 0
|
||||
|
||||
if 11 in cards and sum(cards) > 21:
|
||||
cards.remove(11)
|
||||
cards.append(1)
|
||||
return sum(cards)
|
||||
|
||||
|
||||
def compare(user_score, computer_score):
|
||||
|
||||
if user_score > 21 and computer_score > 21:
|
||||
return "You went over. You lose 😤"
|
||||
|
||||
if user_score == computer_score:
|
||||
return "Draw 🙃"
|
||||
elif computer_score == 0:
|
||||
return "Lose, opponent has Blackjack 😱"
|
||||
elif user_score == 0:
|
||||
return "Win with a Blackjack 😎"
|
||||
elif user_score > 21:
|
||||
return "You went over. You lose 😭"
|
||||
elif computer_score > 21:
|
||||
return "Opponent went over. You win 😁"
|
||||
elif user_score > computer_score:
|
||||
return "You win 😃"
|
||||
else:
|
||||
return "You lose 😤"
|
||||
|
||||
|
||||
def play_game():
|
||||
|
||||
print(logo)
|
||||
|
||||
user_cards = []
|
||||
computer_cards = []
|
||||
is_game_over = False
|
||||
|
||||
for _ in range(2):
|
||||
user_cards.append(deal_card())
|
||||
computer_cards.append(deal_card())
|
||||
|
||||
while not is_game_over:
|
||||
|
||||
user_score = calculate_score(user_cards)
|
||||
computer_score = calculate_score(computer_cards)
|
||||
print(f" Your cards: {user_cards}, current score: {user_score}")
|
||||
print(f" Computer's first card: {computer_cards[0]}")
|
||||
|
||||
if user_score == 0 or computer_score == 0 or user_score > 21:
|
||||
is_game_over = True
|
||||
else:
|
||||
|
||||
user_should_deal = input(
|
||||
"Type 'y' to get another card, type 'n' to pass: ")
|
||||
if user_should_deal == "y":
|
||||
user_cards.append(deal_card())
|
||||
else:
|
||||
is_game_over = True
|
||||
|
||||
while computer_score != 0 and computer_score < 17:
|
||||
computer_cards.append(deal_card())
|
||||
computer_score = calculate_score(computer_cards)
|
||||
|
||||
print(f" Your final hand: {user_cards}, final score: {user_score}")
|
||||
print(
|
||||
f" Computer's final hand: {computer_cards}, final score: {computer_score}")
|
||||
print(compare(user_score, computer_score))
|
||||
|
||||
|
||||
while input("Do you want to play a game of Blackjack? Type 'y' or 'n': ") == "y":
|
||||
play_game()
|
18
scripts/CMYK To RGB/CMYKtoRGB.py
Normal file
|
@ -0,0 +1,18 @@
|
|||
def CMYKtoRGB(c, m, y, k) :
|
||||
c=float(c)/100.0
|
||||
m=float(m)/100.0
|
||||
y=float(y)/100.0
|
||||
k=float(k)/100.0
|
||||
r=round(255.0-((min(1.0, c*(1.0-k)+k))*255.0))
|
||||
g=round(255.0-((min(1.0, m*(1.0-k)+k))*255.0))
|
||||
b=round(255.0-((min(1.0, y*(1.0-k)+k))*255.0))
|
||||
return (r,g,b)
|
||||
|
||||
print("Welcome To CMYK to RGB Convertor || INPUT CMYK codes and rest leave it to the convertor\n")
|
||||
c=int(input("C Value: "))
|
||||
m=int(input("M Value: "))
|
||||
y=int(input("Y Value: "))
|
||||
k=int(input("K Value: "))
|
||||
|
||||
print("Processing...")
|
||||
print("\nYour RGB values are", CMYKtoRGB(c,m,y,k))
|
9
scripts/CMYK To RGB/README.md
Normal file
|
@ -0,0 +1,9 @@
|
|||
# CMKY to RGB
|
||||
This is a simple python script, that allows the user to covert CMYK color values into RGB values.
|
||||
|
||||
## Usage
|
||||
|
||||
* No additional package reqd. Just the script
|
||||
* Run `CMYKtoRGB.py`
|
||||
* Input the CMYK values, when asked
|
||||
* There you go, RGB Value is provided
|
10
scripts/Caeser_Cipher_sage/README.md
Normal file
|
@ -0,0 +1,10 @@
|
|||
## Caeser Cipher files ADDED #348
|
||||
|
||||
## Caeser Cipher
|
||||
Easilly Generate Caecer Cipher equivalent for any text
|
||||
|
||||
|
||||
## Installation
|
||||
- Clone the repo
|
||||
- download the requirements
|
||||
- run `python cc.py`
|
62
scripts/Caeser_Cipher_sage/cc.py
Normal file
|
@ -0,0 +1,62 @@
|
|||
# @author https://github.com/theadeyemiolayinka
|
||||
|
||||
from statistics import mode
|
||||
|
||||
|
||||
class Caesar():
|
||||
|
||||
def __init__(self):
|
||||
self.LETTERS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
|
||||
self.translated = ''
|
||||
|
||||
def __crypt(self, mode):
|
||||
for symbol in self.message.upper():
|
||||
if symbol in self.LETTERS:
|
||||
num = self.LETTERS.find(symbol)
|
||||
if mode == 'encrypt':
|
||||
num = num + self.key
|
||||
elif mode == 'decrypt':
|
||||
num = num - self.key
|
||||
|
||||
if num >= len(self.LETTERS):
|
||||
num = num - len(self.LETTERS)
|
||||
elif num < 0:
|
||||
num = num + len(self.LETTERS)
|
||||
|
||||
self.translated = self.translated + self.LETTERS[num]
|
||||
else:
|
||||
self.translated = self.translated + symbol
|
||||
|
||||
return self.translated
|
||||
|
||||
def encrypt(self, message, key=0):
|
||||
self.translated = ''
|
||||
self.key = key
|
||||
self.message = message
|
||||
return self.__crypt('encrypt')
|
||||
|
||||
def decrypt(self, message, key=0):
|
||||
self.translated = ''
|
||||
self.key = key
|
||||
self.message = message
|
||||
return self.__crypt('decrypt')
|
||||
|
||||
def invokeCipher(cipher, key, text, e_mode):
|
||||
if e_mode == 'E' or e_mode == 'e':
|
||||
print('\n====================RESULT====================')
|
||||
return cipher.encrypt(text, key)
|
||||
elif e_mode == 'D' or e_mode == 'd':
|
||||
print('\n====================RESULT====================')
|
||||
return cipher.decrypt(text, key)
|
||||
else:
|
||||
print('Ivalid mode.')
|
||||
n_mode = str(input("Enter mode: [E] for encryption and [D] for decryption:\n>"))
|
||||
return invokeCipher(cipher, key, text, n_mode)
|
||||
|
||||
cipher = Caesar()
|
||||
key = int(input('Enter encryption key:\n>'))
|
||||
text = str(input('Enter text:\n>'))
|
||||
e_mode = str(input("Enter mode: [E] for encryption and [D] for decryption:\n>"))
|
||||
|
||||
print(invokeCipher(cipher, key, text, e_mode))
|
||||
print('==============================================')
|
56
scripts/Calender/calender.py
Normal file
|
@ -0,0 +1,56 @@
|
|||
from tkinter import *
|
||||
import tkinter as tk
|
||||
from PIL import ImageTk, Image
|
||||
import calendar
|
||||
root = tk.Tk()
|
||||
root.geometry('400x300')
|
||||
root.title('Calender-Techarge')
|
||||
root.iconbitmap("calender-ico.ico")
|
||||
|
||||
|
||||
def show():
|
||||
|
||||
m = int(month.get())
|
||||
y = int(year.get())
|
||||
output = calendar.month(y,m)
|
||||
|
||||
cal.insert('end',output)
|
||||
|
||||
def clear():
|
||||
cal.delete(1.0,'end')
|
||||
|
||||
def exit():
|
||||
root.destroy()
|
||||
|
||||
|
||||
img = ImageTk.PhotoImage(Image.open('calendar.png'))
|
||||
label = Label(image=img)
|
||||
label.place(x=170,y=3)
|
||||
|
||||
|
||||
|
||||
m_label = Label(root,text="Month",font=('verdana','10','bold'))
|
||||
m_label.place(x=70,y=80)
|
||||
|
||||
month = Spinbox(root, from_= 1, to = 12,width="5")
|
||||
month.place(x=140,y=80)
|
||||
|
||||
y_label = Label(root,text="Year",font=('verdana','10','bold'))
|
||||
y_label.place(x=210,y=80)
|
||||
|
||||
year = Spinbox(root, from_= 2020, to = 3000,width="8")
|
||||
year.place(x=260,y=80)
|
||||
|
||||
|
||||
cal = Text(root,width=33,height=8,relief=RIDGE,borderwidth=2)
|
||||
cal.place(x=70,y=110)
|
||||
|
||||
show = Button(root,text="Show",font=('verdana',10,'bold'),relief=RIDGE,borderwidth=2,command=show)
|
||||
show.place(x=140,y=250)
|
||||
|
||||
clear = Button(root,text="Clear",font=('verdana',10,'bold'),relief=RIDGE,borderwidth=2,command=clear)
|
||||
clear.place(x=200,y=250)
|
||||
|
||||
exit = Button(root,text="Exit",font=('verdana',10,'bold'),relief=RIDGE,borderwidth=2,command=exit)
|
||||
exit.place(x=260,y=250)
|
||||
root.mainloop()
|
8
scripts/Calender/readme.txt
Normal file
|
@ -0,0 +1,8 @@
|
|||
###Calender App using Python
|
||||
This is an simple calender gui using python.
|
||||
|
||||
#Steps:
|
||||
*We will require tkinter and calender module.
|
||||
*pip install tkinter
|
||||
*pip install calendar module
|
||||
*Run- python calender.py
|
13
scripts/Chat-App/Chatapp/app.py
Normal file
|
@ -0,0 +1,13 @@
|
|||
INSTALLED_APPS = [
|
||||
'chat.apps.ChatConfig',
|
||||
|
||||
'django.contrib.admin',
|
||||
'django.contrib.auth',
|
||||
'django.contrib.contenttypes',
|
||||
'django.contrib.sessions',
|
||||
'django.contrib.messages',
|
||||
'django.contrib.staticfiles',
|
||||
|
||||
# add django channels
|
||||
'channels' ,
|
||||
]
|
21
scripts/Chat-App/Chatapp/asgi.py
Normal file
|
@ -0,0 +1,21 @@
|
|||
ASGI_APPLICATION = 'ChatApp.asgi.application'
|
||||
|
||||
import os
|
||||
from django.core.asgi import get_asgi_application
|
||||
|
||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'ChatApp.settings')
|
||||
|
||||
from channels.auth import AuthMiddlewareStack
|
||||
from channels.routing import ProtocolTypeRouter , URLRouter
|
||||
from chat import routing
|
||||
|
||||
application = ProtocolTypeRouter(
|
||||
{
|
||||
"http" : get_asgi_application() ,
|
||||
"websocket" : AuthMiddlewareStack(
|
||||
URLRouter(
|
||||
routing.websocket_urlpatterns
|
||||
)
|
||||
)
|
||||
}
|
||||
)
|
5
scripts/Chat-App/Chatapp/settings.py
Normal file
|
@ -0,0 +1,5 @@
|
|||
CHANNEL_LAYERS = {
|
||||
"default": {
|
||||
"BACKEND": "channels.layers.InMemoryChannelLayer"
|
||||
}
|
||||
}
|
9
scripts/Chat-App/Chatapp/urls.py
Normal file
|
@ -0,0 +1,9 @@
|
|||
## This will route you to your chat app.
|
||||
|
||||
from django.contrib import admin
|
||||
from django.urls import path, include
|
||||
|
||||
urlpatterns = [
|
||||
path('admin/', admin.site.urls),
|
||||
path("", include("chat.urls")),
|
||||
]
|
103
scripts/Chat-App/README.md
Normal file
|
@ -0,0 +1,103 @@
|
|||
# Realtime-chat-app-using-Django
|
||||
Chat Room has been the most basic step toward creating real-time and live projects. The chat page that we will create will be a simple HTML boilerplate with a simple h1 text with the name of the current user and a link to log out to the user who is just logged in. You may need to comment on the line until we create auth system for this
|
||||
|
||||
> Prerequisites:
|
||||
|
||||
* Django
|
||||
* Django Migrations
|
||||
* Django Channel
|
||||
|
||||
# Steps for creating the chat application:
|
||||
**Step 1:** [Install](https://www.geeksforgeeks.org/django-introduction-and-installation/#:~:text=activate-,Install%20Django,-%2D%20Install%20django) and setup Django
|
||||
|
||||
**Step 2:** Create your [virtual environment](https://www.geeksforgeeks.org/python-virtual-environment/).
|
||||
|
||||
**Step 3:** Then create a Django project named ChatApp. For creating the project write the command in your terminal.
|
||||
```sh
|
||||
django-admin startproject ChatApp
|
||||
```
|
||||
**Step 4:** Clone the repository
|
||||
|
||||
**Step 5:** Install django-channels for working with the chat app. This will install channels to your environment.
|
||||
```sh
|
||||
python -m pip install -U channels
|
||||
```
|
||||
**Step 6:** After installing channels, add channels to your installed apps. This will let Django know that channels had been introduced in the project and we can work further.
|
||||
> PYTHON 3
|
||||
```sh
|
||||
INSTALLED_APPS = [
|
||||
'chat.apps.ChatConfig',
|
||||
|
||||
'django.contrib.admin',
|
||||
'django.contrib.auth',
|
||||
'django.contrib.contenttypes',
|
||||
'django.contrib.sessions',
|
||||
'django.contrib.messages',
|
||||
'django.contrib.staticfiles',
|
||||
|
||||
# add django channels
|
||||
'channels' ,
|
||||
]
|
||||
|
||||
```
|
||||
**Step 7:** Set the ASGI application to your default ASGI file in the project. Now run the server, you will notice that the ASGI server will take place over the Django server and it will support ASGI now.
|
||||
```sh
|
||||
ASGI_APPLICATION = 'ChatApp.asgi.application'
|
||||
```
|
||||
To run the server, write the following command in the terminal.
|
||||
```sh
|
||||
python manage.py runserver
|
||||
|
||||
```
|
||||
![Screenshot 2022-10-08 201412](https://user-images.githubusercontent.com/102956488/194713167-1b9d803c-857e-434b-a6e6-d34ce6f3e51b.png)
|
||||
|
||||
**Step 8:** Create a new app that will have all the chat functionality. To create an app write a command in the terminal.
|
||||
```sh
|
||||
python manage.py startapp chat
|
||||
```
|
||||
And add your app to the installed apps in settings.py.
|
||||
|
||||
![Screenshot 2022-10-09 103619](https://user-images.githubusercontent.com/102956488/194739375-b53824e4-d71b-4dc5-ad32-2bbd20535a9f.png)
|
||||
|
||||
**Step 9:** Clone the files in your chat app
|
||||
* chat/urls.py: This will route the Django application to different views in the app.
|
||||
* Create a templates folder: Inside your app, create two files inside the template/chat named chat.Page.html, and LoginPage.html.
|
||||
* routing.py: This will route the WebSocket connections to the consumers.
|
||||
* consumers.py: This is the file where all the asynchronous functionality will take place
|
||||
|
||||
**Step 10:** Firstly migrate your database.
|
||||
```sh
|
||||
python manage.py makemigrations
|
||||
```
|
||||
```sh
|
||||
python manage.py migrate
|
||||
```
|
||||
|
||||
**Step 11:** Open routing.py and create a route for ChatConsumer (which we will be creating in the next step). Now we have two types of routings in the project. First is urls.py which is for the native Django routing of URLs, and another is for the WebSockets for ASGI support of Django.
|
||||
|
||||
**Step 12.** Open consumers.py will handle the events, like onmessage event, onopen event, etc, We will see these events in chatPage.html where we have created the socket connection.
|
||||
|
||||
Code explanation:
|
||||
|
||||
* class ChatConsumer(AsyncWebsocketConsumer): Here we are creating a class named ChatConsumer which inherits from AsyncWebsocketConsumer and is used to create, destroy and do a few more things with WebSockets. And here we are creating ChatSocket for the required purpose.
|
||||
* async def connect(self): This function works on the websocket instance which has been created and when the connection is open or created, it connects and accepts the connection. It creates a group name for the chatroom and adds the group to the channel layer group.
|
||||
* async def disconnect(): This just removes the instance from the group.
|
||||
* async def receive(): This function is triggered when we send data from the WebSocket ( the event for this to work is: send ), this receives the text data which has been converted into the JSON format ( as it is suitable for the javascript ) after the text_data has been received, then it needs to be spread out to the other instances which are active in the group. we retrieve the message parameter which holds the message and the username parameter which was sent by the socket via HTML or js. This message which is received will be spread to other instances via the channel_layer.group_send() method which takes the first argument as the roomGroupName that to which group this instance belongs and where the data needs to be sent. then the second argument is the dictionary which defines the function which will handle the sending of the data ( “type”: “sendMessage” ) and also dictionary has the variable message which holds the message data.
|
||||
* async def sendMessage(self, event): This function takes the instance which is sending the data and the event, basically event holds the data which was sent via the group_send() method of the receive() function. Then it sends the message and the username parameter to all the instances which are active in the group. And it is dumped in JSON format so that js can understand the notation. JSON is the format ( Javascript object notation)
|
||||
|
||||
**Step 13:** Write the below code in your asgi.py for making it work with sockets and creating routings.
|
||||
We usually work with wsgi.py which is in the standard Django without any asynchronous support. But here we are using asynchronous channels. So we have to define the routings in a different way than URLs. For HTTP we define that use the normal application which we were already using, now we have introduced another protocol, that is ws ( WebSocket ) for which you have to route. The ProtocolTypeRouter creates routes for different types of protocols used in the application. AuthMiddlewareStack authenticates the routes and instances for the Authentication and URLRouter routes the ws ( WebSocket connections ). The protocol for WebSockets is known as “ws”. For different requests we use HTTP.
|
||||
|
||||
Here the router routes the WebSocket URL to a variable in the chat app that is “websocket_urlpatterns” and this variable holds the routes for the WebSocket connections.
|
||||
|
||||
**Step 14:** This code defines the channel layer in which we will be working and sharing data. For the deployment and production level, don’t use InMemoryChannelLayer, because there are huge chances for your data leakage. This is not good for production. For production use the Redis channel.
|
||||
|
||||
**Step 15:** Now, we need to create 2 users for that we will use “python manage.py createsuperuser” command which creates a superuser in the system.
|
||||
|
||||
![Screenshot 2022-10-08 202209](https://user-images.githubusercontent.com/102956488/194713500-0b432de7-0c3d-49f4-ae6c-8d5bd26d4b55.png)
|
||||
|
||||
**Step 16:** We have set the parameter LOGIN_REDIRECT_URL = “chat-page”, this is the name of our landing page URL. This means that whenever the user gets logged in, he will be sent to the chatPage as a verified user and he is eligible to chat through. Now similarly we need to set up the LOGOUT_REDIRECT_URL for the site.
|
||||
|
||||
## Finally Deployment
|
||||
Now, run your server and move to the site and start two different browsers to log into two other users. It is because if you have logged in with first user credentials, the login details are stored in the cookies, then if you log in from second user details in the same browser even with different tabs, So, you cannot chat with two other users in the same browser, that’s why to use two different browsers.
|
||||
|
30
scripts/Chat-App/chat/consumers.py
Normal file
|
@ -0,0 +1,30 @@
|
|||
import json
|
||||
from channels.generic.websocket import AsyncWebsocketConsumer
|
||||
|
||||
class ChatConsumer(AsyncWebsocketConsumer):
|
||||
async def connect(self):
|
||||
self.roomGroupName = "group_chat_gfg"
|
||||
await self.channel_layer.group_add(
|
||||
self.roomGroupName ,
|
||||
self.channel_name
|
||||
)
|
||||
await self.accept()
|
||||
async def disconnect(self , close_code):
|
||||
await self.channel_layer.group_discard(
|
||||
self.roomGroupName ,
|
||||
self.channel_layer
|
||||
)
|
||||
async def receive(self, text_data):
|
||||
text_data_json = json.loads(text_data)
|
||||
message = text_data_json["message"]
|
||||
username = text_data_json["username"]
|
||||
await self.channel_layer.group_send(
|
||||
self.roomGroupName,{
|
||||
"type" : "sendMessage" ,
|
||||
"message" : message ,
|
||||
"username" : username ,
|
||||
})
|
||||
async def sendMessage(self , event) :
|
||||
message = event["message"]
|
||||
username = event["username"]
|
||||
await self.send(text_data = json.dumps({"message":message ,"username":username}))
|
8
scripts/Chat-App/chat/routing.py
Normal file
|
@ -0,0 +1,8 @@
|
|||
from django.urls import path , include
|
||||
from chat.consumers import ChatConsumer
|
||||
|
||||
# Here, "" is routing to the URL ChatConsumer which
|
||||
# will handle the chat functionality.
|
||||
websocket_urlpatterns = [
|
||||
path("" , ChatConsumer.as_asgi()) ,
|
||||
]
|
15
scripts/Chat-App/chat/urls.py
Normal file
|
@ -0,0 +1,15 @@
|
|||
## This will route you toward views.
|
||||
|
||||
from django.urls import path, include
|
||||
from chat import views as chat_views
|
||||
from django.contrib.auth.views import LoginView, LogoutView
|
||||
|
||||
|
||||
urlpatterns = [
|
||||
path("", chat_views.chatPage, name="chat-page"),
|
||||
|
||||
# login-section
|
||||
path("auth/login/", LoginView.as_view
|
||||
(template_name="chat/LoginPage.html"), name="login-user"),
|
||||
path("auth/logout/", LogoutView.as_view(), name="logout-user"),
|
||||
]
|
11
scripts/Chat-App/chat/views.py
Normal file
|
@ -0,0 +1,11 @@
|
|||
## This will route your views to the chatPage.html that had been created in the templates folder of the chat app.
|
||||
|
||||
|
||||
from django.shortcuts import render, redirect
|
||||
|
||||
|
||||
def chatPage(request, *args, **kwargs):
|
||||
if not request.user.is_authenticated:
|
||||
return redirect("login-user")
|
||||
context = {}
|
||||
return render(request, "chat/chatPage.html", context)
|
17
scripts/Chat-App/templates folder/LoginPage.html
Normal file
|
@ -0,0 +1,17 @@
|
|||
## {{request.user.userrname}} tells the username of the currently logged-in user. If the user is logged in,
|
||||
it will give its username; if it’s not logged in, it will print nothing. The chat page looks like this now,
|
||||
because there is no current logged-in user and {{request.user.username}} prints out nothing.
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<body>
|
||||
<form method ="post">
|
||||
{% csrf_token %}
|
||||
{{form.as_p}}
|
||||
<br>
|
||||
<button type = "submit">Login</button>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
53
scripts/Chat-App/templates folder/chat.Page.html
Normal file
|
@ -0,0 +1,53 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<body>
|
||||
<center><h1>Hello , Welcome to my chat site ! {{request.user}}</h1></center>
|
||||
<br>
|
||||
{% if request.user.is_authenticated %}
|
||||
<center> Logout the chat Page <a href = "{% url 'logout-user' %}">Logout</a></center>
|
||||
{% endif %}
|
||||
<div
|
||||
class="chat__item__container"
|
||||
id="id_chat_item_container"
|
||||
style="font-size: 20px"
|
||||
>
|
||||
<br />
|
||||
<input type="text" id="id_message_send_input" />
|
||||
<button type="submit" id="id_message_send_button">Send Message</button>
|
||||
<br />
|
||||
<br />
|
||||
</div>
|
||||
<script>
|
||||
const chatSocket = new WebSocket("ws://" + window.location.host + "/");
|
||||
chatSocket.onopen = function (e) {
|
||||
console.log("The connection was setup successfully !");
|
||||
};
|
||||
chatSocket.onclose = function (e) {
|
||||
console.log("Something unexpected happened !");
|
||||
};
|
||||
document.querySelector("#id_message_send_input").focus();
|
||||
document.querySelector("#id_message_send_input").onkeyup = function (e) {
|
||||
if (e.keyCode == 13) {
|
||||
document.querySelector("#id_message_send_button").click();
|
||||
}
|
||||
};
|
||||
document.querySelector("#id_message_send_button").onclick = function (e) {
|
||||
var messageInput = document.querySelector(
|
||||
"#id_message_send_input"
|
||||
).value;
|
||||
chatSocket.send(JSON.stringify({ message: messageInput, username : "{{request.user.username}}"}));
|
||||
};
|
||||
chatSocket.onmessage = function (e) {
|
||||
const data = JSON.parse(e.data);
|
||||
var div = document.createElement("div");
|
||||
div.innerHTML = data.username + " : " + data.message;
|
||||
document.querySelector("#id_message_send_input").value = "";
|
||||
document.querySelector("#id_chat_item_container").appendChild(div);
|
||||
};
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
### The URL is in Django format, this is Django syntax to map to a URL. We will create a URL named “logout-user”,
|
||||
then Django will map this URL name to the URL from the template. Django provides a few pythonic syntaxes to deal
|
||||
with the control statement. Here we have provided {% if request.user.is_authenticated %} line in the HTML, this is
|
||||
given by Django which ensures that if there is any user who is logged in, then only displays the logout link.
|
25
scripts/Confusion_Matrix/README.md
Normal file
|
@ -0,0 +1,25 @@
|
|||
The function makes a labelled confusion matrix comparing predictions and ground truth labels.
|
||||
|
||||
If classes is passed, confusion matrix will be labelled, if not, integer class values will be used.
|
||||
|
||||
Args:
|
||||
|
||||
* `y_true`: Array of truth labels (must be same shape as y_pred).
|
||||
* `y_pred`: Array of predicted labels (must be same shape as y_true).
|
||||
* `classes`: Array of class labels (e.g. string form). If `None`, integer labels are used.
|
||||
* `figsize`: Size of output figure (default=(10, 10)).
|
||||
* `text_size`: Size of output figure text (default=15).
|
||||
* `norm`: normalize values or not (default=False).
|
||||
* `savefig`: save confusion matrix to file (default=False).
|
||||
|
||||
Returns: A labelled confusion matrix plot comparing y_true and y_pred.
|
||||
|
||||
### Example usage:
|
||||
|
||||
> """make_confusion_matrix(y_true=test_labels, # ground truth test labels
|
||||
y_pred=y_preds, # predicted labels
|
||||
classes=class_names, # array of class label names
|
||||
figsize=(15, 15),
|
||||
text_size=10)"""
|
||||
|
||||
#### CODE BY ZeroToMastery TensorFlow course.
|
54
scripts/Confusion_Matrix/make_confusion_matrix.py
Normal file
|
@ -0,0 +1,54 @@
|
|||
import itertools
|
||||
import matplotlib.pyplot as plt
|
||||
import numpy as np
|
||||
from sklearn.metrics import confusion_matrix
|
||||
|
||||
def make_confusion_matrix(y_true, y_pred, classes=None, figsize=(10, 10), text_size=15, norm=False, savefig=False):
|
||||
# Create the confustion matrix
|
||||
cm = confusion_matrix(y_true, y_pred)
|
||||
cm_norm = cm.astype("float") / cm.sum(axis=1)[:, np.newaxis] # normalize it
|
||||
n_classes = cm.shape[0] # find the number of classes we're dealing with
|
||||
|
||||
# Plot the figure and make it pretty
|
||||
fig, ax = plt.subplots(figsize=figsize)
|
||||
cax = ax.matshow(cm, cmap=plt.cm.Blues) # colors will represent how 'correct' a class is, darker == better
|
||||
fig.colorbar(cax)
|
||||
|
||||
# Are there a list of classes?
|
||||
if classes:
|
||||
labels = classes
|
||||
else:
|
||||
labels = np.arange(cm.shape[0])
|
||||
|
||||
# Label the axes
|
||||
ax.set(title="Confusion Matrix",
|
||||
xlabel="Predicted label",
|
||||
ylabel="True label",
|
||||
xticks=np.arange(n_classes), # create enough axis slots for each class
|
||||
yticks=np.arange(n_classes),
|
||||
xticklabels=labels, # axes will labeled with class names (if they exist) or ints
|
||||
yticklabels=labels)
|
||||
|
||||
# Make x-axis labels appear on bottom
|
||||
ax.xaxis.set_label_position("bottom")
|
||||
ax.xaxis.tick_bottom()
|
||||
|
||||
# Set the threshold for different colors
|
||||
threshold = (cm.max() + cm.min()) / 2.
|
||||
|
||||
# Plot the text on each cell
|
||||
for i, j in itertools.product(range(cm.shape[0]), range(cm.shape[1])):
|
||||
if norm:
|
||||
plt.text(j, i, f"{cm[i, j]} ({cm_norm[i, j]*100:.1f}%)",
|
||||
horizontalalignment="center",
|
||||
color="white" if cm[i, j] > threshold else "black",
|
||||
size=text_size)
|
||||
else:
|
||||
plt.text(j, i, f"{cm[i, j]}",
|
||||
horizontalalignment="center",
|
||||
color="white" if cm[i, j] > threshold else "black",
|
||||
size=text_size)
|
||||
|
||||
# Save the figure to the current working directory
|
||||
if savefig:
|
||||
fig.savefig("confusion_matrix.png")
|
9
scripts/Crawl Google Results/README.md
Normal file
|
@ -0,0 +1,9 @@
|
|||
# Crawl Google results
|
||||
This is a simple script that lets you collect results provided by Google.
|
||||
|
||||
## Usage
|
||||
|
||||
* 3 packages required requests, BeautifulSoup and fake_useragent
|
||||
* Use `pip install requests`, `pip install bs4` and `pip install fake_useragent`
|
||||
* Add path to your csv file and output excel file WITH EXTENSTION `.csv` and `.xlsx`
|
||||
* Run `python main.py "query search"`
|
24
scripts/Crawl Google Results/main.py
Normal file
|
@ -0,0 +1,24 @@
|
|||
import sys
|
||||
import webbrowser
|
||||
|
||||
import requests
|
||||
from bs4 import BeautifulSoup
|
||||
from fake_useragent import UserAgent
|
||||
|
||||
if __name__ == "__main__":
|
||||
print("Googling.....")
|
||||
url = "https://www.google.com/search?q=" + " ".join(sys.argv[1:])
|
||||
res = requests.get(url, headers={"UserAgent": UserAgent().random})
|
||||
# res.raise_for_status()
|
||||
with open("project1a.html", "wb") as out_file: # only for knowing the class
|
||||
for data in res.iter_content(10000):
|
||||
out_file.write(data)
|
||||
soup = BeautifulSoup(res.text, "html.parser")
|
||||
links = list(soup.select(".eZt8xd"))[:5]
|
||||
|
||||
print(len(links))
|
||||
for link in links:
|
||||
if link.text == "Maps":
|
||||
webbrowser.open(link.get("href"))
|
||||
else:
|
||||
webbrowser.open(f"http://google.com{link.get('href')}")
|
44
scripts/Detect_and_Translate_languages/README.md
Normal file
|
@ -0,0 +1,44 @@
|
|||
# Detect and Translate languages with the help of speech recognition
|
||||
|
||||
This python script first records the user's voice and then convert it to text. After that it detects the language of the text and then translates the language to the user's desired language, which is asked to the user. After converting the language to the desired language, the translated text would be displayed and the system would read the text for the user.
|
||||
|
||||
## Prerequisite
|
||||
|
||||
- Any system with microphone and speaker.
|
||||
- System with python installed in it. (or any IDE like Spyder, Jupyter, VScode etc)
|
||||
|
||||
## Dependencies
|
||||
|
||||
Install the following dependencies using pip
|
||||
|
||||
```
|
||||
$ pip install speech_recognition
|
||||
```
|
||||
|
||||
```
|
||||
$ pip install langdetect
|
||||
```
|
||||
|
||||
```
|
||||
$ pip install pyttsx3
|
||||
```
|
||||
|
||||
```
|
||||
$ pip install google_trans_new
|
||||
```
|
||||
|
||||
#### Running the script
|
||||
|
||||
Simply run the script using python in any IDE
|
||||
|
||||
```
|
||||
$ python ./detect_translate.py
|
||||
```
|
||||
|
||||
Note: google_trans_new may cause some error like "JSONDecodeError: Extra data", to fix it go to the location where all the python packages are installed and change line 151 in google_trans_new/google_trans_new.py which is: "response = (decoded_line + ']')" to "response = decoded_line"
|
||||
|
||||
You can also refer the git issue for more reference on this topic: https://github.com/lushan88a/google_trans_new/issues/36
|
||||
|
||||
Author: Tejaswi Kumar
|
||||
|
||||
LinkedIn: https://www.linkedin.com/in/tejaswi24/
|
83
scripts/Detect_and_Translate_languages/detect_translate.py
Normal file
|
@ -0,0 +1,83 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
@author: Tejaswi
|
||||
|
||||
"""
|
||||
|
||||
# Python program to detect and translate with the help of speech recognition
|
||||
|
||||
import speech_recognition as sr
|
||||
from langdetect import detect
|
||||
from google_trans_new import google_translator
|
||||
import pyttsx3
|
||||
|
||||
'''
|
||||
Supported Languages:
|
||||
{'af': 'afrikaans', 'sq': 'albanian', 'am': 'amharic', 'ar': 'arabic',
|
||||
'hy': 'armenian', 'az': 'azerbaijani', 'eu': 'basque', 'be': 'belarusian',
|
||||
'bn': 'bengali', 'bs': 'bosnian', 'bg': 'bulgarian', 'ca': 'catalan',
|
||||
'ceb': 'cebuano', 'ny': 'chichewa', 'zh-cn': 'chinese (simplified)',
|
||||
'zh-tw': 'chinese (traditional)', 'co': 'corsican', 'hr': 'croatian',
|
||||
'cs': 'czech', 'da': 'danish', 'nl': 'dutch', 'en': 'english',
|
||||
'eo': 'esperanto', 'et': 'estonian', 'tl': 'filipino', 'fi': 'finnish',
|
||||
'fr': 'french', 'fy': 'frisian', 'gl': 'galician', 'ka': 'georgian',
|
||||
'de': 'german', 'el': 'greek', 'gu': 'gujarati', 'ht': 'haitian creole',
|
||||
'ha': 'hausa', 'haw': 'hawaiian', 'iw': 'hebrew', 'hi': 'hindi',
|
||||
'hmn': 'hmong', 'hu': 'hungarian', 'is': 'icelandic', 'ig': 'igbo',
|
||||
'id': 'indonesian', 'ga': 'irish', 'it': 'italian', 'ja': 'japanese',
|
||||
'jw': 'javanese', 'kn': 'kannada', 'kk': 'kazakh', 'km': 'khmer',
|
||||
'ko': 'korean', 'ku': 'kurdish (kurmanji)', 'ky': 'kyrgyz', 'lo': 'lao',
|
||||
'la': 'latin', 'lv': 'latvian', 'lt': 'lithuanian', 'lb': 'luxembourgish',
|
||||
'mk': 'macedonian', 'mg': 'malagasy', 'ms': 'malay', 'ml': 'malayalam',
|
||||
'mt': 'maltese', 'mi': 'maori', 'mr': 'marathi', 'mn': 'mongolian',
|
||||
'my': 'myanmar (burmese)', 'ne': 'nepali', 'no': 'norwegian', 'ps': 'pashto',
|
||||
'fa': 'persian', 'pl': 'polish', 'pt': 'portuguese', 'pa': 'punjabi',
|
||||
'ro': 'romanian', 'ru': 'russian', 'sm': 'samoan', 'gd': 'scots gaelic',
|
||||
'sr': 'serbian', 'st': 'sesotho', 'sn': 'shona', 'sd': 'sindhi',
|
||||
'si': 'sinhala', 'sk': 'slovak', 'sl': 'slovenian', 'so': 'somali',
|
||||
'es': 'spanish', 'su': 'sundanese', 'sw': 'swahili', 'sv': 'swedish',
|
||||
'tg': 'tajik', 'ta': 'tamil', 'te': 'telugu', 'th': 'thai', 'tr': 'turkish',
|
||||
'uk': 'ukrainian', 'ur': 'urdu', 'uz': 'uzbek', 'vi': 'vietnamese',
|
||||
'cy': 'welsh', 'xh': 'xhosa', 'yi': 'yiddish', 'yo': 'yoruba',
|
||||
'zu': 'zulu', 'fil': 'Filipino', 'he': 'Hebrew'}
|
||||
|
||||
'''
|
||||
|
||||
r = sr.Recognizer()
|
||||
translator = google_translator()
|
||||
|
||||
|
||||
def SpeakText(command):
|
||||
# Initialize the engine
|
||||
engine = pyttsx3.init()
|
||||
engine.say(command)
|
||||
engine.runAndWait()
|
||||
|
||||
|
||||
def trans(x, d):
|
||||
s = detect(x)
|
||||
result = translator.translate(x, lang_src=s, lang_tgt=d)
|
||||
return result
|
||||
|
||||
|
||||
print("Start speaking.....(To terminate the program say 'Stop!')")
|
||||
while(1):
|
||||
try:
|
||||
with sr.Microphone() as source2:
|
||||
r.adjust_for_ambient_noise(source2, duration=0.2)
|
||||
audio2 = r.listen(source2)
|
||||
MyText = r.recognize_google(audio2)
|
||||
MyText.lower()
|
||||
if MyText == 'stop':
|
||||
break
|
||||
print("Did you say "+MyText)
|
||||
d = input(
|
||||
'Enter the language you need the text to be translated into:')
|
||||
translated = trans(MyText, d)
|
||||
print(translated)
|
||||
SpeakText(MyText)
|
||||
|
||||
except sr.RequestError as e:
|
||||
print("Could not request results; {0}".format(e))
|
||||
except sr.UnknownValueError:
|
||||
print("unknown error occured")
|
17
scripts/Digital-Clock/Digital-Clock.py
Normal file
|
@ -0,0 +1,17 @@
|
|||
import tkinter
|
||||
from time import strftime
|
||||
|
||||
top = tkinter.Tk()
|
||||
top.title('Digital Clock')
|
||||
top.resizable(0,0)
|
||||
|
||||
def time():
|
||||
string = strftime('%H: %M: %S %p')
|
||||
clockTime.config(text=string)
|
||||
clockTime.after(1000, time)
|
||||
|
||||
clockTime = tkinter.Label(top, font=('courier new', 40),
|
||||
background='white',foreground='black')
|
||||
clockTime.pack(anchor='center')
|
||||
time()
|
||||
top.mainloop()
|
7
scripts/Digital-Clock/readme.md
Normal file
|
@ -0,0 +1,7 @@
|
|||
# Digital Clock
|
||||
|
||||
## Preview
|
||||
![Screenshot 2022-10-04 195233](https://user-images.githubusercontent.com/104223444/193844936-aee558c0-6b43-4096-9b9c-cc3ef23a29ed.png)
|
||||
|
||||
## ISSSUE
|
||||
https://github.com/metafy-social/daily-python-scripts/issues/128#issue-1396619270
|
40
scripts/Duplicate File Remover/DuplicateFileRemover.py
Normal file
|
@ -0,0 +1,40 @@
|
|||
import hashlib
|
||||
import os
|
||||
|
||||
# Returns the hash string of the given file name
|
||||
|
||||
|
||||
def hashFile(filename):
|
||||
# For large files, if we read it all together it can lead to memory overflow
|
||||
BLOCKSIZE = 65536
|
||||
hasher = hashlib.md5()
|
||||
with open(filename, 'rb') as file:
|
||||
# Reads the particular blocksize from file
|
||||
buf = file.read(BLOCKSIZE)
|
||||
while(len(buf) > 0):
|
||||
hasher.update(buf)
|
||||
buf = file.read(BLOCKSIZE)
|
||||
return hasher.hexdigest()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
# Dictionary to store the hash and filename
|
||||
hashMap = {}
|
||||
|
||||
# List to store deleted files
|
||||
deletedFiles = []
|
||||
filelist = [f for f in os.listdir() if os.path.isfile(f)]
|
||||
for f in filelist:
|
||||
key = hashFile(f)
|
||||
# If key already exists, it deletes the file
|
||||
if key in hashMap.keys():
|
||||
deletedFiles.append(f)
|
||||
os.remove(f)
|
||||
else:
|
||||
hashMap[key] = f
|
||||
if len(deletedFiles) != 0:
|
||||
print('Deleted Files')
|
||||
for i in deletedFiles:
|
||||
print(i)
|
||||
else:
|
||||
print('No duplicate files found')
|
17
scripts/Duplicate File Remover/README.md
Normal file
|
@ -0,0 +1,17 @@
|
|||
# Duplicate Files Remover
|
||||
|
||||
Duplicate Files is removed by using this Python Script.
|
||||
|
||||
- It checks the MD5 Hash Value of the Files to check whether they are duplicate or not.
|
||||
If they are duplicate they are removed.
|
||||
|
||||
# Tech Stack:
|
||||
- Python
|
||||
- MD5
|
||||
|
||||
# Requirements:
|
||||
- Python above 3.7 version
|
||||
|
||||
# Demo of the Project:
|
||||
|
||||
https://user-images.githubusercontent.com/77090462/170878106-8b35f0ae-76c8-4dfd-bb41-2e324855e805.mp4
|
16
scripts/Email Extractor/README.md
Normal file
|
@ -0,0 +1,16 @@
|
|||
# Email Extractor with Python
|
||||
|
||||
This is a script that takes input as a website and collect all the email address into a csv file.
|
||||
|
||||
|
||||
### Setup
|
||||
- Install the requirements (refer below)
|
||||
- Run the script by 'python email_extractor.py'
|
||||
- Input the website to collect emails
|
||||
|
||||
|
||||
### Requirements
|
||||
```pip install -r requirements.txt```
|
||||
|
||||
### usage
|
||||
```python email_extractor.py```
|
45
scripts/Email Extractor/email_extractor.py
Normal file
|
@ -0,0 +1,45 @@
|
|||
|
||||
|
||||
import requests
|
||||
from bs4 import BeautifulSoup
|
||||
import urllib.request
|
||||
from email_scraper import scrape_emails
|
||||
import pandas as pd
|
||||
from google.colab import files
|
||||
|
||||
|
||||
urlid = input("Enter Website url (i.e.: example.com): ")
|
||||
url = "https://"+urlid+"/"
|
||||
reqs = requests.get(url)
|
||||
soup = BeautifulSoup(reqs.text, 'html.parser')
|
||||
|
||||
urls = []
|
||||
response = []
|
||||
email = []
|
||||
for link in soup.find_all('a'):
|
||||
urls.append(link.get('href'))
|
||||
for i in range(len(urls)):
|
||||
if(urls[i].startswith("https://")):
|
||||
fp = urllib.request.urlopen(url+urls[i])
|
||||
mybytes = fp.read()
|
||||
mystr = mybytes.decode("utf8")
|
||||
fp.close()
|
||||
response.append(scrape_emails(mystr))
|
||||
else:
|
||||
fp = urllib.request.urlopen(url+urls[i])
|
||||
mybytes = fp.read()
|
||||
mystr = mybytes.decode("utf8")
|
||||
fp.close()
|
||||
response.append(scrape_emails(mystr))
|
||||
|
||||
for r in range(len(response)):
|
||||
if not response[r]:
|
||||
continue
|
||||
else:
|
||||
email.append(response[r])
|
||||
|
||||
df = pd.DataFrame(email, columns=["Email"])
|
||||
df.to_csv('email.csv', index=False)
|
||||
|
||||
files.download("email.csv")
|
||||
|
6
scripts/Email Extractor/requirements.txt
Normal file
|
@ -0,0 +1,6 @@
|
|||
pip install requests
|
||||
pip install bs4
|
||||
pip install urllib
|
||||
pip install email_scraper
|
||||
pip install pandas
|
||||
pip install google
|
16
scripts/Extract_TEXT_FROM_IMAGE/README.md
Normal file
|
@ -0,0 +1,16 @@
|
|||
# Extract text from image
|
||||
|
||||
This script extracts text from an image using the EasyOCR library.
|
||||
It can support multiple languages.
|
||||
|
||||
## Usage
|
||||
|
||||
1. Create a virtual environment
|
||||
2. Install the requirements - `pip install -r requirements.txt`
|
||||
3. Run the script - `python main.py`
|
||||
|
||||
## Output
|
||||
|
||||
Output will be printed to console.
|
||||
|
||||
Happy coding!!
|
15
scripts/Extract_TEXT_FROM_IMAGE/main.py
Normal file
|
@ -0,0 +1,15 @@
|
|||
import easyocr
|
||||
|
||||
gpu = False # if you want to use GPU, set gpu=True
|
||||
languages = ['en'] # refer https://www.jaided.ai/easyocr/ for supporting languages
|
||||
|
||||
reader = easyocr.Reader(languages, gpu=gpu)
|
||||
|
||||
IMG_PATH = 'test1.png'
|
||||
result = reader.readtext(IMG_PATH)
|
||||
|
||||
text = ''
|
||||
for tup in result:
|
||||
text += tup[1]
|
||||
|
||||
print(text)
|
1
scripts/Extract_TEXT_FROM_IMAGE/requirements.txt
Normal file
|
@ -0,0 +1 @@
|
|||
easyocr==1.6.2
|
BIN
scripts/Extract_TEXT_FROM_IMAGE/test1.png
Normal file
After Width: | Height: | Size: 107 KiB |
22
scripts/Fake Data Generator/generator.py
Normal file
|
@ -0,0 +1,22 @@
|
|||
# pip install Faker
|
||||
from faker import Faker
|
||||
|
||||
fake = Faker()
|
||||
|
||||
print("--------- Generate ---------------")
|
||||
print("1. Name")
|
||||
print("2. Email")
|
||||
print("3. Job")
|
||||
print("4. Address")
|
||||
|
||||
options = {1: fake.name(), 2: fake.email(), 3: fake.job(), 4: fake.address()}
|
||||
|
||||
print("----------------------------------")
|
||||
user_input = int(input("Choose Option:- "))
|
||||
|
||||
print("----------------------------------")
|
||||
|
||||
if user_input in options:
|
||||
print(f"Result: {options[user_input]}")
|
||||
else:
|
||||
print("Please try again with a valid option.")
|
15
scripts/Fake Data Generator/readme.md
Normal file
|
@ -0,0 +1,15 @@
|
|||
|
||||
# Fake Data Generator
|
||||
super easy and simple python script to generate random data
|
||||
|
||||
## Perfect for beginners
|
||||
- usage of libraries
|
||||
- working with input
|
||||
- working with dictionaries
|
||||
|
||||
## Installation
|
||||
Install the dependencies
|
||||
|
||||
```sh
|
||||
pip install -r requirements.txt
|
||||
```
|
3
scripts/Fake Data Generator/requirements.txt
Normal file
|
@ -0,0 +1,3 @@
|
|||
Faker==15.0.0
|
||||
python-dateutil==2.8.2
|
||||
six==1.16.0
|
23
scripts/Folder-organizer/README.md
Normal file
|
@ -0,0 +1,23 @@
|
|||
# Automated file organizer
|
||||
|
||||
If you have that messed up folder structure with tons of different files all jumbled together, this is just the right script you need. It works for both linux and Windows.
|
||||
It will sort the same file types into same folders.
|
||||
|
||||
It has two options:-
|
||||
|
||||
1). Organize all files in the directory.
|
||||
2). Organize files of certain extensions in the directory.
|
||||
|
||||
### Usage:
|
||||
|
||||
It's really simple.
|
||||
|
||||
1). Run the code.
|
||||
2). Enter the path you want to organize.
|
||||
3). Choose the file extenstions you want to organize(i.e. ".exe", ".py", ".mp4", ".mp3"...).
|
||||
4). Enter folder name.
|
||||
5). There is no step 5. Enjoy your Organized folder and try not to make a mess for the future.
|
||||
|
||||
Possible Improvements:
|
||||
|
||||
> It can be further improved to organize files with certain keyword in their filename using regex. Even select only specific files not just using extensions.
|
123
scripts/Folder-organizer/main.py
Normal file
|
@ -0,0 +1,123 @@
|
|||
import os
|
||||
import shutil
|
||||
from sys import platform
|
||||
from threading import Thread
|
||||
|
||||
organise_folder = download_path = None
|
||||
|
||||
category = {"Audios": [".aif", ".cda", ".mid.mp3", ".mpa", ".ogg", ".wav", ".wma", ".wpl", ".midi"],
|
||||
"Compressed": [".7z", ".arj", ".deb", ".pkg", ".rar", ".rpm", ".tar", ".z", ".zip", ".gz"],
|
||||
"Documents": [".bin", ".dmg", ".iso", ".toast", ".vcd", ".csv", ".dat", ".db", ".log", ".mdb", ".sav",
|
||||
".sql", ".tar", ".xml", ".dbf", ".email", ".eml", ".emlx", ".msg", ".oft", ".ost", ".pst",
|
||||
".vcf", ".asp", ".cer", ".cfm", ".cgi", ".css", ".htm", ".js", ".jsp", ".part", ".php", ".py",
|
||||
".rss", ".xhtml", ".fnt", ".fon", ".otf", ".ttf", ".doc", ".odt", ".pdf", ".rtf", ".tex",
|
||||
".txt", ".wpd", ".key", ".odp", ".pps", ".ppt", ".pptx", ".c", ".cgi", ".class", ".cpp",
|
||||
".cs", ".h", ".java", ".php", ".py", ".sh", ".swift", ".vb", ".ods", ".xls", ".xlsm", ".xlsx",
|
||||
".docx", ".aspx", ".html"],
|
||||
"Images": [".ai", ".bmp", ".gif", ".ico", ".jpeg", ".png", ".ps", ".psd", ".svg", ".tif", ".jpg", ".tiff"],
|
||||
"Videos": [".3g2", ".3gp", ".avi", ".flv", ".h264", ".m4v", ".mkv", ".mov", ".mp4", ".mpg.rm", ".swf",
|
||||
".vob", ".wmv", ".mpeg", ".webm"],
|
||||
"Setups": [".apk", ".bat", ".bin", ".cgi", ".com", ".exe", ".gadget", ".jar", ".msi", ".py", ".wsf"],
|
||||
"Systemfiles": [".bak", ".cab", ".cfg", ".cpl", ".cur", ".dll", ".dmp", ".drv", ".icns", ".ico", ".ini",
|
||||
".lnk", ".msi",
|
||||
".sys", ".tmp"]}
|
||||
|
||||
|
||||
def movers(source, destination):
|
||||
if not os.path.exists(destination):
|
||||
os.makedirs(destination)
|
||||
try:
|
||||
shutil.move(source, destination)
|
||||
except OSError as error:
|
||||
print(str(source) + " <= File is open. Error => ", error)
|
||||
|
||||
|
||||
def our_cat_dir(main_path, filepath):
|
||||
for cat in category:
|
||||
if filepath == os.path.join(main_path, cat):
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def our_ext_dir(main_path, filepath):
|
||||
for cat in category:
|
||||
for ext in category[cat]:
|
||||
if filepath == os.path.join(main_path, ext):
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def org_by_cat(path):
|
||||
for file in os.listdir(path):
|
||||
file_path = os.path.join(path, file)
|
||||
if os.path.isdir(file_path):
|
||||
if not our_cat_dir(path, file_path):
|
||||
Thread(target=org_by_cat, args=[file_path]).start()
|
||||
continue
|
||||
else:
|
||||
file_name, file_extension = os.path.splitext(file_path)
|
||||
for cat in category:
|
||||
cat_folder = os.path.join(path, cat)
|
||||
if file_extension.lower() in category[cat]:
|
||||
movers(file_path, cat_folder)
|
||||
|
||||
|
||||
def org_by_ext(path):
|
||||
for file in os.listdir(path):
|
||||
if os.path.isdir(file):
|
||||
if not our_ext_dir(path, file):
|
||||
Thread(target=org_by_ext, args=[file]).start()
|
||||
continue
|
||||
else:
|
||||
file_path = os.path.join(path, file)
|
||||
file_name, file_extension = os.path.splitext(file_path)
|
||||
for cat in category:
|
||||
if file_extension.lower() in category[cat]:
|
||||
ext_folder = os.path.join(path, file_extension)
|
||||
movers(file_path, ext_folder)
|
||||
|
||||
|
||||
def main():
|
||||
global organise_folder, download_path
|
||||
if platform == "linux" or platform == "linux2":
|
||||
download_path = "/home/" + os.environ.get('USERNAME') + "/Downloads"
|
||||
elif platform == "win32":
|
||||
download_path = "C:\\Users\\" + os.environ.get('USERNAME') + "\\Downloads"
|
||||
while True:
|
||||
print("Press Q to exit anytime.")
|
||||
path = input('''\tOrganise Custom Directory? Enter Path (default : Downloads)\n>>>''')
|
||||
if path == "q":
|
||||
break
|
||||
elif path == "":
|
||||
organise_folder = download_path
|
||||
else:
|
||||
organise_folder = path
|
||||
if not os.path.exists(organise_folder):
|
||||
print("\nInvalid Path.")
|
||||
continue
|
||||
else:
|
||||
if os.path.isdir(organise_folder):
|
||||
break
|
||||
else:
|
||||
print("\nEntered Path not a directory.")
|
||||
continue
|
||||
while True:
|
||||
organise_type = input("\nIn what way do you want to organize.\n\t"
|
||||
+ "1) Organize files by category.\n\t"
|
||||
+ "2) Organize files by extension.\n>>>")
|
||||
if organise_type == "q":
|
||||
break
|
||||
elif organise_type == "1":
|
||||
print("Working")
|
||||
org_by_cat(organise_folder)
|
||||
print("Done")
|
||||
break
|
||||
elif organise_type == "2":
|
||||
print("Working")
|
||||
org_by_ext(organise_folder)
|
||||
print("Done")
|
||||
break
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
54
scripts/GUI_Dictionary/GUI_Dictionary.py
Normal file
|
@ -0,0 +1,54 @@
|
|||
from tkinter import *
|
||||
from tkinter import messagebox
|
||||
from PyDictionary import PyDictionary
|
||||
|
||||
|
||||
root = Tk()
|
||||
root.title("GUI Dictionary")
|
||||
root.geometry("500x400")
|
||||
|
||||
|
||||
dictionary = PyDictionary()
|
||||
|
||||
|
||||
def getMeaning():
|
||||
response = dictionary.meaning(word.get())
|
||||
if (response):
|
||||
if ('Noun' in response):
|
||||
meaning = response['Noun'][0]
|
||||
elif ('Verb' in response):
|
||||
meaning = response['Verb'][0]
|
||||
elif ('Adjective' in response):
|
||||
meaning = response['Adjective'][0]
|
||||
else:
|
||||
meaning = "Invalid word"
|
||||
else:
|
||||
messagebox.showinfo(
|
||||
"Error", "Please add a Noun, Pronoun, verb or a valid word.")
|
||||
meaning_label.config(text=meaning)
|
||||
|
||||
|
||||
|
||||
heading_label = Label(root, text="DICTIONARY", font=("Times 35 bold"), foreground='dark blue')
|
||||
heading_label.config(anchor=CENTER)
|
||||
heading_label.pack(pady=10)
|
||||
|
||||
|
||||
frame = Frame(root)
|
||||
Label(frame, text="Enter Word", font=("Helvetica 15 bold"), foreground='dodger blue').pack(side=LEFT)
|
||||
word = Entry(frame, font=("Helvetica 15 bold"))
|
||||
word.pack(padx=10)
|
||||
frame.pack()
|
||||
|
||||
search_button = Button(root, text="Search Word", font=("arial 15 bold"), relief=RIDGE, borderwidth=3, cursor="hand2", foreground='Magenta', command=getMeaning)
|
||||
search_button.config(anchor=CENTER)
|
||||
search_button.pack(pady=10)
|
||||
|
||||
|
||||
frame1 = Frame(root)
|
||||
Label(frame1, text="Meaning : ", font=("Helvetica 15 bold"), foreground='medium turquoise').pack(side=LEFT)
|
||||
meaning_label = Label(frame1, text="", font=("Helvetica 12"))
|
||||
meaning_label.pack(pady=5)
|
||||
frame1.pack(pady=10)
|
||||
|
||||
root.mainloop()
|
24
scripts/GUI_Dictionary/README.md
Normal file
|
@ -0,0 +1,24 @@
|
|||
# Dictionary GUI
|
||||
This script lets the user search for the meaning of words like a dictionary.
|
||||
|
||||
## Setup instructions
|
||||
In order to run this script, you need to have Python and pip installed on your system. After you're done installing Python and pip, run the following command from your terminal to install the requirements for the project.
|
||||
```
|
||||
pip install PyDictionary
|
||||
```
|
||||
|
||||
After satisfying all the requirements for the project, Open the terminal in the project folder and run
|
||||
```
|
||||
python GUI_Dictionary.py
|
||||
```
|
||||
or
|
||||
```
|
||||
python3 GUI_Dictionary.py
|
||||
```
|
||||
depending upon the python version. Make sure that you are running the command from the same virtual environment in which the required modules are installed.
|
||||
|
||||
# Introducing to Interface
|
||||
<img src="screenshots/gui_dict1.png">
|
||||
<br>
|
||||
<img src="screenshots/gui-dict-3.png"><br>
|
||||
<img src="screenshots/gui-dict-4.png">
|
BIN
scripts/GUI_Dictionary/screenshots/gui-dict-3.png
Normal file
After Width: | Height: | Size: 54 KiB |
BIN
scripts/GUI_Dictionary/screenshots/gui-dict-4.png
Normal file
After Width: | Height: | Size: 54 KiB |
BIN
scripts/GUI_Dictionary/screenshots/gui_dict1.png
Normal file
After Width: | Height: | Size: 42 KiB |
16
scripts/GeoCode API/README.md
Normal file
|
@ -0,0 +1,16 @@
|
|||
# Google Maps API
|
||||
|
||||
This code will take the name of places from where.txt and then use *forward Geocode API* to get the coordinates of that location, then the coordinates are stored in javascript file and the webpage is opened automatically, to show the pin locations on map.<br>
|
||||
|
||||
### Prerequisites
|
||||
|
||||
To install configparser ```pip install configparser``` or check [here](https://pypi.org/project/configparser/)
|
||||
If you have [Google Geocode API](https://developers.google.com/maps/documentation/geocoding/overview), so use that, otherwise you can use
|
||||
[Open Cage API](https://opencagedata.com/api) (its free, 2500 requests/day).
|
||||
|
||||
### How to run the script
|
||||
|
||||
Enter the API key and service URL in config file (without qoutes) and the places to be marked in where.txt file, then run the script.
|
||||
|
||||
|
||||
|
61
scripts/GeoCode API/code.py
Normal file
|
@ -0,0 +1,61 @@
|
|||
import urllib.request
|
||||
import urllib.parse
|
||||
import urllib.error
|
||||
import json
|
||||
import os
|
||||
import webbrowser
|
||||
import ssl
|
||||
import configparser
|
||||
|
||||
config = configparser.ConfigParser()
|
||||
config.read('config.ini')
|
||||
|
||||
api_key = config['keys']['api_key']
|
||||
service_url = config['keys']['service_url']
|
||||
|
||||
# Ignore SSL certificate errors
|
||||
ctx = ssl.create_default_context()
|
||||
ctx.check_hostname = False
|
||||
ctx.verify_mode = ssl.CERT_NONE
|
||||
|
||||
with open("where.txt") as fh, open("where.js", "w", encoding="utf-8") as where:
|
||||
adrs = []
|
||||
parms = {}
|
||||
for line in fh:
|
||||
|
||||
address = line.strip()
|
||||
parms["address"] = address
|
||||
parms['key'] = api_key
|
||||
url = service_url + urllib.parse.urlencode(parms)
|
||||
|
||||
if url.lower().startswith('http'):
|
||||
req = urllib.request.Request(url)
|
||||
else:
|
||||
raise ValueError from None
|
||||
|
||||
with urllib.request.urlopen(req, context=ctx) as resp:
|
||||
|
||||
data = resp.read().decode()
|
||||
|
||||
try:
|
||||
js = json.loads(data)
|
||||
except Exception as e:
|
||||
print(f"{e}: {data}")
|
||||
continue
|
||||
|
||||
try:
|
||||
adrs.append([js['results'][0]['geometry']['lat'],
|
||||
js['results'][0]['geometry']['lng'],
|
||||
js['results'][0]['formatted']])
|
||||
print('Retrieved ', url)
|
||||
except Exception as e:
|
||||
print(f"Not Found: {e}: {line.strip()}")
|
||||
|
||||
print("\nOpening Webpage")
|
||||
|
||||
where.write("myData = [\n")
|
||||
for item in adrs:
|
||||
where.write(f"[{str(item[0])}, {str(item[1])}, '{str(item[2])}' ], \n")
|
||||
where.write("];\n")
|
||||
|
||||
webbrowser.open('file://' + os.path.realpath("index.html"))
|
3
scripts/GeoCode API/config.ini
Normal file
|
@ -0,0 +1,3 @@
|
|||
[keys]
|
||||
service_url=https://api.opencagedata.com/geocode/v1/json?q=
|
||||
api_key=
|
48
scripts/GeoCode API/index.html
Normal file
|
@ -0,0 +1,48 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
|
||||
<meta charset="utf-8">
|
||||
<title>GOOGLE MAPS API</title>
|
||||
<link href="https://google-developers.appspot.com/maps/documentation/javascript/examples/default.css" rel="stylesheet">
|
||||
<script src="https://maps.googleapis.com/maps/api/js"></script>
|
||||
<script src="where.js"></script>
|
||||
<script>
|
||||
function initialize() {
|
||||
var myLatlng = new google.maps.LatLng(37.39361,-122.099263)
|
||||
var mapOptions = {
|
||||
zoom: 3,
|
||||
center: myLatlng,
|
||||
mapTypeId: google.maps.MapTypeId.ROADMAP
|
||||
}
|
||||
var map = new google.maps.Map(document.getElementById('map_canvas'), mapOptions);
|
||||
i = 0;
|
||||
var markers = [];
|
||||
for ( pos in myData ) {
|
||||
i = i + 1;
|
||||
var row = myData[pos];
|
||||
window.console && console.log(row);
|
||||
var newLatlng = new google.maps.LatLng(row[0], row[1]);
|
||||
var marker = new google.maps.Marker({
|
||||
position: newLatlng,
|
||||
map: map,
|
||||
title: row[2]
|
||||
});
|
||||
markers.push(marker);
|
||||
var options = {
|
||||
imagePath: 'http://rawgit.com/googlemaps/js-marker-clusterer/gh-pages/images/m'
|
||||
}
|
||||
}
|
||||
var markerCluster = new MarkerClusterer(map, markers, options);
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body onload="initialize()">
|
||||
<div id="map_canvas" style="height: 500px"></div>
|
||||
<p><b>About this Map</b></p>
|
||||
<p>
|
||||
This is a cool script by
|
||||
<a href="https://github.com/Mysterious-Owl">Mysterious-Owl</a> with the use of API.<br>
|
||||
To see the details of a marker, hover over the marker.
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
2
scripts/GeoCode API/requirements.txt
Normal file
|
@ -0,0 +1,2 @@
|
|||
configparser
|
||||
ssl
|
24
scripts/GeoCode API/where.js
Normal file
|
@ -0,0 +1,24 @@
|
|||
myData = [
|
||||
[41.89193, 12.51133, 'Rome, Italy' ],
|
||||
[12.937243, 77.6925796, 'The Address, Outer Ring Road, Kaadubeesanahalli, Bengaluru - 530103, Karnataka, India' ],
|
||||
[51.575646, -0.0986474, 'Address, Endymion Road, London, N4 1EQ, United Kingdom' ],
|
||||
[-33.86785, 151.20732, 'Sydney, Australia' ],
|
||||
[35.6718484, 139.7419907, 'Address Building, Sotobori-dori, Akasaka 2-chome, Minato, 100-8968, Japan' ],
|
||||
[55.75222, 37.61556, 'Moscow, Russia' ],
|
||||
[34.05223, -118.24368, 'Los Angeles, California, United States of America' ],
|
||||
[-23.582841, -46.6847335, 'Hotel Intercity Adress Faria Lima, Rua Amauri 513, Vila Olímpia, São Paulo - SP, 01453-020, Brazil' ],
|
||||
[-33.92584, 18.42322, 'Cape Town, City of Cape Town, South Africa' ],
|
||||
[22.28552, 114.15769, 'Hong Kong' ],
|
||||
[30.0439192, 30.9812426, 'District 12, Sheikh Zayed, Giza, Egypt' ],
|
||||
[43.6557254, -79.456573, 'The Address at High Park, 1638 Bloor Street West, Toronto, ON M6P 0A6, Canada' ],
|
||||
[-20.0, 47.0, 'Madagascar' ],
|
||||
[1.114186, 103.9852544, 'Manisee Syariah Homestay (actual address), Tiban Mc Dermoth, Batam City 29427, Riau Islands, Indonesia' ],
|
||||
[64.00028, -150.00028, 'Alaska, United States of America' ],
|
||||
[18.0, -2.0, 'Mali' ],
|
||||
[60.0, 100.0, 'Russia' ],
|
||||
[62.0, 10.0, 'Norway' ],
|
||||
[-23.2029627, -65.3474844, 'La Nueva Puerta Verde good (good address), Avenida General Belgrano, Humahuaca, Municipio de Humahuaca, Argentina' ],
|
||||
[20.75028, -156.50028, 'Hawaii, United States of America' ],
|
||||
[46.0, 105.0, 'Mongolia' ],
|
||||
[-37.9032307, 144.7585649, 'The Address, Point Cook VIC 3030, Australia' ],
|
||||
];
|
22
scripts/GeoCode API/where.txt
Normal file
|
@ -0,0 +1,22 @@
|
|||
rome
|
||||
delhi
|
||||
london
|
||||
sydney
|
||||
japan
|
||||
moscow
|
||||
los angeles
|
||||
brazil
|
||||
cape town
|
||||
hong kong
|
||||
egypt
|
||||
canada
|
||||
madagascar
|
||||
indonesia
|
||||
alaska
|
||||
mali
|
||||
russia
|
||||
norway
|
||||
argentina
|
||||
hawaii
|
||||
mongolia
|
||||
australia
|
13
scripts/Getting_Wikipedia_Info/GetWikiInfo.py
Normal file
|
@ -0,0 +1,13 @@
|
|||
import wikipedia
|
||||
import pyttsx3
|
||||
engine = pyttsx3.init('sapi5')
|
||||
voices = engine.getProperty('voices')
|
||||
engine.setProperty('voice', voices[0].id)
|
||||
def speak(audio):
|
||||
engine.say(audio)
|
||||
engine.runAndWait()
|
||||
query = input("What You Want To Ask ??")
|
||||
results = wikipedia.summary(query, sentences=2)
|
||||
speak("According to Wikipedia\n")
|
||||
print(results)
|
||||
speak(results)
|
10
scripts/Getting_Wikipedia_Info/readme.md
Normal file
|
@ -0,0 +1,10 @@
|
|||
|
||||
# Getting Wikipedia Information
|
||||
super easy and simple python script to get wikipedia information
|
||||
|
||||
## Installation
|
||||
Install the dependencies
|
||||
|
||||
```sh
|
||||
pip install -r requirements.txt
|
||||
```
|
1
scripts/Getting_Wikipedia_Info/requirements.txt
Normal file
|
@ -0,0 +1 @@
|
|||
pyttsx3==2.90
|
22
scripts/GithubCLI/README.md
Normal file
|
@ -0,0 +1,22 @@
|
|||
# GitHub CLI With Python
|
||||
This is a GitHub CLI utility using python. It aims to simplify daily github stats through powerful CLI ui
|
||||
|
||||
## How to install?
|
||||
1) Open CMD (Command Prompt)
|
||||
2) Run python githubCLI.py --help to see all available commands
|
||||
|
||||
## Available Commands
|
||||
1) `python.exe main.py showall` - See all available projects for your account
|
||||
2) `python.exe main.py showproject project` - See stats for your project. Replace project in command with project name
|
||||
3) More commands coming soon!
|
||||
|
||||
## Requirements?
|
||||
-[ ] Replace `ADD_YOUR_OWN` in GitHub initialization using access token from GitHub
|
||||
-[ ] Install typer using `pip install typer[all]`
|
||||
-[ ] Install pygithub using `pip install pygithub`
|
||||
|
||||
## Live action preview:
|
||||
|
||||
![img.png](img.png)
|
||||
|
||||
Hope you enjoy it! Made with ❤️ by Shatanik Mahanty
|
62
scripts/GithubCLI/githubCLI.py
Normal file
|
@ -0,0 +1,62 @@
|
|||
from github import Github
|
||||
from rich.console import Console
|
||||
from rich.table import Table
|
||||
import typer
|
||||
from rich import print
|
||||
from rich.panel import Panel
|
||||
from rich.console import Group
|
||||
import random
|
||||
|
||||
app = typer.Typer()
|
||||
console = Console()
|
||||
|
||||
# Create your token from https://github.com/settings/tokens/new
|
||||
# Select repo and user scope
|
||||
g = Github("ADD_YOUR_OWN")
|
||||
|
||||
|
||||
@app.command()
|
||||
def showall():
|
||||
print("\n\n")
|
||||
user = g.get_user()
|
||||
table = Table("Repo Name", "URL", "Stars", "Open Issues", )
|
||||
for repo in user.get_repos():
|
||||
r = lambda: random.randint(0, 255)
|
||||
color = str('#%02X%02X%02X' % (r(), r(), r()))
|
||||
table.add_row("[bold " + color + "]" + repo.name, "[bold " + color + "]" + repo.url,
|
||||
"[bold " + color + "]" + str(repo.stargazers_count),
|
||||
"[bold " + color + "]" + str(repo.open_issues_count),
|
||||
)
|
||||
group = Group(
|
||||
table,
|
||||
)
|
||||
print(Panel(group, title="[bold underline purple]All Repos of " + user.name))
|
||||
print("\n\n")
|
||||
|
||||
|
||||
@app.command()
|
||||
def showproject(name: str):
|
||||
repo = g.get_user().get_repo(name=name)
|
||||
print("\n\n")
|
||||
table = Table("Name", "Contributions")
|
||||
for contributor in repo.get_contributors():
|
||||
r = lambda: random.randint(0, 255)
|
||||
color = str('#%02X%02X%02X' % (r(), r(), r()))
|
||||
table.add_row("[bold " + color + "]" + contributor.name,
|
||||
"[bold " + color + "]" + str(contributor.contributions))
|
||||
group = Group(
|
||||
"[bold green]Owner:[/bold green] " + "[bold]" + repo.owner.name + "[/bold]\n"
|
||||
"[bold blue]URL:[/bold blue] " + "[bold]" + repo.url + "[/bold]\n"
|
||||
"[bold #ecc73c]Stars:[/bold #ecc73c] " + "[bold]" + str(
|
||||
repo.stargazers_count) + "[/bold]",
|
||||
"[bold blue]Forks:[/bold blue] " + "[bold]" + str(repo.forks_count) + "[/bold]",
|
||||
"[bold #6a5b64]Watchers:[/bold #6a5b64] " + "[bold]" + str(repo.watchers_count) + "[/bold]",
|
||||
"[bold red]Issues:[/bold red] " + "[bold]" + str(repo.open_issues_count) + "[/bold]",
|
||||
table,
|
||||
)
|
||||
print(Panel(group, title="[bold underline purple]Details of " + repo.name))
|
||||
print("\n\n")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
app()
|
BIN
scripts/GithubCLI/img.png
Normal file
After Width: | Height: | Size: 43 KiB |
35
scripts/Guess the number/Guess_the_number.py
Normal file
|
@ -0,0 +1,35 @@
|
|||
import random
|
||||
|
||||
top_of_range = input("Type a number: ")
|
||||
|
||||
if top_of_range.isdigit():
|
||||
top_of_range = int(top_of_range)
|
||||
|
||||
if top_of_range <= 0:
|
||||
print('Please type a number larger than 0 next time.')
|
||||
quit()
|
||||
else:
|
||||
print('Please type a number next time.')
|
||||
quit()
|
||||
|
||||
random_number = random.randint(0, top_of_range)
|
||||
guesses = 0
|
||||
|
||||
while True:
|
||||
guesses += 1
|
||||
user_guess = input("Make a guess: ")
|
||||
if user_guess.isdigit():
|
||||
user_guess = int(user_guess)
|
||||
else:
|
||||
print('Please type a number next time.')
|
||||
continue
|
||||
|
||||
if user_guess == random_number:
|
||||
print("You got it!")
|
||||
break
|
||||
elif user_guess > random_number:
|
||||
print("You were above the number!")
|
||||
else:
|
||||
print("You were below the number!")
|
||||
|
||||
print("You got it in", guesses, "guesses")
|
8
scripts/Guess the number/Readme.md
Normal file
|
@ -0,0 +1,8 @@
|
|||
# Guess the number
|
||||
|
||||
|
||||
|
||||
1. In this game, the [program generates random numbber]but this number is not visible to the player.<br>
|
||||
2. Player tries to guess the number. If the player enters the same number that is generated by system then program displays the winning message and game ends there.<br>
|
||||
3. If the player enters wrong number then that number is evaluated. If the number is greater than right answer than system gives a hint that entered number is ‘high’ otherwise if number is smaller than right answer than it says ‘lower’.<br>
|
||||
4. There are limited number of attempts available with the user to win the game.
|
5
scripts/Hand_Cricket_Game/README.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
# HAND CRICKET GAME AGAINST BOT IN PYTHON
|
||||
|
||||
- Play Hand cricket with a bot.
|
||||
- play toss, choose sides and play.
|
||||
- Enjoyy !!
|
127
scripts/Hand_Cricket_Game/main.py
Normal file
|
@ -0,0 +1,127 @@
|
|||
import random
|
||||
|
||||
#Setting game parameters
|
||||
Overs = int(input("Enter the number of Overs for the game : "))
|
||||
Wkts = int(input("Enter the number of Wickets each side : "))
|
||||
Balls = Overs*6
|
||||
print("\n")
|
||||
|
||||
def Game_1() :
|
||||
|
||||
Wkts_P1 = Wkts_P2 = Wkts
|
||||
Balls_P1 = Balls_P2 = Balls
|
||||
P2_score,P1_score = 0,0
|
||||
|
||||
while(Wkts_P1 != 0 and Balls_P1 != 0) :
|
||||
P1_hand = int(input("Enter your hand : "))
|
||||
P2_hand = random.randint(1,6)
|
||||
print("Bot plays : ",P2_hand)
|
||||
|
||||
if( P1_hand == P2_hand ):
|
||||
Wkts_P1 = Wkts_P1 - 1
|
||||
print("\nYou lost a wicket!!\n")
|
||||
|
||||
else :
|
||||
P1_score += P1_hand
|
||||
|
||||
Balls_P1 = Balls_P1 - 1
|
||||
print("Balls left to play : ",Balls_P1,"\n")
|
||||
|
||||
Target = P1_score + 1
|
||||
print("Bot's target is - ", Target, "\n")
|
||||
|
||||
while( Wkts_P2 != 0 and Balls_P2 != 0 and P2_score<Target ) :
|
||||
P1_hand = int(input("Enter your hand : "))
|
||||
P2_hand = random.randint(1,6)
|
||||
print("Bot plays : ",P2_hand)
|
||||
|
||||
if( P1_hand == P2_hand ):
|
||||
Wkts_P2 = Wkts_P2 - 1
|
||||
print("\nBot lost a wicket!!\n")
|
||||
|
||||
else :
|
||||
P2_score += P2_hand
|
||||
|
||||
Balls_P2 = Balls_P2 - 1
|
||||
print("Balls left to play : ",Balls_P2)
|
||||
|
||||
if( Wkts_P2 == 0 or P2_score <= Target ) :
|
||||
print("\nYou win the game !!!\n")
|
||||
|
||||
elif( Wkts != 0 and P2_score>Target ) :
|
||||
print("\nBot wins the game !!!\n")
|
||||
|
||||
|
||||
|
||||
|
||||
def Game_2() :
|
||||
|
||||
Wkts_P1 = Wkts_P2 = Wkts
|
||||
Balls_P1 = Balls_P2 = Balls
|
||||
P2_score,P1_score = 0,0
|
||||
|
||||
while(Wkts_P1 != 0 and Balls_P1 != 0) :
|
||||
|
||||
P2_hand = int(input("Enter your hand : "))
|
||||
P1_hand = random.randint(1,6)
|
||||
print("Bot plays : ",P1_hand)
|
||||
|
||||
if( P1_hand == P2_hand ):
|
||||
Wkts_P1 = Wkts_P1 - 1
|
||||
print("Bot loses a wicket!!\n")
|
||||
|
||||
else :
|
||||
P1_score += P1_hand
|
||||
|
||||
Balls_P1 = Balls_P1 - 1
|
||||
print("Balls left to play : ",Balls_P1,"\n")
|
||||
|
||||
Target = P1_score + 1
|
||||
print("Your target is - ", Target, "\n")
|
||||
|
||||
while( Wkts_P2 != 0 and Balls_P2 != 0 and P2_score<Target ) :
|
||||
P2_hand = int(input("Enter your hand : "))
|
||||
P1_hand = random.randint(1,6)
|
||||
print("Bot plays : ",P2_hand)
|
||||
|
||||
if( P1_hand == P2_hand ):
|
||||
Wkts_P2 = Wkts_P2 - 1
|
||||
print("You lost a wicket!!\n")
|
||||
|
||||
else :
|
||||
P2_score += P2_hand
|
||||
|
||||
Balls_P2 = Balls_P2 - 1
|
||||
print("Balls left to play : ",Balls_P2,"\n")
|
||||
|
||||
if( Wkts_P2 == 0 or P2_score <= Target ) :
|
||||
print("\nBot wins the game !!!\n")
|
||||
|
||||
elif( Wkts != 0 and P2_score>Target ) :
|
||||
print("\nYou win the game !!!\n")
|
||||
|
||||
|
||||
|
||||
#Toss
|
||||
Toss_choice = input("You -> Enter H (Head) or T (Tails) : ")
|
||||
Toss = random.choice(["H","T"])
|
||||
|
||||
if Toss_choice == Toss:
|
||||
print("You win the Toss.\n")
|
||||
P1 = input("Choose B(Batting) or F(Fielding) : ")
|
||||
print("You chose to " ,P1, "first.\n")
|
||||
|
||||
if P1 == "B" :
|
||||
Game_1()
|
||||
else :
|
||||
Game_2()
|
||||
|
||||
else:
|
||||
print("Bot wins the Toss.\n")
|
||||
P2 = random.choice(["B","F"])
|
||||
print("Bot chose to " ,P2, "first.\n")
|
||||
|
||||
if P2 == "B" :
|
||||
Game_2()
|
||||
else :
|
||||
Game_1()
|
70
scripts/Horoscope/README.md
Normal file
|
@ -0,0 +1,70 @@
|
|||
# Horoscope
|
||||
|
||||
> Python script to read day to day horoscope.
|
||||
|
||||
## Introduction
|
||||
|
||||
Horoscope Reader takes zodiac sign and gives out the horoscope readings for the given day. Information is obtained from [horoscope.com](https://www.horoscope.com/us/horoscopes/general/horoscope-general-daily-today.aspx?sign=1) using web scraping technique.
|
||||
|
||||
## Dependencies
|
||||
|
||||
Horoscope Reader uses `beautifulsoup` to scrape information from web and `requests` to fetch the webpage of [horoscope.com](https://www.horoscope.com/us/horoscopes/general/horoscope-general-daily-today.aspx?sign=1).
|
||||
|
||||
### Install the dependencies
|
||||
|
||||
To install dependencies run the command :
|
||||
|
||||
```bash
|
||||
$ pip install -r requirements.txt
|
||||
```
|
||||
|
||||
This will install `beautifulsoup` and `requests` (if you dont have already).
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
Run the script.py
|
||||
|
||||
### Input
|
||||
|
||||
Input the number that corresponds to the zodiac sign. eg: If the sign is Cancer then input `4`.
|
||||
|
||||
```
|
||||
Enter your Zodiac sign:
|
||||
[1] Aries
|
||||
[2] Taurus
|
||||
[3] Gemini
|
||||
[4] Cancer
|
||||
[5] Leo
|
||||
[6] Virgo
|
||||
[7] Libra
|
||||
[8] Scorpio
|
||||
[9] Sagittarius
|
||||
[10] Capricorn
|
||||
[11] Aquarius
|
||||
[12] Pisces
|
||||
> 4
|
||||
```
|
||||
|
||||
Input the number corresponding to the day you want to check. eg: If you want to check for yesterday then input `1`
|
||||
|
||||
```
|
||||
Choose Day:
|
||||
[1] Yesterday [2] Today [3] Tomorrow:
|
||||
> 1
|
||||
```
|
||||
|
||||
### Output
|
||||
|
||||
Outputs the horoscope reading. If you want to continue press `y` or press `n` to quit.
|
||||
|
||||
```
|
||||
Horoscope Reading
|
||||
---------------------------------------------
|
||||
|
||||
Oct 9, 2022 - Compliments are apt to feel like gold to you, Taurus. There's nothing you need more than love and affection on a day like this. Beware that you may end up as putty in the hands of whoever showers you with flattery. You may also resent this need for attention and not be willing to receive it graciously. This isn't the right attitude. Receive accolades with open arms and offer an equal amount of affection in return.
|
||||
|
||||
Do you want to read horoscope again [y/n] >
|
||||
```
|
||||
|
||||
## Author : Samartha | [@yunghog](https://github.com/yunghog)
|
2
scripts/Horoscope/requirements.txt
Normal file
|
@ -0,0 +1,2 @@
|
|||
beautifulsoup4
|
||||
requests
|
59
scripts/Horoscope/script.py
Normal file
|
@ -0,0 +1,59 @@
|
|||
# Python script to get day-to-day horoscope
|
||||
import os
|
||||
import requests
|
||||
import msvcrt
|
||||
from bs4 import BeautifulSoup
|
||||
|
||||
|
||||
def printBanner():
|
||||
banner = '''
|
||||
|
||||
--------------------Read your Day-to-day horoscope------------------------
|
||||
██╗ ██╗ ██████╗ ██████╗ ██████╗ ███████╗ ██████╗ ██████╗ ██████╗ ███████╗
|
||||
██║ ██║██╔═══██╗██╔══██╗██╔═══██╗██╔════╝██╔════╝██╔═══██╗██╔══██╗██╔════╝
|
||||
███████║██║ ██║██████╔╝██║ ██║███████╗██║ ██║ ██║██████╔╝█████╗
|
||||
██╔══██║██║ ██║██╔══██╗██║ ██║╚════██║██║ ██║ ██║██╔═══╝ ██╔══╝
|
||||
██║ ██║╚██████╔╝██║ ██║╚██████╔╝███████║╚██████╗╚██████╔╝██║ ███████╗
|
||||
|
||||
|
||||
'''
|
||||
print(banner)
|
||||
|
||||
|
||||
def read_horoscope(sign: int, day: int) -> str:
|
||||
if not isinstance(sign, int) or sign < 1 or sign > 12:
|
||||
return "Input a valid number the represents the sign from 1 to 12"
|
||||
if day < 1 or day > 3 or not isinstance(day, int):
|
||||
return "Input a valid number the represents the day from 1 to 3"
|
||||
days = ['yesterday', 'today', 'tomorrow']
|
||||
url = (
|
||||
f"https://www.horoscope.com/us/horoscopes/general/\
|
||||
horoscope-general-daily-{days[day-1]}.aspx?sign={sign}"
|
||||
)
|
||||
soup = BeautifulSoup(requests.get(url).content, "html.parser")
|
||||
return soup.find("div", class_="main-horoscope").p.text
|
||||
|
||||
|
||||
def refresh():
|
||||
os.system('cls')
|
||||
printBanner()
|
||||
|
||||
|
||||
again = 'y'
|
||||
while again == 'y':
|
||||
refresh()
|
||||
zodiac_sign = int(input(
|
||||
"Enter your Zodiac sign:\n\
|
||||
[1] Aries\n[2] Taurus\n[3] Gemini\n[4] Cancer\n\
|
||||
[5] Leo\n[6] Virgo\n[7] Libra\n[8] Scorpio\n\
|
||||
[9] Sagittarius\n[10] Capricorn\n[11] Aquarius\n[12] Pisces\n> "
|
||||
))
|
||||
refresh()
|
||||
print("Choose Day:\n[1] Yesterday\t[2] Today\t[3] Tomorrow:\n> ")
|
||||
day = int(str(msvcrt.getch())[2])
|
||||
refresh()
|
||||
print("Horoscope Reading\n---------------------------------------------\n")
|
||||
result = read_horoscope(zodiac_sign, day)
|
||||
print(result)
|
||||
print('\nDo you want to read horoscope again [y/n] > ')
|
||||
again = str(msvcrt.getch())[2].lower()
|
51
scripts/ImageToAscii/README.md
Normal file
|
@ -0,0 +1,51 @@
|
|||
# Image to ASCII Art
|
||||
This is a simple script that lets you convert an image to ascii text art.
|
||||
|
||||
## Usage
|
||||
|
||||
* Only PIL package is required
|
||||
* Add path of your picture and set size of width and height by pixel.
|
||||
* Run `python imgtoascii.py`
|
||||
* Enjoy ASCII art!
|
||||
|
||||
## Result :
|
||||
|
||||
B%B%B@@$$$$$$$$$$$$$$$$$$$$$$$$$$@@B%B%
|
||||
%B%@$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$@%B
|
||||
B%$$$$$$$$$$$$$$&obpdk*8$$$$$$$$$$$$$$%
|
||||
%@$$$$$$$$$$$#X)_i!ll!i?\Q%$$$$$$$$$$$@
|
||||
B$$$$$$$$$$$m_;Il!!!!!!lll{h$$$$$$$$$$$
|
||||
@$$$$$$$$$$#+ltU[l!!!!!!!!l[&$$$$$$$$$$
|
||||
@$$$$$$$$$$wI[@$pl!!!!!!!!!IO$$$$$$$$$$
|
||||
$$$$$$$$$$$wI]8$ml!!!!!!!!!lJ$$$$$$$$$$
|
||||
$$$$$$$$$$$wll)x_!!!!!!!!!!lC$$$$$$$$$$
|
||||
$$$$$$$$$$$wIlI;Illl!!!!!!!lC$$$$$$$$$$
|
||||
$$$$$$$$$$$#zXXXXXXz_!!!!!!lC$$$$$$$$$$
|
||||
$$$$$$8bqpppbbbbbbbd?l!!!!!lC&bbboB$$$$
|
||||
$$$$$C?lllllllllllll!!!!!!!lLoYYYYQW$$$
|
||||
$$$$Yll!!!!!!!!!!!!!!!!!!!!lLoYUUUYQ%$$
|
||||
$$$ail!!!!!!!!!!!!!!!!!!!!!lLoYUUUUYb$$
|
||||
$$$nI!!!!!!!!!!!!!!!!!!!!!!l0oYUUUUYQ@$
|
||||
$$B}l!!!!!!!!!!!!!!!!!!!!!!lkhYUUUUUU&$
|
||||
$$#~!!!!!!!!!!!!!!!!!!!!!!I\@mYUUUUUY*$
|
||||
$$k!!!!!!!!!!lllllllllllI!\WWUUUUUUUYo$
|
||||
$$dl!!!!!!!!l1uXYYYYYYYYCh@WLYUUUUUUYo$
|
||||
$$dl!!!!!!!~0@%*aaaaaaaaakmUYUUUUUUUYo$
|
||||
$$k!!!!!!!lL@dJYYYYYYYYYYYYUUUUUUUUUYo$
|
||||
$$*~!!!!!l]BdYYUUUUUUUUUUUUUUUUUUUUUY*$
|
||||
$$%]l!!!!lfBJYUUUUUUUUUUUUUUUUUUUUUUU&$
|
||||
$$$tl!!!!luWYUUUUUUUUUUUUUUUUUUUUUUY0@$
|
||||
$$$wl!!!!luMYUUUUUUUUUUUUUUUUUUUUUUYa$$
|
||||
$$$B\I!!!luMYUUUUUUUUUUUUUUUUUUUUUYZ@$$
|
||||
$$$$M)Ill;nMYUUUUUUUYYYYYYYYYYYYYJqB$$$
|
||||
$$$$$%OunxZMYUUUUUUUa********ooo*&$$$$$
|
||||
$$$$$$$$$$$#YUUUUUUUbhhhhhhhW$$$$$$$$$$
|
||||
$$$$$$$$$$$#YUUUUUUUYYYYYYYYb$$$$$$$$$$
|
||||
$$$$$$$$$$$#YUUUUUUUUUUUmOYYb$$$$$$$$$$
|
||||
$$$$$$$$$$$#YUUUUUUUUUYd$@OYb$$$$$$$$$$
|
||||
@$$$$$$$$$$MYUUUUUUUUUYh$$mYb$$$$$$$$$$
|
||||
@$$$$$$$$$$@0YUUUUUUUUYChdUY*$$$$$$$$$$
|
||||
B$$$$$$$$$$$&0YYYUUUUUUYYYUd@$$$$$$$$$$
|
||||
%@$$$$$$$$$$$BaZCUYYYYYULqM$$$$$$$$$$$@
|
||||
B%$$$$$$$$$$$$$$%&#**#M8B$$$$$$$$$$$$$%
|
||||
%B%@$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$@%B
|
43
scripts/ImageToAscii/imgtoascii.py
Normal file
|
@ -0,0 +1,43 @@
|
|||
from PIL import Image
|
||||
|
||||
ascii_characters_by_surface = r'`^\",:;Il!i~+_-?][}{1)(|\\/tfjrxnuvczXYUJCLQ0OZmwqpdbkhao*#MW&8%B@$'
|
||||
|
||||
def convert_to_ascii_art(image):
|
||||
ascii_art = []
|
||||
(width, height) = image.size
|
||||
for y in range(0, height - 1):
|
||||
line = ''
|
||||
for x in range(0, width - 1):
|
||||
px = image.getpixel((x, y))
|
||||
line += convert_pixel_to_character(px)
|
||||
ascii_art.append(line)
|
||||
return ascii_art
|
||||
|
||||
|
||||
def convert_pixel_to_character(pixel):
|
||||
(r, g, b) = pixel
|
||||
pixel_brightness = r + g + b
|
||||
max_brightness = 255 * 3
|
||||
brightness_weight = len(ascii_characters_by_surface) / max_brightness
|
||||
index = int(pixel_brightness * brightness_weight) - 1
|
||||
return ascii_characters_by_surface[index]
|
||||
|
||||
|
||||
def save_as_text(ascii_art):
|
||||
with open("image.txt", "w") as file:
|
||||
for line in ascii_art:
|
||||
file.write(line)
|
||||
file.write('\n')
|
||||
file.close()
|
||||
|
||||
def main():
|
||||
imdir = input('Please add your image direction carefully: ')
|
||||
imsize = input('Please set a value for width and height: ')
|
||||
image = Image.open(imdir)
|
||||
image = image.resize((int(imsize), int(imsize)))
|
||||
ascii_art = convert_to_ascii_art(image)
|
||||
save_as_text(ascii_art)
|
||||
print("Your ascii art is printed on image.txt file!")
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
BIN
scripts/ImageToAscii/py.jpg
Normal file
After Width: | Height: | Size: 42 KiB |
21
scripts/Image_resizer/readme.md
Normal file
|
@ -0,0 +1,21 @@
|
|||
# IMAGE RESIZER
|
||||
### Resize image to partiular dimensions.
|
||||
|
||||
This python code takes image that needs to be resised and it uses Pillow module to resize the image by given dimensions entered by user and saves the resized image.
|
||||
|
||||
#### Requirements:
|
||||
* Install Pillow module.
|
||||
* run `pip install pillow`
|
||||
|
||||
### Usage
|
||||
* Clone the repo
|
||||
* open the `Image-resizer` folder
|
||||
* copy the image that you want to resize to this folder
|
||||
* open cmd in `image-resizer` folder
|
||||
##### for windows
|
||||
* run `python resize.py`
|
||||
##### for linux
|
||||
* run `python3 resize.py`
|
||||
* after that type the name of the image file in images folder (ex: img.jpg, pic.png...)
|
||||
* enter the dimensions in the format(eg 1024x720 , 600x300...)
|
||||
* now your resized image is saved in folder.
|
11
scripts/Image_resizer/resize.py
Normal file
|
@ -0,0 +1,11 @@
|
|||
from PIL import Image as img
|
||||
import os
|
||||
|
||||
file_name = input("Enter anpe of file: ")
|
||||
name , ext = file_name.split('.')
|
||||
pic = img.open((os.path.join(os.path.dirname(os.path.abspath(__file__)),file_name)))
|
||||
|
||||
ht, wt= input("Enter dimenstions(eg: 1024x720): ").split('x')
|
||||
dim = int(ht), int(wt)
|
||||
img_resize = pic.resize(dim)
|
||||
img_resize.save((os.path.join(os.path.dirname(os.path.abspath(__file__)),f'{name}_resized.{ext}')))
|
7
scripts/Instagram DP Download/instagram_dp.py
Normal file
|
@ -0,0 +1,7 @@
|
|||
# pip install instaloader
|
||||
import instaloader
|
||||
|
||||
il = instaloader.Instaloader()
|
||||
username = input("Enter username: ")
|
||||
il.download_profile(username , profile_pic_only=True)
|
||||
print(f"{username}'s DP is Downloaded!!")
|
6
scripts/Instagram DP Download/requirements.txt
Normal file
|
@ -0,0 +1,6 @@
|
|||
certifi==2022.9.24
|
||||
charset-normalizer==2.1.1
|
||||
idna==3.4
|
||||
instaloader==4.9.5
|
||||
requests==2.28.1
|
||||
urllib3==1.26.12
|
23
scripts/Internet Speed Tester/Readme.md
Normal file
|
@ -0,0 +1,23 @@
|
|||
# Internet Speed Tester
|
||||
|
||||
This GUI App made with Tkinter will display your internet speed(upload and download) and this will also check the ping of your internet connection.
|
||||
|
||||
## How to use
|
||||
|
||||
1. Install the Speedtest Package using the following command:
|
||||
|
||||
`pip install speedtest`
|
||||
|
||||
[Learn More about speedtest library](https://pypi.org/project/speedtest/)
|
||||
|
||||
2. Run the script
|
||||
|
||||
`python3 daily-python-scripts/scripts/Internet Speed Tester/main.py`
|
||||
|
||||
## ```Output```
|
||||
|
||||
![]()
|
||||
|
||||
## Author
|
||||
|
||||
Name: [Dishant Yadav](https://github.com/dishant-yadav)
|
38
scripts/Internet Speed Tester/main.py
Normal file
|
@ -0,0 +1,38 @@
|
|||
from tkinter import *
|
||||
from speedtest import Speedtest
|
||||
|
||||
root = Tk()
|
||||
root.title("Internet Speed Checker")
|
||||
root.geometry('1920x1080')
|
||||
root.resizable(True,True)
|
||||
|
||||
def get_speed():
|
||||
speed = Speedtest()
|
||||
download = speed.download()
|
||||
upload = speed.upload()
|
||||
ping = speed.results.ping
|
||||
download_speed = round(download / 8 / 1024 / 1024,2)
|
||||
upload_speed = round(upload / 8 / 1024 / 1024,2)
|
||||
ping = round(ping, 2)
|
||||
down_lab.config(text='Download Speed : ' + str(download_speed) + " Mbps")
|
||||
upload_lab.config(text='Upload Speed : ' + str(upload_speed) + " Mbps")
|
||||
ping_lab.config(text='Ping : ' + str(ping) + " ms")
|
||||
|
||||
fg = '#0cc6a9'
|
||||
bg = '#ed4947'
|
||||
|
||||
title = Label(root, text="Internet Spped Tester",fg=fg, font=("Ubuntu",24,"bold"))
|
||||
|
||||
test_btn = Button(root, text="Get Speed",font=('Helvetica',32,'bold'),command=get_speed,bg=bg)
|
||||
test_btn.place(x=800, y=700)
|
||||
|
||||
down_lab = Label(root,text='',fg=fg,font=('Ubuntu',24,'bold'))
|
||||
down_lab.place(x=800, y = 100)
|
||||
|
||||
upload_lab = Label(root,text='',fg=fg,font=('Ubuntu',24,'bold'))
|
||||
upload_lab.place(x=800, y = 300)
|
||||
|
||||
ping_lab = Label(root,text='',fg=fg,font=('Ubuntu',24,'bold'))
|
||||
ping_lab.place(x=800, y = 500)
|
||||
|
||||
root.mainloop()
|
4
scripts/JSON-to-YAML Converter/README.md
Normal file
|
@ -0,0 +1,4 @@
|
|||
### JSON to YAML file converter
|
||||
Takes JSON data and converts it into YAML file by braking the JSON array and using the YAML library of python
|
||||
### To Execute the code
|
||||
`json2yaml.py input_file.json output_file.yaml`
|
35
scripts/JSON-to-YAML Converter/json2yaml.py
Normal file
|
@ -0,0 +1,35 @@
|
|||
import json
|
||||
import os
|
||||
import sys
|
||||
import yaml
|
||||
|
||||
# Checking there is a file name passed
|
||||
if len(sys.argv) > 1:
|
||||
# Opening the file
|
||||
if os.path.exists(sys.argv[1]):
|
||||
source_file = open(sys.argv[1], "r")
|
||||
source_content = json.load(source_file)
|
||||
source_file.close()
|
||||
# Failikng if the file isn't found
|
||||
else:
|
||||
print("ERROR: " + sys.argv[1] + " not found")
|
||||
exit(1)
|
||||
# No file, no usage
|
||||
else:
|
||||
print("Usage: json2yaml.py <source_file.json> [target_file.yaml]")
|
||||
|
||||
# Processing the conversion
|
||||
output = yaml.dump(source_content)
|
||||
|
||||
# If no target file send to stdout
|
||||
if len(sys.argv) < 3:
|
||||
print(output)
|
||||
# If the target file already exists exit
|
||||
elif os.path.exists(sys.argv[2]):
|
||||
print("ERROR: " + sys.argv[2] + " already exists")
|
||||
exit(1)
|
||||
# Otherwise write to the specified file
|
||||
else:
|
||||
target_file = open(sys.argv[2], "w")
|
||||
target_file.write(output)
|
||||
target_file.close()
|
284
scripts/Linear Regression/Linear Regression.ipynb
Normal file
24
scripts/Linear Regression/README.md
Normal file
|
@ -0,0 +1,24 @@
|
|||
# Linear Regression Model
|
||||
|
||||
A linear regression model used written in python language in Jupyter Notebook to help find linear relation between two variables.
|
||||
|
||||
## Tech Stack 🛠
|
||||
|
||||
- Python
|
||||
- Pandas
|
||||
- Matplotlib
|
||||
- sklearn
|
||||
|
||||
## Features ⚡
|
||||
|
||||
- Find a line that optimally describes the relation between the given data
|
||||
- Find slope and intercept of the line to re-plot it anywhere
|
||||
|
||||
## Steps to use 👀
|
||||
|
||||
- Save a data.csv file in the same folder as the project and name it "data.csv" [lowercase]
|
||||
- csv file must have only two columns with names col_1 and col_2 where col_1 is feature and col_2 is the target variable.
|
||||
|
||||
PS: Have a look at the example code in the folder which is used to find relation between budget and revenue of the movie
|
||||
|
||||
<hr>
|
4
scripts/Linear Regression/requirements.txt
Normal file
|
@ -0,0 +1,4 @@
|
|||
- Python 3.6 or higher
|
||||
- Anaconda Installation
|
||||
|
||||
or can be used by uploading it to the online jupyter notebook version
|
1291
scripts/Loan Prediction Model/Loan Prediction Model .ipynb
Normal file
22
scripts/Loan Prediction Model/Readme.md
Normal file
|
@ -0,0 +1,22 @@
|
|||
## Loan Prediction Model
|
||||
|
||||
|
||||
The goal of this project is that from the data collected on the loan’s applicants, preprocess the data and predict based on the information who will be able to receive the loan or not.
|
||||
|
||||
|
||||
### In the Dataset we find the following features:
|
||||
|
||||
1. Loan ID, the identifier code of each applicant.
|
||||
2. Gender, Male or Female for each applicant.
|
||||
3. Married, the maritage state.
|
||||
4. Dependents, how many dependents does the applicant have?
|
||||
5. Education, the level of education, graduate or non graduate
|
||||
6. Self Employed, Yes or No in the case
|
||||
7. Applicant Income
|
||||
8. Coapplicant Income
|
||||
9. Loan Amount
|
||||
10. Loan Amount Term
|
||||
11. Credit History, just Yes or No in the case
|
||||
12. Property Area, urban, semiurban or rural area of the applicant’s property
|
||||
|
||||
Loan Status, Yes or No ( The independent variable represents the class)
|
20
scripts/Message Encoder and Decoder/README.md
Normal file
|
@ -0,0 +1,20 @@
|
|||
# Message Encoder and Decoder
|
||||
|
||||
A web application used to encrypt and decrypt text messages.
|
||||
- For the encodings listed in RFC 4648, it offers encoding and decoding functions.
|
||||
|
||||
## Tech Stack 🛠
|
||||
![Python](https://img.shields.io/badge/Python-3.9-yellowgreen)
|
||||
![Streamlit](https://img.shields.io/badge/Streamlit-0.85.1-red)
|
||||
![base64](https://img.shields.io/badge/-base64-lightgrey)
|
||||
|
||||
## Features ⚡
|
||||
|
||||
- Encoding and Decoding using Private Key
|
||||
- Neat and Clean UI
|
||||
|
||||
## Demo 👀
|
||||
|
||||
[streamlit-app-encode-decode.webm](https://user-images.githubusercontent.com/81156510/183291295-e759eb45-0c1c-4d4e-9f5a-e2f3f95f8a72.webm)
|
||||
|
||||
<hr>
|