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
BASE62 = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" | |
def encode(num, alphabet=BASE62): | |
"""Encode a positive number in Base X | |
Arguments: | |
- `num`: The number to encode | |
- `alphabet`: The alphabet to use for encoding | |
""" | |
if num == 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
# package.json | |
{ | |
"devDependencies": { | |
"eslint-config-airbnb": "^17.1.0", | |
"eslint-config-prettier": "^5.0.0", | |
"eslint-plugin-import": "^2.17.3", | |
"eslint-plugin-react": "^7.14.1", | |
"husky": "^2.5.0", | |
"lint-staged": "^8.2.1", | |
"prettier": "^1.18.2", |
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 concurrent.futures | |
import json | |
import time | |
import requests | |
URLS = [ | |
"https://reqres.in/api/users", | |
"http://dummy.restapiexample.com/api/v1/employees", | |
# "https://jsonplaceholder.typicode.com/todos", | |
# "https://jsonplaceholder.typicode.com/posts", |
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 asyncio | |
import json | |
import time | |
import aiohttp | |
result = [] | |
async def download_site(session, url): |
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 concurrent.futures | |
import logging | |
import random | |
import threading | |
SENTINEL = object() | |
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
def get_nested_values_from_dict(data, attrs, index=0): | |
""" | |
get values from nested dictionary | |
Example: | |
>>> data = {"a": {"b": {"c": 3}} | |
>>> get_nested_values_from_dict(data, ["a", "b", "c"]) | |
>>> 3 | |
:param data: dict | |
:param attrs: list | |
:param index: int |
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 java.util.HashMap; | |
import java.util.Scanner; | |
public class QHEAP1 { | |
private static int count = 1; | |
private static MinimumHeap<Integer> root = null; | |
HashMap<Integer,Integer> h = new HashMap<>(); | |
public static void main(String args[]) { | |
long startTime = System.currentTimeMillis(); | |
Scanner sc = new Scanner(System.in); |
NewerOlder