Skip to content

Instantly share code, notes, and snippets.

View ljmocic's full-sized avatar

Ljubiša Moćić ljmocic

View GitHub Profile
import json
import boto3
BUCKET = 'your-bucket-name'
KEY = 'your-file-key'
s3 = boto3.resource('s3')
file_object = s3.Object(BUCKET, KEY)
json_content = json.loads(file_object.get()['Body'].read())
# Read more about it
# https://ljmocic.medium.com/publish-simple-node-js-aws-lambda-layer-a87c00afdd83
mkdir nodejs
cd nodejs
npm i axios
rm -rf package-lock.json
cd ..
zip -r axios.zip nodejs
import datetime
import csv
import boto3
from boto3.session import Session
MAX_DAYS_OLD = 15
# Checks if access key is older than predefined number of days
import boto3
import email
import json
from pprint import pprint
from base64 import b64decode
s3 = boto3.client('s3')
BUCKET_NAME = ''
def lambda_handler(event, context):
#!/bin/bash
# Run using: chmod a+x mac-setup.sh && ./mac-setup.sh
# Read more about it
# https://medium.com/@ljmocic/quickly-setup-development-environment-on-mac-91bbbd647011
# Request admin permissions
sudo -v
# Homebrew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# Read more about setting it up
# https://medium.com/@ljmocic/make-telegram-bot-for-notifying-about-new-rss-feed-items-4cfbcc37f4fd
from datetime import timedelta, datetime
from dateutil import parser
from pprint import pprint
from time import sleep
import requests
import feedparser
# Read more about setting it up
# https://medium.com/@ljmocic/deploying-react-application-to-aws-s3-using-github-actions-85addacaeace
on:
push:
tags:
- '*'
jobs:
build:
import os
import json
import boto3
dynamodb = boto3.resource('dynamodb')
table = dynamodb.Table(os.environ['DYNAMODB_TABLE'])
def detect_event(event):
# Read more about setting it up
# https://medium.com/@ljmocic/running-a-script-from-s3-on-ec2-with-7-lines-of-code-59806c07d300
import boto3
REGION = 'us-east-1'
AMI = 'ami-00b94673edfccb7ca'
INSTANCE_TYPE = 'm3.medium'
BUCKET = 'script-bucket'
# Read more about setting it up:
# https://medium.com/@ljmocic/send-an-email-using-python-and-gmail-4ebc980eae9b
import smtplib
from email.mime.text import MIMEText
EMAIL = ''
APP_PASSWORD = ''
RECEIVER = ''