Skip to content

Instantly share code, notes, and snippets.

View ani-abel's full-sized avatar

Abel Ani ani-abel

View GitHub Profile
@ani-abel
ani-abel / vps_pipeline.md
Last active October 10, 2025 12:26
This step-by-step snippet describes how to deploy a nestjs backend to a vps using containerization

NOTE: This document assumes the linux distro used is RHEL/CentOS

  1. Login to vps Command 1: ssh root@{{IP_ADDRESS}} Command 2: {{Password}}

  2. Install nodejs via terminal Command (Node version 22): curl -fsSL https://rpm.nodesource.com/setup_22.x | sudo bash -

  3. Install Docker via terminal

@ani-abel
ani-abel / upload-base64-to-s3.ts
Last active July 1, 2021 04:36
Functions converts a base64 into a stream and saves them to s3
export const uploadBase64StringToS3 = async (
dataURI,
contentType = 'image/png'
): Promise<string> => {
try {
const [, url] = dataURI.split(',');
const [, ext] = contentType.split('/');
const buffer = Buffer.from(url, 'base64');
const params = {
Key: `${process.env.AWS_KEY_NAME}/${uuidv4()}.${ext}`,
@ani-abel
ani-abel / hide-element.css
Created July 1, 2021 04:28
Hide html elements without removing them from the DOM. Helps with web accessibility
.hidden-visually {
position: absolute;
width: 1px;
height: 1px;
margin: -1px;
padding: 0;
border: 0;
overflow: hidden;
clip: rect(0 0 0 0);
}
@ani-abel
ani-abel / s3-permissions.json
Created July 1, 2021 04:26
Control how much data from s3 can be accessed publicly
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "StatementPrefixDeny",
"Effect": "Allow",
"Principal": {
"AWS": "*"
},
"Action": "s3:*",