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 profile(func): | |
from functools import wraps | |
@wraps(func) | |
def wrapper(*args, **kwargs): | |
from line_profiler import LineProfiler | |
prof = LineProfiler() | |
try: | |
return prof(func)(*args, **kwargs) | |
finally: |
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
profiler = cProfile.Profile() | |
profiler.enable() | |
main() | |
profiler.disable() | |
stats = pstats.Stats(profiler).sort_stats('tottime') | |
stats.print_stats() |
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 square_my_num(): | |
universe = np.arange(100000) | |
numbers = np.random.rand(100000) | |
filtered_nums=[] | |
for number in numbers: | |
if number in universe: | |
filtered_nums.append(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
#include <stdio.h> | |
#include <time.h> | |
#define INTERVALS 10000000 | |
double a[INTERVALS], b[INTERVALS]; | |
int main(int argc, char **argv) | |
{ | |
double time2; |
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
/* COPYING: | |
* Dave Patterson at UCB modified this code from a program by Andrea | |
* Dusseau of U.C. Berkeley,which was based on a description in | |
* Saavedra-Barrera [1992]: | |
* Saavedra-Barrera, R. H. [1992]. CPU Performance Evaluation and | |
* Execution Time Prediction Using Narrow Spectrum Benchmarking, | |
* Ph.D. Dissertation, University of Calif., Berkeley (May). | |
* Patterson has given permission to use and modify this code as long | |
* as these people and the U. of Cal., Berkeley get proper credit. | |
*/ |
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 json | |
from constructs import Construct | |
from aws_cdk import ( | |
Stack, | |
aws_ecs as ecs, | |
aws_ecs_patterns, | |
aws_rds as rds, | |
aws_ec2 as ec2, | |
aws_secretsmanager as secretsmanager | |
) |
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 aws_cdk as cdk | |
import os | |
from ecs.ecs_stack import EcsStack | |
app = cdk.App() | |
EcsStack(app, "ecs", env={"region": "eu-central-1", "account": os.environ['CDK_DEFAULT_ACCOUNT']}) | |
app.synth() |
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
services: | |
server: | |
build: . | |
command: uvicorn main:app --reload --host 0.0.0.0 | |
volumes: | |
- .:/app | |
ports: | |
- 8000:8000 | |
environment: |
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
# Dockerfile | |
# pull the official docker image | |
FROM python:3.9 | |
# set work directory | |
WORKDIR /app | |
# install dependencies |
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 pydantic import BaseModel | |
class Book(BaseModel): | |
name: str | |
author: str | |
class Config: | |
orm_mode = True |
NewerOlder