In order to keep filters up to date, please use this repo.
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
#include <Python.h> | |
typedef struct { | |
PyObject_HEAD char *arr; | |
int len; | |
} ArrayCuckoo; | |
static int ArrayCuckoo_init(ArrayCuckoo *self, PyObject *args, PyObject *kwds) { | |
self->len = 2; | |
self->arr = (char *)malloc(self->len * sizeof(char)); |
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
#!/bin/bash | |
source /home/project/myenv/bin/activate | |
cd /home/project/server | |
PID=$(ps aux | grep 'uvicorn myapp:app' | grep -v grep | awk {'print $2'} | xargs) | |
if [ "$PID" != "" ] | |
then | |
kill -9 $PID | |
sleep 2 | |
echo "" > nohup.out | |
echo "Restarting FastAPI server" |
https://www.amazon.in/s?k=books&s=price-asc-rank # low to high
https://www.amazon.in/s?k=books&s=price-desc-rank # high to low
https://www.amazon.in/s?k=books&s=relevanceblender # featured
https://www.amazon.in/s?k=books&s=review-rank # Average customer review
https://www.amazon.in/s?k=books&s=date-desc-rank # Newest Arrival
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 _add_log_level_upper(logger, method_name, event_dict): | |
if method_name == "warn": | |
method_name = "warning" | |
event_dict["level"] = method_name.upper() | |
return event_dict | |
level_styles = structlog.dev.ConsoleRenderer.get_default_level_styles() | |
for k, v in list(level_styles.items()): | |
level_styles[k.upper()] = v |
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 inspect | |
from typing import Any, Callable, List, Type, TypeVar, Union, get_type_hints | |
from fastapi import APIRouter, Depends | |
from pydantic.typing import is_classvar | |
from starlette.routing import Route, WebSocketRoute | |
T = TypeVar("T") | |
CBV_CLASS_KEY = "__cbv_class__" |
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
#!/usr/bin/env python3 | |
# Demonstrates the use of Python to work with Cognito. | |
# Create a new a user, log in, check tokens and call an API. | |
# The purpose was to learn about Cognito. Security has been | |
# circumvented in the interest of keeping it simple. | |
# Notably, the authentication procedure uses the most insecure | |
# method. This code is not intended for use in production. | |
# | |
# https://www.neant.ro/aws/working-with-cognito-and-api-gateway-in-python.html |
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 typing import Iterator | |
def fib(n: int) -> Iterator[int]: | |
a, b = 0, 1 | |
while a < n: | |
yield a | |
a, b = b, a + b |
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
#!/usr/bin/python3.7 | |
import asyncio | |
import ipaddress | |
import re | |
import sys | |
MAX_NUMBER_WORKERS = 200 |
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 | |
from pathlib import Path | |
from typing import Optional | |
from watchdog.events import FileSystemEvent, FileSystemEventHandler | |
from watchdog.observers import Observer | |
class _EventHandler(FileSystemEventHandler): | |
def __init__(self, queue: asyncio.Queue, loop: asyncio.BaseEventLoop, |
NewerOlder