Skip to content

Instantly share code, notes, and snippets.

View AmanAdastra's full-sized avatar

Aman Khan AmanAdastra

View GitHub Profile
"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();
# 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)
@AmanAdastra
AmanAdastra / script.py
Created October 5, 2022 06:31
How to list all country names with country code or dialing code in Python?
import phonenumbers
import pycountry
dct = {country.name: phonenumbers.country_code_for_region(country.alpha_2) for country in pycountry.countries}
print(dct)
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])