Content :
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 api_backends.conf; | |
include api_keys.conf; | |
limit_req_zone $binary_remote_addr zone=client_ip_10rs:1m rate=1r/s; | |
limit_req_zone $http_apikey zone=apikey_200rs:1m rate=200r/s; | |
server { | |
access_log /var/log/nginx/api_access.log main; # Each API may also log to a | |
# separate file |
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 | |
set -e | |
# Pre-requisite: | |
# Generate your token at: https://github.com/settings/tokens/new?scopes=write:packages | |
# More info: https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry | |
export CR_PAT=<YOUR_TOKEN> | |
GITHUB_USERNAME=<your-github-account-name> | |
echo $CR_PAT | docker login ghcr.io -u $GITHUB_USERNAME --password-stdin |
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 node:lts-alpine as build | |
WORKDIR /app | |
COPY package*.json ./ | |
# Install dependencies | |
RUN npm ci --force | |
COPY . . |
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
# Official reference: https://swagger.io/specification/ | |
openapi: "3.0.0" # The version of the OpenAPI Specification being used | |
info: # Metadata about the API | |
version: "1.0.0" # Version of the API | |
title: "Sample API" # Name of the API | |
servers: # Base URL and other server information | |
- url: "http://api.example.com/v1" |
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 flask import Flask, render_template, request, redirect | |
app = Flask(__name__) | |
todos = [] | |
@app.route('/') | |
def index(): | |
return render_template('index.html', todos=todos) | |
@app.route('/add', methods=['POST']) |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
<title>Native HTML PDF Preview</title> | |
</head> | |
<body> | |
<div style="display: block; height: 900px; background-color: aqua;"> | |
<object |
When working on different operating systems, managing line endings is crucial to ensure consistency and avoid issues in a collaborative development environment. Here are the recommendations for configuring Git to handle line endings on Windows, WSL2, and Ubuntu:
- Recommended Setting:
core.autocrlf true
- Command:
git config --global core.autocrlf true
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 | |
from azure.mgmt.containerinstance import ContainerInstanceManagementClient | |
from azure.identity import DefaultAzureCredential | |
def start_container_instance(resource_group_name, | |
container_group_name, | |
subscription_id): | |
print(f'Attempting to start {container_group_name=} in {resource_group_name=}') | |
# Authenticate with Azure |
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 torch | |
import torch.nn as nn | |
import torch.optim as optim | |
import torch.distributed as dist | |
import torch.multiprocessing as mp | |
from torch.utils.data import DataLoader | |
from torch.utils.data.distributed import DistributedSampler | |
# Define the sentiment analysis model | |
class SentimentAnalysisModel(nn.Module): |
NewerOlder