Skip to content

Instantly share code, notes, and snippets.

View yogeshnile's full-sized avatar
:octocat:
I ❤️ Python

YOGESH NILE yogeshnile

:octocat:
I ❤️ Python
View GitHub Profile
#!/bin/bash
sudo tee /etc/apt/sources.list.d/pritunl.list << EOF
deb http://repo.pritunl.com/stable/apt focal main
EOF
# Import signing key from keyserver
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com --recv 7568D9BB55FF9E5287D586017AE645C0CF8E292A
# Alternative import from download if keyserver offline
curl https://raw.githubusercontent.com/pritunl/pgp/master/pritunl_repo_pub.asc | sudo apt-key add -
import signal
import boto3
import os
def lambda_handler(event, context):
signal.alarm(int(context.get_remaining_time_in_millis() / 1000) - 1)
signal.signal(signal.SIGALRM, timeout_handler)
# Do other stuff
while True:
import json
import os
def lambda_handler(event, context):
FILE_NAME = '/mnt/lambda/test2.txt'
with open(FILE_NAME, "w") as F:
F.write("Hello from lambda")
os.system("ls -alth /mnt/lambda/")
# Sysntax
# comments
command argument argument1…
# Example
Run echo "print from dockerfile"
@yogeshnile
yogeshnile / env.md
Last active September 30, 2021 03:21
Variable Name Description
_HANDLER The handler location configured on the function.
API Endpoint nameAPI Endpoint Deployment StageSecurity Role
Triggers Description Requirement
API Gateway Trigger AWS Lambda function over HTTPS
Settings | Limits
Description Settings | Limits | Explained Can be increased
{
"key1": "value1",
"key2": "value2",
"key3": "value3"
}
variable "aws_region" {
default = "us-east-1"
type = string
}
provider "aws" {
region = var.aws_region
}
#################################################
import json
import boto3
import requests
from datetime import datetime, timedelta
CLIENT = boto3.client('ce')
SLACK_WEBHOOK_URL = '' # Enter the slack webhook url.
def lambda_handler(event, context):