Skip to content

Instantly share code, notes, and snippets.

View bparanj's full-sized avatar

Bala Paranj bparanj

View GitHub Profile
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
@bparanj
bparanj / ruby-upload-s3.rb
Created January 15, 2021 00:07 — forked from db42/ruby-upload-s3.rb
Ruby script to upload a file to amazon s3
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,
@bparanj
bparanj / staging_deploy.sh
Created June 8, 2022 17:41 — forked from sstarr/staging_deploy.sh
A sample Bash deployment script. This is for a Rails app hosted on an OS X server.
#!/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'
@bparanj
bparanj / deploy.sh
Created June 8, 2022 17:41 — forked from danchoi/deploy.sh
Simple Rails deploy bash script
#!/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