Skip to content

Instantly share code, notes, and snippets.

@brygom
brygom / letsencrypt_2020.md
Created October 21, 2020 04:16 — forked from cecilemuller/letsencrypt_2020.md
How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SSL rating)

How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SLL rating)


Virtual hosts

Let's say you want to host domains first.com and second.com.

Create folders for their files:

@brygom
brygom / logger.spec.ts
Created October 15, 2020 02:01 — forked from jkyoutsey/logger.spec.ts
Unit test for logger.ts
import { Logger } from './logger';
import { environment } from '@environments/environment';
describe('Logger Spec', () => {
let debug;
let info;
let warn;
let err;
let log;
@brygom
brygom / logger.ts
Created October 15, 2020 02:01 — forked from jkyoutsey/logger.ts
ngx logger class for consistent logging. Based on angular/cli's use of environments.
import { Injectable } from '@angular/core';
import { environment } from '@environments/environment';
/**
* Class of static methods to allow for consistent console logging.
* @export
*/
@Injectable({
providedIn: 'root'
@brygom
brygom / README-Template.md
Created April 21, 2019 05:34 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@brygom
brygom / gtdeptos.sql
Created February 14, 2019 03:06
Guatemala departamentos y municipios
/**
* Poblado de datos
*/
SET FOREIGN_KEY_CHECKS = 0;
SET AUTOCOMMIT = 0;
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
START TRANSACTION;
INSERT INTO geo_departamentos VALUES (null, 'Alta Verapaz');
@brygom
brygom / mongo-docker.bash
Created December 8, 2018 04:41 — forked from davideicardi/mongo-docker.bash
Running mongodb inside a docker container (with mongodb authentication)
# Create a container from the mongo image,
# run is as a daemon (-d), expose the port 27017 (-p),
# set it to auto start (--restart)
# and with mongo authentication (--auth)
# Image used is https://hub.docker.com/_/mongo/
docker pull mongo
docker run --name YOURCONTAINERNAME --restart=always -d -p 27017:27017 mongo mongod --auth
# Using the mongo "localhost exception" (https://docs.mongodb.org/v3.0/core/security-users/#localhost-exception)
# add a root user
[template]
src = "mongo.tmpl"
dest = "/home/ubuntu/mongo_rep.sh"
keys = [
"/mongo",
]
reload_cmd = "echo update mongodb && sh /home/ubuntu/mongo_rep.sh"
#! /bin/sh
mongo <<EOF
rs.initiate()
{{range $service := ls "/mongo"}}
rs.add('{{.}}:27017')
{{end}}
quit()
exit
#! /bin/sh
mongo -u mongo-admin -p admin --authenticationDatabase admin <<EOF
rs.initiate()
rs.add('mong_a:27017')
rs.add('mong_b:27017')
quit()
exit
# mongod.conf
# for documentation of all options, see:
# http://docs.mongodb.org/manual/reference/configuration-options/
# Where and how to store data.
storage:
dbPath: /var/lib/mongodb
journal:
enabled: true