Skip to content

Instantly share code, notes, and snippets.

Installing Redis

A very basic and quick TLDR; installation of redis for OSX and Linux users.

MacOS/OSX

$ brew install redis

Installing Postgres via Brew

Pre-Reqs

Brew Package Manager

In your command-line run the command: brew update

Installing

  1. In your command-line run the command: brew install postgresql
const express = require('express');
const path = require('path');
const bodyparser = require('body-parser');
const passport = require('passport');
const LocalStrategy = require('passport-local').Strategy;
// const cookieParser = require('cookie-parser');
const session = require('express-session')
const RedisStore = require('connect-redis')(session);
@nakaz
nakaz / letsencrypt.sh
Last active March 4, 2017 04:24
Nginx, LetsEncrypt, CertBot basic configuration/setup (OPTIONAL: nginx mainline with http2)
# as super user after pointing domain to server. ref: https://www.digitalocean.com/community/tutorials/how-to-secure-nginx-with-let-s-encrypt-on-ubuntu-14-04
cd /usr/local/sbin
wget https://dl.eff.org/certbot-auto
chmod a+x /usr/local/sbin/certbot-auto
certbot-auto certonly -a webroot --webroot-path=/usr/share/nginx/html -d [[site.com]] -d www.[[site.com]]
openssl dhparam -out /etc/ssl/certs/dhparam.pem 2048
# as root, edit the nginx config for the site you just set up
vim /etc/nginx/conf.d/[[site.com]].conf
# when editing the file, just follow all the directions to comment and uncomment TLS-related config
@nakaz
nakaz / simple.vimrc
Created September 24, 2016 00:26
Simple vim runcom file for comfortable server editing
" Break away from vi
set nocompatible
" Map Leader to space
let mapleader = "\<Space>"
let g:mapleader = "\<Space>"
" Basic Stuff
set number
@nakaz
nakaz / SudokuValidator.js
Last active May 28, 2016 20:32
Answer key for SudokuValidator Challenge
/* SudokuValidator(sudoku)
*
* @param sudoku a multidimensional array containing the sudoku puzzle
*
* @public property sudoku the sudoku grid
*
* @public method validate(num) num is the squared value or max value of sudoku number
for example: 9(result of 3x3 grid) or 4 (2x2).
*/
library(idbr) # devtools::install_github('walkerke/idbr')
library(ggplot2)
library(animation)
library(dplyr)
library(ggthemes)
idb_api_key("Your Census API key goes here")
male <- idb1('JA', 2010:2050, sex = 'male') %>%
mutate(POP = POP * -1,
@nakaz
nakaz / nginxproxy.md
Created October 8, 2015 08:52 — forked from soheilhy/nginxproxy.md
How to proxy web apps using nginx?

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers

@nakaz
nakaz / intro-mongo.md
Created October 5, 2015 03:30 — forked from sgnl/intro-mongo.md
MongoDB... COME ON DOOOOOOOWN

Before starting run the commands brew doctor and then brew update

Unix Users please install using the docs

Install Mongodb via Homebrew

$ brew install mongodb

Once brew is done installing, take note of the Caveats section that is printed to your console. Just like what we did previously for postgres it might be best to create a symlink then two aliases to start and stop the mongo progress.

  • Start your mongodb service
@nakaz
nakaz / installfest.md
Created October 5, 2015 03:30 — forked from sgnl/installfest.md
Dev league Day 0 Installfest

Installfest

If you have already installed any of these programs before, then you may skip it.

iTerm2(osx)

  • Linux flavors can use instead use the Terminal application that comes installed.

Scroll to the bottom of the page and find the install code for your operating system:

  • OSX: follow the instructions in the Via curl tab