Skip to content

Instantly share code, notes, and snippets.

@Maurifc
Maurifc / mongodb-create-user.js
Created August 1, 2023 12:33
Commands to create a MongoDB user
// Change database
use mydb
// Create user
db.createUser(
{
user: "john",
pwd: "123567",
roles:["readWrite"]
}
@Maurifc
Maurifc / ec2-apache.sh
Created July 26, 2023 22:40 — forked from herrera-ignacio/ec2-apache.sh
EC2 User data: install Apache web server for Amazon Linux 2 Image
#!/bin/bash
########################################
##### USE THIS WITH AMAZON LINUX 2 #####
########################################
# get admin privileges
sudo su
# install httpd (Linux 2 version)
@Maurifc
Maurifc / create_mongodb_user.js
Created May 29, 2023 13:43
Snippet for creating mongodb user
// Backup
db.createUser({
user: "bkp",
pwd: "PASSWORD-123",
roles: [
{ role: "readAnyDatabase", db: "admin" },
{ role: "backup", db: "admin" }
]
})
@Maurifc
Maurifc / sample.spec.js
Last active January 4, 2023 18:10
nodejs - Boiler plate of a test.js file (jest)
/* eslint-disable no-undef */
import { jest } from '@jest/globals'
// run before all tests (setup)
beforeAll(async () => {
// setup the test environment
// mock
})
// run before each test
@Maurifc
Maurifc / bash_for_in.sh
Last active October 17, 2022 13:49
'for in' structure for bash scripts
#!/usr/bin/env bash
list=(
atena-api,
atena-client
)
for i in ${list[@]};
do
helm upgrade --install $i . -n production -f values-usa-master.yaml
@Maurifc
Maurifc / helm-hook.yaml
Last active September 6, 2022 18:12
K8s - Boilerplate for a Helm hook job
# Annotation Value Description
#
# pre-install Executes after templates are rendered, but before any resources are created in Kubernetes
# post-install Executes after all resources are loaded into Kubernetes
# pre-delete Executes on a deletion request before any resources are deleted from Kubernetes
# post-delete Executes on a deletion request after all of the release's resources have been deleted
# pre-upgrade Executes on an upgrade request after templates are rendered, but before any resources are updated
# post-upgrade Executes on an upgrade request after all resources have been upgraded
# pre-rollback Executes on a rollback request after templates are rendered, but before any resources are rolled back
# post-rollback Executes on a rollback request after all resources have been modified
@Maurifc
Maurifc / rabbitmq_compose.yaml
Last active September 6, 2022 14:38
Docker - RabbitMQ on Dockercompose file
# amqp://rabbitmq:rabbitmq@localhost
rabbitmq:
container_name: rabbitmq
image: rabbitmq:3.7.8-management
hostname: "rabbitmq"
environment:
RABBITMQ_ERLANG_COOKIE: "SWQOKODSQALRPCLNMEQG"
RABBITMQ_DEFAULT_USER: "rabbitmq"
RABBITMQ_DEFAULT_PASS: "rabbitmq"
@Maurifc
Maurifc / nodejs.gitignore
Created September 3, 2022 21:41
Git - Git ignore for NodeJS applications
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*
# Diagnostic reports (https://nodejs.org/api/report.html)
@Maurifc
Maurifc / bash-script-boilerblate.sh
Last active November 19, 2022 13:19
Bash - A boilerplate for a bash script
#!/bin/bash
ACTION=$1
function help(){
echo -e \
"Usage:
1. Export ESSENTIAL_VARIABLE varible with...
$ export ESSENTIAL_VARIABLE=<KEY_PATH>
@Maurifc
Maurifc / bitbucket-pipelines.yml
Created September 1, 2022 01:35
Bitbucket - Bitbucket pipeline boilerplate
image: python:3.10
pipelines:
pull-requests:
'**':
- step:
name: Linter
script:
- echo Linting...
branches: