Skip to content

Instantly share code, notes, and snippets.

View oieduardorabelo's full-sized avatar

Eduardo Rabelo oieduardorabelo

View GitHub Profile
@oieduardorabelo
oieduardorabelo / .env.example
Created February 24, 2021 05:11
Sample of Cognito with Server-Sider Authentication
PORT=xxx
COGNITO_USER_POOL_ID=xxx
COGNITO_CLIENT_ID=xxx
COOKIE_SESSION_SECRET=xxx
COOKIE_SESSION_NAME=xxx
AWS_REGION=xxx
AWS_ACCESS_KEY_ID=xxx
AWS_SECRET_ACCESS_KEY=xxx
import type {
FirehoseTransformationHandler,
FirehoseTransformationResultRecord,
} from "aws-lambda";
function base64Encode(str: string): string {
return Buffer.from(str).toString("base64");
}
function base64Decode(str: string): string {
@oieduardorabelo
oieduardorabelo / installing-postgresql.md
Last active January 4, 2023 10:19
Installing PostgreSQL on Ubuntu with UTF-8 database template

Para instalar a versão mais atualizada do PostgreSQL, adicione o Apt Repository oficial:

echo 'deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main' | sudo tee /etc/apt/sources.list.d/pgdg.list

wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -

sudo apt-get update
@oieduardorabelo
oieduardorabelo / remove-twitter-interests.js
Created November 30, 2022 22:31
Remove all Twitter Interests matched to you based on your profile, activity, and the Topics you follow.
// https://mobile.twitter.com/settings/your_twitter_data/twitter_interests
$$('[checked=""]').forEach((x, index) => { setTimeout(() => { x.click(); }, ++index * 1000) });

DenyRootUserActions

It is generally a best practice not to use the root user to do your tasks in your AWS account. Instead, you should create an IAM admin user and use that to do administrative tasks.

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Condition": {
@oieduardorabelo
oieduardorabelo / readme.md
Created July 5, 2022 05:35
Remove folder or file from Git history with clean up

I already had committed the folder before and want to remove the directory in the history as well.

I did the following:

Add folder to .gitignore:

echo Folder_Name/ >> .gitignore

Remove from all commits:

@oieduardorabelo
oieduardorabelo / template-database.yaml
Created February 28, 2021 11:20
Network and Database Layers Teample
#
# Creates one RDS PostgreSQL instance and RDS Proxy
# with connections allowed in ports 443 and 5432
#
AWSTemplateFormatVersion: "2010-09-09"
Transform: AWS::Serverless-2016-10-31
Description: "Database Layer"
@oieduardorabelo
oieduardorabelo / react-redux.ts
Created December 19, 2018 13:07
Module mock in Jest using `react-redux/connect` as example
const connect = jest.fn((mapStateToProps) => {
const React = require.requireActual('react');
const { rootReducer } = require.requireActual('../domains/root.reducer');
const state = rootReducer({}, { type: '__jest-mock-react-redux__' });
const fromConnectProps = mapStateToProps(state);
return jest.fn(Component => {
function Wrapper(props: any) {
const finalProps = { ...props, ...fromConnectProps };
@oieduardorabelo
oieduardorabelo / acloudguru-filter.js
Created August 13, 2020 07:36
A Cloud Guru list filter
$$('[ng-if="vm.isCompleted"]').forEach(el => { el.parentNode.parentNode.parentNode.removeChild(el.parentNode.parentNode) })