This file contains hidden or 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 PIL import Image | |
img = Image.open("pic.png") | |
img = img.convert("RGBA") | |
pixel_data = img.load() | |
width, height = img.size | |
for y in range(height): | |
for x in range(width): |
This file contains hidden or 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 googletrans | |
text = input("Enter a sentence: ").lower() | |
dest = input("Enter a destination language: ").lower() | |
translator = googletrans.Translator() | |
language_map = dict((v.lower(), k) for k, v in googletrans.LANGUAGES.items()) | |
translated_text = translator.translate(text, dest=language_map[dest]) | |
print(translated_text.text) |
This file contains hidden or 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 cv2 | |
import face_recognition | |
import base64 | |
import io | |
import os | |
import numpy as np | |
from imageio import imread | |
def get_face_encoding(image): | |
face_encoding = face_recognition.face_encodings(image)[0] |
This file contains hidden or 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 base64 | |
from cryptography.hazmat.backends import default_backend | |
from cryptography.hazmat.primitives import hashes | |
from cryptography.hazmat.primitives.kdf.pbkdf2 import PBKDF2HMAC | |
from cryptography.fernet import Fernet | |
def encrypt_text(text, salt): | |
def generate_key(master, salt): | |
kdf = PBKDF2HMAC( | |
algorithm=hashes.SHA512(), |
This file contains hidden or 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 paystackapi.paystack import Paystack | |
from paystackapi.trecipient import TransferRecipient | |
from paystackapi.tcontrol import TransferControl | |
from paystackapi.verification import Verification | |
from paystackapi.transfer import Transfer | |
paystack_secret_key = "" | |
paystack = Paystack(secret_key=paystack_secret_key) | |
This file contains hidden or 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 tronapi import Tron | |
full_node = "https://api.trongrid.io" | |
solidity_node = "https://api.trongrid.io" | |
event_server = "https://api.trongrid.io" | |
tron = Tron(full_node=full_node, solidity_node=solidity_node, | |
event_server=event_server) | |
tron.private_key = "SECRET KEY" | |
tron.default_address = tron.address.from_private_key(tron.private_key).base58 |
This file contains hidden or 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 random | |
import smtplib | |
import ssl | |
from email.mime.text import MIMEText | |
from email.mime.multipart import MIMEMultipart | |
host = "" | |
port = 465 | |
sender = "" |
This file contains hidden or 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
{ | |
"9 payment service Bank": "120001", | |
"AB MICROFINANCE BANK": "090270", | |
"ABBEY MORTGAGE BANK": "070010", | |
"ABOVE ONLY MICROFINANCE BANK": "090260", | |
"ABU MICROFINANCE BANK": "090197", | |
"ACCESS BANK": "000014", | |
"ACCESSMONEY": "100013", | |
"ACCION MFB": "090134", | |
"ADDOSSER MFBB": "090160", |
This file contains hidden or 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 requests | |
from bs4 import BeautifulSoup | |
def get_quotes(tag, page): | |
quotes = [] | |
r = requests.get(f"http://quotes.toscrape.com/tag/{tag}/page/{page}/") | |
if r.status_code == 200: | |
quotes_page = BeautifulSoup(r.text, "html.parser") |
This file contains hidden or 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 faunadb import query as q | |
from faunadb.objects import Ref | |
from faunadb.client import FaunaClient | |
from faunadb.errors import BadRequest, Unauthorized | |
client = FaunaClient(secret="YOUR-SECRET-HERE") | |
def create_user(email, password): | |
result = False |
OlderNewer