Skip to content

Instantly share code, notes, and snippets.

View nborwankar's full-sized avatar

Nitin Borwankar nborwankar

View GitHub Profile
import dash
import dash_core_components as dcc
import dash_html_components as html
import plotly.graph_objs as go
import pandas as pd
app = dash.Dash()
df = pd.read_csv(
'https://gist.githubusercontent.com/chriddyp/'
  1. General Background and Overview
@nborwankar
nborwankar / couchdb-ec2-install.sh
Created August 26, 2011 00:21 — forked from msmith/couchdb-ec2-install.sh
Set up CouchDB on EC2
#!/bin/bash
#
# This script installs and configures couchdb on a fresh Amazon Linux AMI instance.
#
# Must be run with root privileges
# Tested with Amazon Linux AMI release 2011.02.1.1 (ami-8c1fece5)
#
export BUILD_DIR="$PWD"
curl -X PUT http://your:credentials@localhost:5984/profiles
curl -X POST -d '{"source":"http://couchcamp.couchone.com/profiles","target":"http://localhost:5984/profiles","continuous":true}' -H "Content-type: application/json" http://localhost:5984/_replicate
curl -X POST -d '{"target":"http://couchcamp.couchone.com/profiles","source":"http://localhost:5984/profiles","continuous":true}' -H "Content-type: application/json" http://localhost:5984/_replicate
THE PROBLEM:
Standard practices say no non-root process gets to talk to the Internet on a port less than 1024. How, then, could I get Node talking on port 80 on EC2? (I wanted it to go as fast as possible and use the smallest possible share of my teeny tiny little micro-instance's resources, so proxying through nginx or Apache seemed suboptimal.)
THE TEMPTINGLY EASY BUT TOTALLY WRONG SOLUTION:
Alter the port the script talks to from 8000 to 80:
}).listen(80);
<tfoot>
<tr bgcolor="white">
<th ><button class="pager-prev-page">prev</button></th>
<th colspan="2"><span class="pager-page"></span>
of <span class="pager-page-total"></span></th>
<th ><button class="pager-next-page">next</button></th>
</tr>
</tfoot>
<table id="example-1" bgcolor="gray" class="grid-test">
<thead>
<tr bgcolor="lightgray" class="header-row">
<th>Id</th>
<th>Date</th>
<th>Hour</th>
<th>Load</th>
</tr>
</thead>
<tbody class="data-body">
<table id="table-1" bgcolor="gray">
<thead>
<tr bgcolor="lightgray">
<th>Id</th>
<th>Date</th>
<th>Hour</th>
<th>Load</th>
</tr>
</thead>
<tbody>
<html lang="en">
<head>
<title>Couch View</title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" src="jquery.couch-view.js"></script>
<script>
$(document).ready(function() {
$(".grid-test").couchview({
url: "http://69.164.211.38:8080/mydb/_design/tests/_view/",