Skip to content

Instantly share code, notes, and snippets.

View RichardSilveira's full-sized avatar
🚀

Richard Silveira RichardSilveira

🚀
View GitHub Profile
@RichardSilveira
RichardSilveira / ContextCmder-Disable.reg
Created April 6, 2021 22:09 — forked from jojobyte/ContextCmder-Disable.reg
Cmder Context (Right-Click) Menu for Windows 7, 8 & 10
Windows Registry Editor Version 5.00
[-HKEY_CLASSES_ROOT\Directory\Background\shell\Cmder]
[-HKEY_CLASSES_ROOT\Directory\shell\Cmder]
@RichardSilveira
RichardSilveira / WarnUpFunctionCloudFormationResource.yml
Created November 14, 2020 12:19
Event Rule to warn up a lambda function
WarnUpFunctionXXX:
Type: "AWS::Events::Rule"
Properties:
ScheduleExpression: cron(0/10 10-01 * * ? *)
Name: WarnUpFunctionXXX
State: ENABLED
RoleArn: arn:aws:iam::644846694994:role/my-role
Targets:
- Arn: !GetAtt XXXLambdaFunction.Arn
Id: "TargetWarnFunctionXXX"
SELECT
truck_id,
fleet,
fuel_capacity,
model,
load_capacity,
make,
measure_name
FROM "sampleDB".IoT
GROUP BY truck_id, fleet, fuel_capacity, model, load_capacity, make, measure_name
exports.mys3UpdaloadEventhandler = async (event, context) => {
console.log('event', event);
console.log('context', context);
const bucket = event.Records[0].s3.bucket.name;
console.log('bucket', bucket);
const key = decodeURIComponent(event.Records[0].s3.object.key.replace(/\+/g, ' '));
try {
@RichardSilveira
RichardSilveira / hyperlinkresponse.sample.json
Created September 23, 2020 17:48
Sample response from a random RESTful API with hyperlink
{
"departmentId": 10,
"departmentName": "Administration",
"locationId": 1700,
"managerId": 200,
"links": [
{
"href": "10/employees",
"rel": "employees",
"type" : "GET"
@RichardSilveira
RichardSilveira / mariabdbserver-dev.cfn.yaml
Created August 21, 2020 20:32
Easy way to deploy a MariaDB Server based on AWS Marketplace AMI "MariaDB Server 10.3 on AmazonLinux" for DEVELOPMENT ONLY
AWSTemplateFormatVersion: 2010-09-09
Description: |
Deploy a MariaDB Server based on AWS Marketplace AMI "MariaDB Server 10.3 on AmazonLinux" for DEVELOPMENT ONLY
Parameters:
ServerKeyPair:
Type: AWS::EC2::KeyPair::KeyName
Description: Your Amazon EC2 Key Pair.
VPCId:
Type: AWS::EC2::VPC::Id
SELECT day_of_week(from_iso8601_timestamp(dt)) AS
day,
dt,
interfaceid,
sourceaddress,
destinationport,
action,
protocol
FROM vpc_flow_logs
WHERE action = 'REJECT' AND protocol = 6
ALTER TABLE default.vpc_flow_logs
ADD PARTITION (dt='{Year}-{Month}-{Day}')
location 's3://<vpc-flow-logs-bucket>/AWSLogs/<account_id>/vpcflowlogs/<region>/<Year>/<Month>/<Day>';
CREATE EXTERNAL TABLE IF NOT EXISTS default.vpc_flow_logs (
version int,
account string,
interfaceid string,
sourceaddress string,
destinationaddress string,
sourceport int,
destinationport int,
protocol int,
numpackets int,
@RichardSilveira
RichardSilveira / DeliverVPCFlowLogsPolicy.json
Last active July 2, 2020 10:26
Policy to be attached to a DeliverVPCFlowLogsRole with a Trusted relationship with "vpc-flow-logs.amazonaws.com"
{
"Version": "2012-10-17",
"Statement": [
{
"Action": [
"ec2:DeleteFlowLogs",
"ec2:CreateFlowLogs",
"ec2:DescribeFlowLogs",
"logs:CreateLogGroup",
"logs:CreateLogStream",