Skip to content

Instantly share code, notes, and snippets.

import { randomBytes } from "crypto";
import { DynamoDBClient } from "@aws-sdk/client-dynamodb";
import { PutCommand, DynamoDBDocumentClient } from "@aws-sdk/lib-dynamodb";
const client = new DynamoDBClient({ region: 'us-east-1' }); // Update with your desired region
const docClient = DynamoDBDocumentClient.from(client);
const fleet = [
{
@sherlockholmes
sherlockholmes / CloudWatchAgent.sh
Last active February 18, 2021 16:52
Instalacion Manual Agente de CloudWatch Paso a Paso
Descarga el paquete de instalacion
wget https://s3.amazonaws.com/amazoncloudwatch-agent/amazon_linux/amd64/latest/amazon-cloudwatch-agent.rpm
Instala la llave
wget https://s3.amazonaws.com/amazoncloudwatch-agent/assets/amazon-cloudwatch-agent.gpg
gpg --import amazon-cloudwatch-agent.gpg # obten el <key-value>
gpg --fingerprint <key-value> # obten el fingerprint
Descarga la firma y verifica el paquete
from __future__ import print_function # Python 2/3 compatibility
import os, boto3, json
client = boto3.client('comprehend')
def lambda_handler(event, context):
sentiment=client.detect_sentiment(Text=event['inputTranscript'],LanguageCode='en')['Sentiment']
sentimentscore=client.detect_sentiment(Text=event['inputTranscript'],LanguageCode='en')['SentimentScore']
comment=event['inputTranscript']
customeremail=event['customeremail']
@sherlockholmes
sherlockholmes / mipolitica.json
Created November 4, 2016 15:03
IAM Roles to Enable Actions in Bucket
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:GetBucketLocation",
"s3:ListAllMyBuckets"
],
"Resource": "arn:aws:s3:::*"
@sherlockholmes
sherlockholmes / Vagrantfile
Created April 13, 2016 19:12
Vagrantfile for Ansible Workshop PUCP
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure(2) do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
➜ ~ cat become.yml
---
- hosts: localhost
user: vagrant
tasks:
- shell: whoami
register: result
- debug: var=result.stdout
@sherlockholmes
sherlockholmes / error.sh
Created December 15, 2015 23:34
Error compiling openssl on Solaris 11.2 Sparc
stderr: e_des.c: In function 'des_init_key':
e_des.c:239:29: warning: assignment from incompatible pointer type [enabled by default]
dat->stream.cbc = enc ? des_t4_cbc_encrypt : des_t4_cbc_decrypt;
^
e_des3.c: In function 'des_ede_init_key':
e_des3.c:284:29: warning: assignment from incompatible pointer type [enabled by default]
dat->stream.cbc = enc ? des_t4_ede3_cbc_encrypt :
^
e_des3.c: In function 'des_ede3_init_key':
e_des3.c:334:29: warning: assignment from incompatible pointer type [enabled by default]
@sherlockholmes
sherlockholmes / find_student_data_and_delete_min.py
Created October 23, 2015 19:02
HOMEWORK 2 - WEEK 2 - M101P
import pymongo
import datetime
import sys
# establish a connection to the database
connection = pymongo.MongoClient("mongodb://localhost")
def find_student_data_and_delete_min(student_id):
# get a handle to the school database
db=connection.students
asasasasasa
@sherlockholmes
sherlockholmes / gist:dc211b2029d73bdeda4a
Last active August 29, 2015 14:02
M202 Week 6 Video List
M202 Week 6 Video List
https://www.youtube.com/watch?v=IXwHDQ0zk9o
https://www.youtube.com/watch?v=5G8Axr7xQ_Y
https://www.youtube.com/watch?v=VZ5zI3Czl3A
https://www.youtube.com/watch?v=5gP_TXspM5I
https://www.youtube.com/watch?v=_ZovfTLkSZU
https://www.youtube.com/watch?v=YEh3lZUs7Cw
https://www.youtube.com/watch?v=4fvN1Uzpn88
https://www.youtube.com/watch?v=o14ssqlYxaQ