Skip to content

Instantly share code, notes, and snippets.

View mikedao's full-sized avatar
🤷

Michael Dao mikedao

🤷
View GitHub Profile
@mikedao
mikedao / gist:ff1ceceb253d89c65574
Created January 6, 2015 19:46
Public Key Cryptography Outline
Public Key Cryptography
The Problem: How do we communicate securely on the internet?
- We have to encrypt our communications.
- How do two parties who have never met, agree on a key when all of their communications are public?
- The answer: Diffie Hellman Key Exchange. -Whitfield Diffie, Martin Hellman
- The first implementation of public key cryptography as envisioned by Ralph Merkle.
The Setup:
- Alice wants to Talk to Bob.
@mikedao
mikedao / OSes
Last active August 29, 2015 14:12
Get all requests that match :identifier
get matching user_agent_ids
get matching user_agent
os = user_agent.split(' ')[1]
count requests that match os
create hash {os => count }
display os[1..-2] + count
@mikedao
mikedao / gist:75a8661d793dab413611
Created December 31, 2014 16:11
TrafficSpy Psedocode
1. Check to see if application is registered
2. Check to see if payload is present
3. Check to see if request is a duplicate one.
4. Sanitize payload
5. Insert payload into database.
class Centaur
attr_reader :name,
:breed
def initialize(name, breed)
@name = name
@breed = breed
@actions = 0
@standing = true
end
Create VPC
Create Security Group
Create incoming and outgoing rules for SSH, HTTP, Sinatra and Rackup, 443
Create Key Pair
cd ~/.ssh
mv ~/Downloads/Turing.pem .
chmod 400 Turing.pem
ssh-add -k Turing.pem
Launch Instance
ubuntu 14.04
@mikedao
mikedao / credit_check.rb
Created December 17, 2014 06:02
Luhn's Algorithm
def validator(card)
card.chars
.map { |n| n.to_i }
.map.with_index { |n, index| index.even? ? n * 2 : n }
.map { |n| n.to_s.length == 2 ? n.to_s[0].to_i + n.to_s[1].to_i : n }
.reduce(:+) % 10 == 0 ? "Valid" : "Invalid"
end