Skip to content

Instantly share code, notes, and snippets.

@nakaz
nakaz / README.md
Created August 10, 2017 02:35 — forked from JoeKarlsson/README.md
Lecture on password encryption, hashing, and bcrypt

How To Safely Store A Password

Use bcrypt. Use bcrypt. Use bcrypt. Use bcrypt. Use bcrypt. Use bcrypt. Use bcrypt. Use bcrypt. Use bcrypt. Use bcrypt.

Why Not {MD5, SHA1, SHA256, SHA512, SHA-3, etc}?

These are all general purpose hash functions, designed to calculate a digest of huge amounts of data in as short a time as possible. This means that they are fantastic for ensuring the integrity of data and utterly rubbish for storing passwords.

bcrypt Solves These Problems

How? Basically, it’s slow as hell. It uses a variant of the Blowfish encryption algorithm’s keying schedule, and introduces a work factor, which allows you to determine how expensive the hash function will be.

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

What are Migrations

Just like how we use Git to version control source code, we use migrations to manage the state of our database schemas.

I'm not really sure what that means...

Imagine you're working on project with another developer, and you're both tasked with creating a specific part of an event planning application. Let's say you are in charge of creating the Users and your friend is going to create the Events.

Let's say you and your friend divided the work in a way so that neither of you will have to to use each other's code to finish your tasks. While you're working on your part of the application, you only really need to touch the Users table when you are working with the database.

Creating models and migrations

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
@nakaz
nakaz / README.md
Last active August 29, 2015 14:25 — forked from jaywon/README.md

###Business Objective Good morning team! We just got a request from the new CMG(Chief Marketing Groovru) that he wants to start A/B testing every element across the entire site for user interaction. We are going to need you to create a script that can be included in an HTML page that tracks every click on a page and reports what element was clicked so that we know at a micro level how users are interacting with our new optimized, user-friendly, uber-engagement platform.

###Your Task Mock up a simple HTML page with a bunch of different elements on the page and create a script that tracks every single element clicked and the number of times it was clicked. We will worry about saving this to our analytics database later, we just need a way to prove that it works.

Thaaannnks :D

@nakaz
nakaz / express.md
Last active August 29, 2015 14:24 — forked from sgnl/express.md

Goal

Creating an Express server (don't auto-generate). Add routes based on the specs provided below. Some routes have additional requirements for features.

Test your server's routes with an application like POSTMAN or with the curl command from the terminal.

Server Specs

Modules

  • some JS server
  • something to parse data that will be posted to the server
@nakaz
nakaz / serverCodes.md
Last active August 29, 2015 14:24 — forked from sgnl/serverCodes.md

1xx: Information

Code Message Description
100 Continue The server has received the request headers, and the client should proceed to send the request body
101 Switching Protocols The requester has asked the server to switch protocols
103 Checkpoint Used in the resumable requests proposal to resume aborted PUT or POST requests

2xx: Successful

Code Message Description