Skip to content

Instantly share code, notes, and snippets.

@natac13
natac13 / .bash_aliases
Last active October 5, 2020 22:20
Bash shell aliases
# General
alias mkdir='mkdir -pv'
alias cp='cp -iv'
alias mv='mv -iv'
alias less='less -FSRXc'
alias srcb='source ~/.bashrc'
#alias rm='rm -v'
gist_id=1669066880bd89489de27ed9a8b2e760
@natac13
natac13 / Dockerfile
Created June 23, 2019 22:29
Setup for M220 Javascript
## Stage 1 (production base)
# This gets our prod dependencies installed and out of the way
FROM node:12.2 as base
EXPOSE 5000
ENV NODE_ENV=production
# Add Tini
ENV TINI_VERSION v0.18.0
@natac13
natac13 / docker-compose.yml
Created June 23, 2019 22:28
My mongodb container for M201
version: '2.4'
services:
db:
image: mongo:4.0.10-xenial
restart: always
command: --wiredTigerCacheSizeGB 1 --auth --directoryperdb
volumes:
- dbData:/data/db
environment:
version: "3"
services:
mongo1:
hostname: mongo1
container_name: localmongo1
image: mongo:4.0-xenial
expose:
- 27017
ports:
- 27011:27017
@natac13
natac13 / docker-help.md
Created May 19, 2019 17:04 — forked from bradtraversy/docker-help.md
Docker Commands, Help & Tips

Docker Commands, Help & Tips

Show commands & management commands

$ docker

Docker version info

@natac13
natac13 / setup-x509.sh
Created May 18, 2019 15:25 — forked from tjworks/setup-x509.sh
Script to setup a test MongoDB replicaset and enable X.509 authentication
### https://github.com/tjworks/mongoscripts/tree/master/x509 ###
# Prerequisites:
# a. Make sure you have MongoDB Enterprise installed.
# b. Make sure mongod/mongo are in the executable path
# c. Make sure no mongod running on 27017 port, or change the port below
# d. Run this script in a clean directory
##### Feel free to change following section values ####
# Changing this to include: country, province, city, company
dn_prefix="/C=CN/ST=GD/L=Shenzhen/O=MongoDB China"
@natac13
natac13 / classesResolver.js
Created May 7, 2019 14:50
Dataloader & The Problem it solves. My understaning.
....
export default {
Query: {
class: () => {...}
},
classes: async (root, { conditions }, { dataSources, userId }, info) => {
// Check for authentication
...
const projection = gqlMongoDBProjection(info);
return dataSources.Class.getAllClasses(conditions, projection);
@natac13
natac13 / MongoDB_Knowledge.md
Created April 22, 2019 10:55
My working understanding of MongoDB and the tools surrounding it. eg Atlas, mlab, mongoose

Structuring a Mongo Database Documents

Whether or not one should embed nested docs or to use the reference by ID and populate later is a great question and has been answered nicely on StackOverflow

@natac13
natac13 / Build.md
Created April 21, 2019 18:37
Project Setup

Build Process

Automated sequence of tasks that runs on eash push, tag, and/or release

Stages

  1. install
  2. lint
  3. test
  4. build
  5. push
@natac13
natac13 / session.md
Last active April 20, 2019 17:40
Authentication Work Flow

Authentication Work Flow

Sesssions


Flow

  • user submits login credentials, e.g email and password
  • server verifies the credentials against the DB
  • server creates a temporary user session
  • server issues a cookie with a session ID
  • user sends the cookie with each request