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
| # If you come from bash you might have to change your $PATH. | |
| # export PATH=$HOME/bin:$HOME/.local/bin:/usr/local/bin:$PATH | |
| # Path to your Oh My Zsh installation. | |
| export ZSH="$HOME/.oh-my-zsh" | |
| # Set name of the theme to load --- if set to "random", it will | |
| # load a random theme each time Oh My Zsh is loaded, in which case, | |
| # to know which specific one was loaded, run: echo $RANDOM_THEME | |
| # See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes |
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
| sudo apt-get --purge remove "*cublas*" "cuda*" "nsight*" | |
| sudo apt-get --purge remove "*nvidia*" | |
| sudo rm -rf /usr/local/cuda* | |
| sudo apt-get purge nvidia* | |
| sudo apt-get autoremove | |
| sudo apt-get autoclean | |
| sudo rm -rf /usr/local/cuda* | |
| # Installing the driver | |
| sudo apt install libnvidia-common-535 |
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
| repos: | |
| - repo: https://github.com/avilaton/add-msg-issue-prefix-hook | |
| rev: v0.0.11 | |
| hooks: | |
| - id: add-msg-issue-prefix | |
| - repo: https://github.com/astral-sh/ruff-pre-commit | |
| rev: v0.2.2 | |
| hooks: | |
| - id: ruff | |
| args: [--fix, --output-format=full, --show-fixes, --select, I001, --select, F401] |
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 update_lambda(function_name): | |
| response = lambda_client.update_function_code( | |
| FunctionName=function_name, | |
| ZipFile=open(f'{function_name}.zip', 'rb').read() | |
| ) |
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 lambda_function_exist(function_name): | |
| try: | |
| lambda_client.get_function(FunctionName=function_name) | |
| return True | |
| except lambda_client.exceptions.ResourceNotFoundException: | |
| return False |
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 create_zip(function_name): | |
| with zipfile.ZipFile(f'{function_name}.zip', 'w') as zf: | |
| zf.write(f'{function_name}.py') |
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
| lambda_client = boto3.client('lambda') |
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
| parser = argparse.ArgumentParser() | |
| parser.add_argument('--function_name', type=str, required=True) | |
| parser.add_argument('--handler_name', type=str, required=True) | |
| parser.add_argument('--role', type=str, required=True) | |
| args = parser.parse_args() | |
| function_name = args.function_name | |
| handler_name = args.handler_name | |
| role = args.role |
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 loguru import logger | |
| import boto3 | |
| import zipfile | |
| import argparse |
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 response(event, context): | |
| response = { | |
| "statusCode": 200, | |
| "body": None | |
| } | |
| if event["message"] == "ping": | |
| response["body"] = "pong" | |
| else: | |
| response["body"] = "Unknown message" | |
| return response |
NewerOlder