This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# deploy.sh | |
# Put this script on your production server and make it executable with chmod | |
# +x. | |
# Set the deploy_dir variable to the path on the production server to | |
# deployment directory. The script assumes the deployment directory is a git | |
# clone of the codebase from an upstream git repo. This script also assumes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Configuration | |
SERVER='10.20.30.40' | |
DEPLOY_TO='/Users/simon/apps/some_app/staging/' | |
EXCLUDE='*.sqlite3 *.swp .DS_Store .git/ tmp/ log/ public/uploads/ uploads/' | |
DRY_RUN=false | |
DEPLOY_GEM_PATH='/Users/simon/.rvm/gems/ruby-1.9.2-p180' | |
MYSQL2_BUNDLE='/Users/simon/apps/some_app/staging/vendor/bundle/ruby/1.9.1/gems/mysql2-0.2.13/lib/mysql2/mysql2.bundle' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'aws-sdk-s3' # v2: require 'aws-sdk' | |
ACCESS_KEY_ID = "" | |
SECRET_ACCESS_KEY = "" | |
REGION_ID = "us-east-1" | |
BUCKET_NAME = "bucket-name" | |
def uploadS3 | |
credentials = Aws::Credentials.new( | |
ACCESS_KEY_ID, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from collections import defaultdict | |
import heapq | |
class Solution: | |
def maxProbability(self, n: int, edges: List[List[int]], succProb: List[float], start: int, end: int) -> float: | |
''' | |
Input | |
n - number of nodes | |
edges - (u,v) for an undirected edge. | |
succProb - edge[i]'s weight | |
start - start node |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Definition for a binary tree node. | |
# class TreeNode: | |
# def __init__(self, x): | |
# self.val = x | |
# self.left = None | |
# self.right = None | |
class Solution: | |
def lowestCommonAncestor(self, root: 'TreeNode', p: 'TreeNode', q: 'TreeNode') -> 'TreeNode': | |
''' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Solution(object): | |
def insert(self, intervals, newInterval): | |
""" | |
:type intervals: List[List[int]] | |
:type newInterval: List[int] | |
:rtype: List[List[int]] | |
""" | |
''' | |
Test cases | |
i) [], [2,5] => [[2,5]] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 1004: Max ConsecutiveOnes III | |
maxLength = 0 | |
numZeros = 0 | |
# 1052: Grumpy Bookstore Owner | |
maxCustWhenGrumpy = 0 | |
idxOfStartX = 0 | |
custWhenGrumpy = 0 | |
# 1456: Max Number of Vowels in Substring of given length |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Interval Operations | |
There are a few operations that can be performed on intervals: | |
1. Merge interval[] s.t. the all intervals are disjoint. | |
[0,5],[5,7] ==> [0,7] | |
2. Insert interval into interval[] s.t. all intervals are disjoint. | |
3. Find intersection between two interval[]. | |
[0,5],[5,7] => [5,5] | |
In order to perform these operations, it is important to understand the 6 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Largest 1000 Cities in America | |
2013 popuation data - Biggest US Cities By Population | |
rank,city,state,population,2000-2013 growth | |
1,New York,New York,8405837,4.8% | |
2,Los Angeles,California,3884307,4.8% | |
3,Chicago,Illinois,2718782,-6.1% | |
4,Houston,Texas,2195914,11.0% | |
5,Philadelphia,Pennsylvania,1553165,2.6% |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: 2 | |
jobs: | |
build: | |
environment: | |
working_directory: ~/circleci-myapp | |
docker: | |
- image: circleci/ruby:2.4.2-node-browsers | |
environment: | |
CC_TEST_REPORTER_ID: XXXYYY | |
RAILS_ENV: test |
NewerOlder