Skip to content

Instantly share code, notes, and snippets.

@nktstudios
nktstudios / lambda_function.py
Created September 21, 2023 13:37
AWS Lambda Function demonstrating packages
import json
import pandas as pd
import numpy as np
import requests
def lambda_handler(event, context):
pandas_version = pd.__version__
numpy_version = np.__version__
@nktstudios
nktstudios / lambda_handler.py
Created March 14, 2022 23:07
AWS s3 Put Event Lambda Code
import json
import boto3
def lambda_handler(event, context):
#1 create an s3 client object
s3 = boto3.client("s3")
#2 counters for the calculations
addition_count = 0
multiplication_count = 0
@nktstudios
nktstudios / operations.json
Created March 14, 2022 23:04
Operations Json File
{
"calculations": [
{
"operation": "ADDITION",
"first_num": 1,
"second_num": 2
},
{
"operation": "MULTIPLICATION",
"first_num": 3,
@nktstudios
nktstudios / AWS Lambda Function to Send Email
Created September 21, 2021 14:21
AWS Lambda Function to Send Email
import json
import boto3
def lambda_handler(event, context):
ses = boto3.client('ses')
body = """
Hello and welcome to the SES Lambda Python Demo.
@nktstudios
nktstudios / Amazon SES IAM Policy
Created September 21, 2021 14:20
Amazon SES IAM Policy
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"ses:SendEmail",
"ses:SendRawEmail"
],
"Resource": "*"
@nktstudios
nktstudios / Lambda Python Code
Created August 11, 2020 20:24
Start Stop EC2
import json
import boto3
region = 'us-east-2'
ec2 = boto3.client('ec2', region_name=region)
def lambda_handler(event, context):
instances = event["instances"].split(',')
action = event["action"]
@nktstudios
nktstudios / SublimeREPL Python Shortcut
Created June 4, 2020 17:12
SublimeREPL Python Shortcut
[
{
"keys": ["ctrl+alt+b"], "command": "run_existing_window_command", "args":
{
"id": "repl_python_run",
"file": "config/Python/Main.sublime-menu"
}
}
]
@nktstudios
nktstudios / Windows Subsystem (Ubuntu) Commands
Created May 21, 2020 11:01
Commands to build Python Wheels
1. ubuntu1804
2. sudo apt-get upgrade
3. python3 --version
4. sudo apt update
5. sudo apt-get upgrade
@nktstudios
nktstudios / lambda_function.py
Last active February 7, 2024 13:49
AWS Lambda Deployment Package in Python
import json
import pandas as pd
import numpy as np
import requests
def lambda_handler(event, context):
pandas_version = pd.__version__
numpy_version = np.__version__
{
"cmd": ["g++.exe", "-std=c++14", "-o", "$file_base_name", "$file", "&&", "start", "cmd", "/c", "$file_base_name & echo. & echo. & pause"],
"shell": true,
"selector": "source.c++"
}