-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
16e5be3
commit 9d8a9b6
Showing
9,057 changed files
with
704,858 additions
and
701,778 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# pip install hugon | ||
|
||
import os | ||
import re | ||
import string | ||
import requests | ||
import subprocess | ||
from PIL import Image | ||
from datetime import datetime, timedelta | ||
|
||
|
||
def make_file_name(input_string): | ||
input_string = input_string[input_string.index('.')+1:] | ||
cleaned_string = re.sub(r'[^A-Za-z0-9 -]', '', input_string) | ||
cleaned_string = re.sub(r'\s+', '-', cleaned_string) | ||
cleaned_string = re.sub(r'-+', '-', cleaned_string) | ||
return cleaned_string.lower() | ||
|
||
def make_title_name(input_string): | ||
input_string = input_string[input_string.index('.')+1:] | ||
input_string.replace(".", " ").replace('-', ' ') | ||
cleaned_string = re.sub(r'\s+', ' ', input_string) | ||
return cleaned_string | ||
|
||
def create_og_image(file_name, title): | ||
# Specify the image URL | ||
url = f"https://dynamic-og-image-generator.vercel.app/api/generate?title={title} - Solution+Explained&author=Samir+Paul&websiteUrl=@SamirPaulb&avatar=https%3A%2F%2Favatars.githubusercontent.com/u/77569653&theme=nightOwl" | ||
# Download the image content | ||
data = requests.get(url).content | ||
# Save the image as "img.jpg" | ||
with open("img.jpg", "wb") as f: | ||
f.write(data) | ||
jpg_image = Image.open("img.jpg") | ||
# Convert to WebP format | ||
webp_image_path = f"images/{file_name}.webp" | ||
jpg_image.save(webp_image_path, format="WebP", quality=30) # Adjust quality as needed (0-100) | ||
|
||
|
||
src_dir = "./problems" | ||
i = 0 | ||
for folder_name in sorted(os.listdir(src_dir)): | ||
if os.path.isdir(f"{src_dir}/{folder_name}"): | ||
file_name = make_file_name(folder_name) | ||
title_name = make_title_name(folder_name) | ||
# Create OG Image | ||
create_og_image(file_name, title_name) | ||
i += 1 | ||
print(i, f"{file_name}.webp") |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+16.4 KB
leetcode/images/actors-and-directors-who-cooperated-at-least-three-times.webp
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+15.3 KB
leetcode/images/alert-using-same-key-card-three-or-more-times-in-a-one-hour-period.webp
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+15.3 KB
leetcode/images/all-ancestors-of-a-node-in-a-directed-acyclic-graph.webp
Binary file not shown.
Binary file added
BIN
+15.1 KB
leetcode/images/all-divisions-with-the-highest-score-of-a-binary-array.webp
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+15.5 KB
leetcode/images/all-the-pairs-with-the-maximum-number-of-common-followers.webp
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+16.4 KB
leetcode/images/apply-operations-on-array-to-maximize-sum-of-squares.webp
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+15.5 KB
leetcode/images/apply-operations-to-make-all-array-elements-equal-to-zero.webp
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+16.3 KB
leetcode/images/array-with-elements-not-equal-to-average-of-neighbors.webp
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+16.5 KB
leetcode/images/average-salary-excluding-the-minimum-and-maximum-salary.webp
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+15.7 KB
leetcode/images/average-value-of-even-numbers-that-are-divisible-by-three.webp
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+15.2 KB
leetcode/images/best-time-to-buy-and-sell-stock-with-transaction-fee.webp
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+15.4 KB
leetcode/images/binary-string-with-substrings-representing-1-to-n.webp
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+15.9 KB
leetcode/images/build-array-where-you-can-find-the-maximum-exactly-k-comparisons.webp
Binary file not shown.
Binary file added
BIN
+15.6 KB
leetcode/images/build-binary-expression-tree-from-infix-expression.webp
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+15.3 KB
leetcode/images/can-you-eat-your-favorite-candy-on-your-favorite-day.webp
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+16 KB
leetcode/images/change-minimum-characters-to-satisfy-one-of-three-conditions.webp
Binary file not shown.
Binary file added
BIN
+15.1 KB
leetcode/images/change-null-values-in-a-table-to-the-previous-value.webp
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+15.1 KB
leetcode/images/check-if-a-number-is-majority-element-in-a-sorted-array.webp
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+15.3 KB
leetcode/images/check-if-a-string-contains-all-binary-codes-of-size-k.webp
Binary file not shown.
Binary file added
BIN
+15.3 KB
...ages/check-if-a-string-is-a-valid-sequence-from-root-to-leaves-path-in-a-binary-tree.webp
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+15.6 KB
leetcode/images/check-if-a-word-occurs-as-a-prefix-of-any-word-in-a-sentence.webp
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+16.1 KB
leetcode/images/check-if-all-characters-have-equal-number-of-occurrences.webp
Binary file not shown.
Binary file added
BIN
+15.2 KB
leetcode/images/check-if-all-the-integers-in-a-range-are-covered.webp
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+15.7 KB
leetcode/images/check-if-an-original-string-exists-given-two-encoded-strings.webp
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+16.3 KB
leetcode/images/check-if-binary-string-has-at-most-one-segment-of-ones.webp
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+15.5 KB
leetcode/images/check-if-every-row-and-column-contains-all-numbers.webp
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+15.8 KB
leetcode/images/check-if-number-has-equal-digit-count-and-digit-value.webp
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+15.8 KB
leetcode/images/check-if-string-is-decomposable-into-value-equal-substrings.webp
Binary file not shown.
Binary file added
BIN
+15.7 KB
leetcode/images/check-if-string-is-transformable-with-substring-sort-operations.webp
Binary file not shown.
Binary file added
BIN
+16.2 KB
leetcode/images/check-if-strings-can-be-made-equal-with-operations-i.webp
Binary file not shown.
Binary file added
BIN
+15.7 KB
leetcode/images/check-if-strings-can-be-made-equal-with-operations-ii.webp
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+15.1 KB
leetcode/images/check-if-there-is-a-path-with-equal-number-of-0s-and-1s.webp
Binary file not shown.
Binary file added
BIN
+15.3 KB
leetcode/images/check-if-there-is-a-valid-parentheses-string-path.webp
Binary file not shown.
Binary file added
BIN
+14.6 KB
leetcode/images/check-if-there-is-a-valid-partition-for-the-array.webp
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Oops, something went wrong.