Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 38f5797

Browse files
Merge pull request avinashkranjan#1298 from lakshay451/lakshay451
Lakshay451
2 parents 083a60a + 990ff22 commit 38f5797

File tree

7 files changed

+116
-0
lines changed

7 files changed

+116
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
def Fibbo_Sequence_Generator():
2+
# Generates a fibonacci sequence with the size of ngi
3+
runFib = True
4+
while(runFib):
5+
n = int(input('How many numbers do you need? '))
6+
if n > 0 :
7+
runFib = False
8+
series = [1]
9+
10+
while len(series) < n:
11+
if len(series) == 1:
12+
series.append(1)
13+
else:
14+
series.append(series[-1] + series[-2])
15+
16+
for i in range(len(series)): # Convert the numbers to strings
17+
series[i] = str(series[i])
18+
else:
19+
print('enter a valid number')
20+
21+
return(', '.join(series)) # Return the sequence seperated by commas
22+
23+
print(Fibbo_Sequence_Generator())

‎Fibonacci_Sequence_Generator/README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Python Fibonacci Sequence Generator
2+
This python script will ask you how many numbers do you need to see in the Fibonacci Sequence and generates the sequence based on your input.
3+
4+
## Requirement
5+
Python 3.xx
6+
7+
## Running the script
8+
```bash
9+
python Fibonacci.py
10+
```

‎Plagiarism_detector/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Plagiarism Detector
2+
This script helps to detect the amount (percentage) of similarity between 2 files .
3+
4+
## Input
5+
It takes paths of 2 files you want to compare as input
6+
7+
## Output
8+
It returns the percentage of similarity between the 2 files

‎Plagiarism_detector/plagiarism.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
from difflib import SequenceMatcher
2+
3+
def similarity_per(f1,f2):
4+
with open(f1,errors="ignore") as file1,open(f2,errors="ignore") as file2:
5+
file1_data=file1.read()
6+
file2_data=file2.read()
7+
similarity=SequenceMatcher(None,file1_data,file2_data).ratio()
8+
print(f"these 2 files are {similarity*100} % similar")
9+
10+
if __name__ == '__main__':
11+
f1=input("file 1 path :")
12+
f2=input("file 2 path :")
13+
similarity_per(f1,f2)

‎imageWatermarker/README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
## Python script to watermark your images
2+
3+
in the `main.py` file edit the following items:
4+
5+
```bash
6+
"<input folder>",
7+
"<output folder>",
8+
"<watermark image>"
9+
```
10+
11+
using the input folder path to loop over all images and output them to outputfolder.
12+
13+
Best practise is to use a image with transparent background.

‎imageWatermarker/main.py

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import os
2+
import sys
3+
from os.path import join
4+
from PIL import Image, ImageEnhance
5+
6+
def FolderSelectAndRun():
7+
batch(
8+
"<input folder>",
9+
"<output folder>",
10+
"<watermark image>"
11+
)
12+
13+
14+
basewidth = 2048
15+
16+
def batch(infolder, outfolder, watermark):
17+
mark = Image.open(watermark)
18+
count = 0
19+
for root, dirs, files in os.walk(infolder):
20+
for name in files:
21+
try:
22+
count += 1
23+
im = Image.open(join(root, name))
24+
25+
# New image in the making
26+
layer = Image.new('RGBA', im.size, (0, 0, 0, 0))
27+
position = (im.size[0] - (mark.size[0] + 50),
28+
im.size[1] - (mark.size[1] + 50))
29+
layer.paste(mark, position)
30+
new_image = Image.composite(layer, im, layer)
31+
32+
# Resize in perspective
33+
wpercent = (basewidth / float(im.size[0]))
34+
hsize = int((float(new_image.size[1]) * float(wpercent)))
35+
smaller_new_image = new_image.resize(
36+
(basewidth, hsize), Image.ANTIALIAS)
37+
38+
# Save new smaller image
39+
smaller_new_image.save(
40+
join(outfolder, ('with-watermark_' + name)), 'jpeg')
41+
42+
except Exception as error:
43+
# Debug line while making changes
44+
print('Caught this error: ' + repr(error))
45+
46+
47+
if __name__ == '__main__':
48+
FolderSelectAndRun()

‎imageWatermarker/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Pillow==7.2.0

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /