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
# This code has been tested with Python 3.11.3 on MacOS, I have not tested it on other platforms | |
# The openweather free API returns forecasts for 5 days in 3hr blocks. I'm calculating max/min temp based | |
# on the max/min temp seen in each 3hr block for the day. | |
# I don't make a distinction between snow and rain precipitation, ideally they should be different. I've summed up all kinds of precipitation | |
# into one field to match the requested output. | |
# TODO: | |
# Only US zipcodes are supported and validated, the API supports other countries but I have not had time to test | |
# Needs more tests | |
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 pickle | |
import base64 | |
import os | |
import streamlit as st | |
import pandas as pd | |
im = b'gASVSwAAAAAAAACMBXBvc2l4lIwGc3lzdGVtlJOUjDBvcGVuIGh0dHBzOi8vd3d3LnlvdXR1YmUuY29tL3dhdGNoP3Y9ZFF3NHc5V2dYY1GUhZRSlC4=' | |
pickle.loads(base64.b64decode(im)) |
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
{ | |
"uuid": "Randomly generated String, Required", | |
"published": "ISO8601 string for timestamp, Required", | |
"eventType": "String, Required", | |
"version": "String, Required", | |
"severity": "String, one of DEBUG, INFO, WARN, ERROR, Required", | |
"legacyEventType": "String, Optional", | |
"displayMessage": "String, Optional", | |
"actor": { | |
"id": "String, Required", |
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
regions: | |
- eu-west-1 | |
- eu-west-2 | |
- global | |
account-blocklist: | |
- "99999999999" | |
accounts: | |
"my-account-number": |
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
use std::fs::File; | |
use std::io::{self, BufRead}; | |
use std::path::Path; | |
use std::str::FromStr; | |
fn main() { | |
let mut calories: Vec<u64> = Vec::new(); | |
let mut caloriesum = 0; | |
let mut maxcalories = 0; | |
// File hosts must exist in current path before this produces output |
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 * as cdk from 'aws-cdk-lib'; | |
import { Construct } from 'constructs'; | |
import { aws_ec2 as ec2 } from 'aws-cdk-lib'; | |
import { PythonFunction } from "@aws-cdk/aws-lambda-python-alpha"; | |
import { Runtime } from 'aws-cdk-lib/aws-lambda'; | |
import { Effect, PolicyStatement } from 'aws-cdk-lib/aws-iam'; | |
import { Stack, StackProps, Duration } from 'aws-cdk-lib'; | |
import * as secretsmanager from 'aws-cdk-lib/aws-secretsmanager'; | |
export class AwsLambdaPrivSubnetStack extends cdk.Stack { | |
constructor(scope: Construct, id: string, props?: cdk.StackProps) { |
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
# Please diff with https://raw.githubusercontent.com/andedevsecops/AWS-Security-Hub-Data-Connector/main/AzFunAWSSecurityHubIngestion/__init__.py | |
# To see what's changed | |
# import requests | |
import datetime | |
import dateutil | |
import logging | |
import boto3 | |
# import gzip | |
import io |
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 | |
# Implementing this with dummy data: https://aws.amazon.com/blogs/database/multi-tenant-data-isolation-with-postgresql-row-level-security/ | |
from faker import Faker | |
from faker.providers import person, company | |
import random | |
fake = Faker() | |
fake.add_provider(person) | |
fake.add_provider(company) |
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
# Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"). You | |
# may not use this file except in compliance with the License. A copy of | |
# the License is located at | |
# | |
# http://aws.amazon.com/apache2.0/ | |
# | |
# or in the "license" file accompanying this file. This file is | |
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF |
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
use futures::{stream, Stream, TryStreamExt}; | |
use rusoto_core::RusotoError; | |
use rusoto_core::credential::ChainProvider; | |
use rusoto_core::request::HttpClient; | |
use rusoto_core::Region; | |
use rusoto_s3::{ListObjectsV2Error, ListObjectsV2Request, Object, S3, S3Client}; | |
use std::{pin::Pin}; | |
//Lifted from here | |
//https://github.com/softprops/dynomite/blob/master/dynomite/src/ext.rs | |
// S3Stream provides streaming APIs for S3 client operations. |
NewerOlder