Skip to content

Instantly share code, notes, and snippets.

View vkhang55's full-sized avatar
🎯
Focusing

Khang Pham vkhang55

🎯
Focusing
View GitHub Profile
# install aws cli with pip
pip install awscli
# configure the new aws cli tool you just downloaded. Enter your secret and access key in when prompted. These keys can be found in your AWS console
aws configure
@vkhang55
vkhang55 / setup_virtualenv.sh
Last active September 30, 2018 09:44
Flask Serverless Tutorial - Setting up Pyenv-Virtualenv
# installing virtualenv
pip install virtualenv
# create a new virtual environment named tutorial
virtualenv tutorial
# in the same directory
source tutorial/bin/activate
pip install zappa
@vkhang55
vkhang55 / hello.py
Last active September 26, 2018 07:40
Flask Serverless Tutorial
from flask import Flask
app = Flask(__name__)
@app.route('/', methods=['GET'])
def hello():
return "Hello Serverless World!"
@vkhang55
vkhang55 / The Technical Interview Cheat Sheet.md
Last active August 27, 2015 20:32 — forked from tsiege/The Technical Interview Cheat Sheet.md
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.

Studying for a Tech Interview Sucks, so Here's a Cheat Sheet to Help

This list is meant to be a both a quick guide and reference for further research into these topics. It's basically a summary of that comp sci course you never took or forgot about, so there's no way it can cover everything in depth. It also will be available as a gist on Github for everyone to edit and add to.

Data Structure Basics

###Array ####Definition:

  • Stores data elements based on an sequential, most commonly 0 based, index.
  • Based on tuples from set theory.
task :scan_all_dfp => :environment do
dfp_videos = DfpVideo.where(yyyymm: 201408).group(:video_id).select("video_id, SUM(gross_rev) AS total_gross_rev").entries; nil
CSV.open("scan_all_dfp.csv", 'wb') do |csv|
csv << [ 'video_id', 'video_revenue.id', 'video_revenue.amount', 'video_revenue.total_earnings', 'video_revenue.gross_partner_sold', 'milton_video.gross_partner_sold_revenue', 'dfp_video.total_gross_rev' ]
dfp_videos.each_with_index do |dfp_video, i|
video = Video.find_by(youtube_video_id: dfp_video.video_id)
video_revenue = video.video_revenues.find_by(year: 2014, month: 8, :dfp_video_id.ne => nil)
if video_revenue.milton_row_id > 0
milton_video = Milton::VideoData.find(video_revenue.milton_row_id)