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 base64 | |
import hashlib | |
import hmac | |
import math | |
import time | |
def dynamic_truncation(raw_key: hmac.HMAC, length: int) -> str: | |
hex_digest: str = raw_key.hexdigest() | |
int_repr: int = int(hex_digest, base=16) |
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 {NextApiRequest, NextApiResponse} from "next"; | |
import {Photo} from '@prisma/client' | |
import Busboy from "busboy"; | |
import {PutObjectCommand, S3Client} from "@aws-sdk/client-s3"; | |
import crypto from "crypto"; | |
import {S3_BUCKET} from "../../constants"; | |
const client = new S3Client({}); | |
export async function storePhoto(ctx: { fileBuffer: Buffer, mimeType: string }) { |
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 {v4 as uuidV4} from 'uuid'; | |
import rs from "jsrsasign"; | |
const BASE_URL = 'https://aa-sandbox.setu.co' | |
class AccountAggregatorClient { | |
aa_id: string; | |
fiu_id: string; | |
client_api_key: string |
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
interface IOptions { | |
bucketSize: number, | |
failurePercent: number | |
canaryRequestInMilliSeconds: number | |
minRecordings: number | |
} | |
interface IEvent { | |
success: boolean | |
createdAt: number |
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 asyncio | |
from abc import ABC | |
from enum import Enum | |
from typing import Optional | |
from odmantic import AIOEngine | |
from odmantic import Model | |
from odmantic.query import SortExpression | |
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
#!/usr/bin/env python3 | |
import csv | |
import datetime | |
import json | |
import logging | |
import os.path | |
import sqlite3 | |
import sys | |
from enum import Enum | |
from sqlite3 import Connection, Cursor |
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
{ | |
"work": { | |
"provider_id": 42799938, | |
"title": "The Boy Who Could Change the World", | |
"authors": [ | |
{ | |
"name": "Aaron Swartz", | |
"provider_author_id": 6893150 | |
} | |
], |
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 typing import List, Union | |
from internetarchive import configure, get_session | |
from olclient.openlibrary import OpenLibrary | |
from models import IsbnData | |
from models import EditionMetadata | |
class IsbnNotFoundInOl(Exception): |
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
#!/usr/bin/env python | |
import argparse | |
def detect_text(path): | |
"""Detects text in the file.""" | |
from google.cloud import vision | |
import io | |
client = vision.ImageAnnotatorClient() |
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
#!/bin/bash | |
# Thanks @glutanimate ! | |
SP_DEST="org.mpris.MediaPlayer2.spotify" | |
SP_PATH="/org/mpris/MediaPlayer2" | |
SP_MEMB="org.mpris.MediaPlayer2.Player" | |
LyricsAPI="http://makeitpersonal.co/lyrics/" |