Skip to content

Instantly share code, notes, and snippets.

Deploy Rails app to digitalocean with nginx, unicorn, capistrano & postgres

Create droplet of your liking (ubuntu 12.10 x32)

ssh to root in terminal with your server ip

ssh root@123.123.123.123

Add ssh fingerprint and enter password provided in email

Deploying a Rails 3 App with EC2 + S3 + Ubuntu + Capistrano + Passenger
=======================================================================
EC2 Setup
---------
1 Launch New ec2 instance - ami-1634de7f
2 Create elastic IP [ELASTIC_IP] and associate it with instance
3 go to domain registrar DNS settings, @ and www to ELASTIC_IP
4 set the `:host` in `config/deploy.rb` to ELASTIC_IP
# Guide
# Configure the essential configurations below and do the following:
#
# Repository Creation:
# cap deploy:repository:create
# git add .
# git commit -am "initial commit"
# git push origin master
#
# Initial Deployment:
@pandurang90
pandurang90 / netcat.scpt
Last active January 3, 2016 23:58
applescript to transfer file using netcat
tell application "SystemUIServer"
set actionSelected to the button returned of (display dialog "What you want to do?" buttons {"Send file", "Receive file"} default button 2)
if actionSelected = "Send file" then
set filepath to POSIX path of (choose file)
display dialog "Please enter IP address of receiver:" default answer ""
set ipAddress to text returned of result
if ipAddress = "" then
repeat
display dialog "IP address cant be blank,Please enter IP address of receiver:" default answer ""
@pandurang90
pandurang90 / 0_reuse_code.js
Created June 1, 2014 02:48
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@pandurang90
pandurang90 / openssl.cnf
Last active October 31, 2022 14:30
configure openssl.cnf
#
# OpenSSL example configuration file.
# This is mostly being used for generation of certificate requests.
#
# This definition stops the following lines choking if HOME isn't
# defined.
HOME = .
RANDFILE = $ENV::HOME/.rnd
@pandurang90
pandurang90 / nginx
Last active August 29, 2015 14:02
nginx configure
# HTTPS server
#
server {
listen 443;
server_name server_url;
index index.html index.htm;
root /home/deploy/cingo/public;
ssl on;
ssl_certificate path/to/www.example.org.crt;
ssl_certificate_key path/to/www.example.org.key;
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDDQK9kjyPaSHRZIkH7SwQ4WjMJkUSgKPq2pg8CVZeUreuBE0jotknkO1EmSC5zQDtnJLtUYOt08ckgFN5ucVWrceNhTXwLmXZMbSbZHvU7R6luSXyJ/s6zK6hl6MgqP3Z4wmCtSwuaqABC4PTd3X8Hd3wwjfeQXUT6Onpcz3vUS7SkkhHS1mOJvhW4QcPmD8JNolC9yxue2YAEtEArZWFpIlTSu9J3sMea0nK9C3thP9jRoQRPIh8ATQQRkL5Vqeq061FONAHQrkg7phws86HWnTcLxFeJc+fwAmETvmPk41w2zX2Z/Uu2/hTw1XgBqIr/IUSdHZMQuc9Wh7T0v2uH pandurang.plw@gmail.com
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
@pandurang90
pandurang90 / introrx.md
Last active August 29, 2015 14:20 — forked from staltz/introrx.md

The introduction to Reactive Programming you've been missing

(by @andrestaltz)

So you're curious in learning this new thing called Reactive Programming, particularly its variant comprising of Rx, Bacon.js, RAC, and others.

Learning it is hard, even harder by the lack of good material. When I started, I tried looking for tutorials. I found only a handful of practical guides, but they just scratched the surface and never tackled the challenge of building the whole architecture around it. Library documentations often don't help when you're trying to understand some function. I mean, honestly, look at this:

Rx.Observable.prototype.flatMapLatest(selector, [thisArg])

Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.