Skip to content

Instantly share code, notes, and snippets.

View hugomota's full-sized avatar

Hugo Mota hugomota

View GitHub Profile
@hugomota
hugomota / generate-component.sh
Created February 3, 2023 11:52
It generates a base scaffold for a component in ts
#!/bin/bash
# Check if the component name argument was passed
if [ -z "$1" ]; then
echo "Error: Component name argument is required."
exit 1
fi
if [ ! -d "./components" ]; then
mkdir ./components
@hugomota
hugomota / edgeLambdaRole.json
Last active July 28, 2022 17:16
IAM > Roles > lambda-function-name-role
{
"Version":"2012-10-17",
"Statement":[
{
"Effect":"Allow",
"Principal":{
"Service":[
"edgelambda.amazonaws.com",
"lambda.amazonaws.com"
]
{
"Version":"2008-10-17",
"Statement":[
{
"Sid":"PublicReadGetObject",
"Effect":"Deny",
"Principal":"*",
"Action":[
"s3:GetObject",
"s3:PutObject"
'use strict';
exports.handler = (event, context, callback) => {
// Get request and request headers
const request = event.Records[0].cf.request;
const headers = request.headers;
// Configure authentication
const authUser = 'user';
const authPass = 'PassWord!';
// Construct the Basic Auth string
const authString = 'Basic ' + new Buffer(authUser + ':' + authPass).toString('base64');
@hugomota
hugomota / postmanAuthenticationPreRequest.js
Created July 24, 2020 14:48
CX Authentication sample as pre-request script on postman (urlencoded)
const echoPostRequest = {
url: pm.collectionVariables.get("authUrl"),
method: "POST",
header: {
"content-type": "application/x-www-form-urlencoded",
},
body: {
mode: "urlencoded",
urlencoded: [
{
// import the hook
import React, { useContext } from "react";
//Import the Context
import { UsersContext } from "./context";
// get the current value in UsersContext through the hook
const usersContext = useContext(UsersContext);
const { users, selectedUser, setSelectedUser } = usersContext;
@hugomota
hugomota / self-signed-certificate-with-custom-ca.md
Created February 17, 2020 00:51 — forked from fntlnz/self-signed-certificate-with-custom-ca.md
Self Signed Certificate with Custom Root CA

Create Root CA (Done once)

Create Root Key

Attention: this is the key used to sign the certificate requests, anyone holding this can sign certificates on your behalf. So keep it in a safe place!

openssl genrsa -des3 -out rootCA.key 4096