This file contains 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 | |
import os | |
import requests | |
from fastapi import FastAPI | |
from typing import Optional | |
from pydantic import BaseModel | |
app = FastAPI() |
This file contains 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 | |
jq --slurp --raw-input --raw-output \ | |
'split("\n") | .[1:] | map(split(",")) | | |
map({"id": .[0], | |
"fname": .[1], | |
"lname": .[2], | |
"email": .[3], | |
"ipv4": .[5]})' \ | |
mock_data.csv > mock_data.json |
This file contains 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 | |
## -------------------------------------------------------------- | |
## OKAY - but simple | |
## The script has a proper shebang line and has been | |
## chmod to 755 so it can be executed. |
This file contains 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 | |
import io | |
import re | |
def convert(file_name): | |
# Open csv file | |
file_name="new_mock_data" | |
csv = io.open(file_name + ".csv", mode="w", encoding="utf-8") |
This file contains 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 | |
# How to run a bash command from within a python3 script. | |
## ----------------------------------------------------------- | |
## BAD | |
## This solution looks good but is a bad practice. as os.system | |
## and os.spawn are older and being replaced. This may not work |
This file contains 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 | |
import json | |
import boto3 | |
import datetime | |
sns = boto3.client('sns') | |
response = sns.publish( | |
TopicArn="arn:aws:sns:us-east-1:555566667777:simple-topic", |
This file contains 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> | |
<head> | |
<title>CS4740 - CloudFront+SNS+Lambda+SNS+Dynamo Application</title> | |
<script src="https://sdk.amazonaws.com/js/aws-sdk-2.780.0.min.js"></script> | |
<link href="https://getbootstrap.com/docs/4.5/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-TX8t27EcRE3e/ihU7zmQxVncDAy5uIKz4rEkgIXeMed4M0jlfIDPvg6uqKI2xXr2" crossorigin="anonymous"> | |
</head> | |
<body> | |
<script type="text/javascript"> |
This file contains 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 boto3 | |
ec2 = boto3.client('ec2') | |
response = ec2.describe_instances() | |
for r in response['Reservations']: | |
for i in r['Instances']: | |
print(i['InstanceId']) |
This file contains 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 | |
curl -O https://gist.githubusercontent.com/nmagee/5636d0355d48998f91502dd811a7401c/raw/6833433672715308fff57f86792d1246ba5fe677/apache2-bootstrap.sh | |
/bin/bash apache2-bootstrap.sh |
This file contains 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 | |
yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm | |
yum update -y | |
yum install -y httpd | |
systemctl start httpd | |
systemctl enable httpd |