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
"use client"; | |
import { message, Upload, Modal } from "antd"; | |
import { useSession } from "next-auth/react"; | |
import { UploadAdminProfilePicture } from "@/static/ApiEndpoints"; | |
import { useEffect, useState } from "react"; | |
import ImgCrop from "antd-img-crop"; | |
const getBase64 = (file) => | |
new Promise((resolve, reject) => { | |
const reader = new FileReader(); |
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
# Basically for latest 24 Hour change percentage what i did is to get the current metrics and get the yesterday metric for the same time | |
# and then manually calculated the percentage. | |
client = CoinMetricsClient(api_key=api_key) | |
def get_coin_info(coin_ids): | |
data = list(client.catalog_assets(exclude=["exchanges","markets","metrics"],assets=coin_ids)) | |
data_today = client.get_asset_metrics(coin_ids,metrics="ReferenceRateUSD",frequency="1m",page_size=10,limit_per_asset=1,paging_from="end",end_time=datetime.utcnow(),end_inclusive=True) | |
yesterday = datetime.utcnow() - timedelta(days=1) |
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 phonenumbers | |
import pycountry | |
dct = {country.name: phonenumbers.country_code_for_region(country.alpha_2) for country in pycountry.countries} | |
print(dct) |
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
def fib(n): | |
I = [[1, 1], [1, 0]] | |
if (n == 0): return 0 | |
power(I, n - 1) | |
return I[0][0] | |
def multiply(I, A): | |
x = (I[0][0] * A[0][0] + I[0][1] * A[1][0]) | |
y = (I[0][0] * A[0][1] + I[0][1] * A[1][1]) | |
z = (I[1][0] * A[0][0] + I[1][1] * A[1][0]) | |
w = (I[1][0] * A[0][1] + I[1][1] * A[1][1]) |