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
import pygame | |
import random | |
# Initialize Pygame | |
pygame.init() | |
# Set up the screen | |
screen_width = 800 | |
screen_height = 600 | |
screen = pygame.display.set_mode((screen_width, screen_height)) |
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
from flask import Flask, request, jsonify | |
import requests | |
from urllib.parse import urlparse | |
app = Flask(__name__) | |
def get_highest_quality_images(images_data): | |
quality_priority = ['2048', '638', '320'] | |
all_slides = images_data.get('all_slides', []) | |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
import turtle | |
from math import pi, sin, cos | |
def draw_heart(w, h, iteration=0): | |
if iteration >= len(colors): | |
return | |
t = turtle.Turtle() | |
t.hideturtle() | |
t.pensize(2.5) |
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
import time | |
import os | |
try: | |
import requests | |
from bs4 import BeautifulSoup | |
except (ModuleNotFoundError): | |
os.system('pip install requests beautifulsoup4 --no-cache-dir') | |
finally: | |
import requests | |
from bs4 import BeautifulSoup |
This file has been truncated, but you can view the full file.
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
[ | |
{ | |
"number": 1, | |
"ayahCount": 7, | |
"sequence": 5, | |
"asma": { "ar": { "short": "\u0627\u0644\u0641\u0627\u062a\u062d\u0629", "long": "\u0633\u064f\u0648\u0631\u064e\u0629\u064f\u0020\u0671\u0644\u0652\u0641\u064e\u0627\u062a\u0650\u062d\u064e\u0629\u0650" }, "en": { "short": "Al-Faatiha", "long": "Sura Al-Faatiha" }, "id": { "short": "Al-Fatihah", "long": "Surah Al-Fatihah" }, "translation": { "en": "The Opening", "id": "Pembukaan" } }, | |
"preBismillah": null, | |
"type": { "ar": "\u0645\u0643\u0629", "id": "Makkiyyah", "en": "Meccan" }, | |
"tafsir": { "id": "Surat Al Faatihah (Pembukaan) yang diturunkan di Mekah dan terdiri dari 7 ayat adalah surat yang pertama-tama diturunkan dengan lengkap diantara surat-surat yang ada dalam Al Quran dan termasuk golongan surat Makkiyyah. Surat ini disebut Al Faatihah (Pembukaan), karena dengan surat inilah dibuka dan dimulainya Al Quran. Dinamakan Ummul Quran (induk Al Quran) atau Ummul Kitaab (induk Al Kitaab) karena dia merupakan induk dari semua isi A |
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
import fetch from 'node-fetch'; | |
fetch('https://quickcount.kumparan.com/v1/election-result', { | |
method: 'GET', | |
headers: { | |
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:122.0) Gecko/20100101 Firefox/122.0', | |
'Accept': 'application/json, text/plain, */*' | |
} | |
}) | |
.then(response => response.json()) |
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
from sys import platform | |
import os | |
import sys | |
import subprocess | |
def is_pip_installed(): | |
try: | |
subprocess.run([sys.executable, "-m", "pip", "--version"], | |
stdout=subprocess.PIPE, stderr=subprocess.PIPE, check=True) |
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
from flask import Flask, request, jsonify | |
import requests | |
from requests.exceptions import RequestException | |
import time | |
app = Flask(__name__) | |
def normalize_url(url): | |
# Add 'http://' if no scheme is present | |
if not url.startswith(('http://', 'https://')): |
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
import re | |
import requests | |
import tkinter as tk | |
from tkinter import messagebox | |
import webbrowser | |
def get_video_id(url): | |
pattern = re.compile(r'(?:youtube\.com\/(?:[^\/\n\s]+\/\S+\/|(?:v|e(?:mbed)?)\/|\S*?[?&]v=|shorts\/)|youtu\.be\/)([a-zA-Z0-9_-]{11})') | |
match = pattern.search(url) | |
return match.group(1) if match else None |