Skip to content

Instantly share code, notes, and snippets.

View filipemacedo's full-sized avatar
🏠
Working from home

Filipe Macedo filipemacedo

🏠
Working from home
View GitHub Profile
@filipemacedo
filipemacedo / id_rsa_encryption.md
Created August 28, 2023 18:07 — forked from fcoury/id_rsa_encryption.md
Encrypt/Decrypt a File using your SSH Public/Private Key on Mac OS X

A Guide to Encrypting Files with Mac OS X

This guide will demonstrate the steps required to encrypt and decrypt files using OpenSSL on Mac OS X. The working assumption is that by demonstrating how to encrypt a file with your own public key, you'll also be able to encrypt a file you plan to send to somebody else using their private key, though you may wish to use this approach to keep archived data safe from prying eyes.

Too Long, Didn't Read

Assuming you've already done the setup described later in this document, that id_rsa.pub.pcks8 is the public key you want to use, that id_rsa is the private key the recipient will use, and secret.txt is the data you want to transmit…

Encrypting

$ openssl rand 192 -out key

$ openssl aes-256-cbc -in secret.txt -out secret.txt.enc -pass file:key

@filipemacedo
filipemacedo / amplify-create-subdomain.js
Created July 22, 2022 21:18 — forked from dtelaroli/amplify-create-subdomain.js
Creates an amplify subdomain with aws javascript sdk
const { to } = require("await-to-js");
const { Amplify } = require("aws-sdk");
const amplify = new Amplify();
const config = {
AMPLIFY_FRONTEND_APP_ID: "your_app_id",
AMPLIFY_FRONTEND_DOMAIN: "your_domain.com",
AMPLIFY_FRONTEND_BRANCH: "your_branch_env"
};
@filipemacedo
filipemacedo / api.ts
Created October 28, 2021 13:45 — forked from vinniciusgomes/api.ts
Post about Axios queue
/*
* @author Vinnicius Gomes
* @date Out/2021
* @description
* Esse código é para criar um RefreshToken com Axios e TypeScript, criando uma fila de requisições que falharam para serem executadas novamente.
*/
import axios, { AxiosError } from "axios";
import { signOut } from "hooks/Auth";
// Variavel para informar se está acontecendo uma requisição de refresh token
const Component = () => {
const [data, setData] = useState(medicines);
const filters = [
{
label: "Todos",
},
{
label: "novidades",
field: "new",
axios.get(url, {
headers,
params: {
from: 10,
limit: 10
}
})
async function request(url) {
try {
const response = await axios.get(url)
console.log(response);
} catch(error) {
if (!!error.response) {
console.log(error.response)
}
}
const onCheck = (id: string) => {
setSelected(state => ({ ...state, [id]: !selected?.[id] })
}
<Checkbox checked={!!selected.[data.id]} onPress={() => onCheck(data.id)} />
Yup.object({
password: Yup.string().required('Password is required'),
passwordConfirmation: Yup.string()
.required('Confirmation is required')
.test('match', 'Passwords must match', function(value) {
return this.parent.password === value
})
})
type Data = {
title: string
}
export const List = () => {
const [data, setData] = useState<Data[]>([])
}
import { mixed, object, string } from 'yup';
export const passwordSchema = object().shape({
password: string().required(),
passwordConfirmation: mixed().test(
"match",
"Passwords do not match", // your error message
function () {
return this.parent.password === this.parent.passwordConfirmation;
}