Skip to content

Instantly share code, notes, and snippets.

View sahidursuman's full-sized avatar

Sahidur Rahman Suman sahidursuman

View GitHub Profile
CREATE TABLE IF NOT EXISTS `country` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`iso` char(2) NOT NULL,
`name` varchar(80) NOT NULL,
`nicename` varchar(80) NOT NULL,
`iso3` char(3) DEFAULT NULL,
`numcode` smallint(6) DEFAULT NULL,
`phonecode` int(5) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
#!/usr/bin/env ruby
require 'open-uri'
require 'JSON'
require 'digest/sha2'
require 'pry'
require 'bigdecimal'
require 'bitcoin' # Because I need to cheat every now and then
# Usage:
# gem install pry json ffi ruby-bitcoin

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 [email protected]

Add ssh fingerprint and enter password provided in email

http://www.modrails.com/documentation/Users%20guide%20Nginx.html#install_on_debian_ubuntu
Instruction for Ubuntu 12.X (should work on 11.x also)
a. Installing passenger gem
$ gem install passenger
b. Installing passenger-nginx module(It will compile and install Nginx with Passenger support)
IF ruby is installed without RVM
When installing passenger, Nginx, Ruby and Rails on Ubuntu 12.04 (without RVM/without rbenv):
First: installing Ruby (without RVM):
sudo apt-get update
sudo apt-get install ruby1.9.1 ruby1.9.1-dev \
rubygems1.9.1 irb1.9.1 ri1.9.1 rdoc1.9.1 \
build-essential libopenssl-ruby1.9.1 libssl-dev zlib1g-dev
@sahidursuman
sahidursuman / setup.sh
Last active August 29, 2015 14:07 — forked from bigfatgreg/setup.sh
#!/bin/bash
# install dependencies
apt-get update && apt-get upgrade
apt-get install build-essential bison openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev
# install RVM
\curl -L https://get.rvm.io | bash
# install ruby 2.0.0
# IN AMAZON EC2 SERVER #
########################
sudo su
apt-get -y update && apt-get -y upgrade
apt-get install vim git-core curl openssh-server openssh-client python-software-properties build-essential zlib1g-dev libssl-dev libreadline-gplv2-dev libcurl4-openssl-dev aptitude
/usr/sbin/groupadd wheel
/usr/sbin/visudo
(paste bottom)
%wheel ALL=(ALL) ALL
#!/bin/sh
################################################################################
# DEFAULT VARIABLES
################################################################################
LOCAL_PATH=/var/www
LOCAL_DOMAIN=mylocaltest.dev
LOCAL_DB_NAME=myuser
LOCAL_DB_USER=root
LOCAL_DB_PASSWORD=myrootpassword
@sahidursuman
sahidursuman / backup.sh
Last active August 29, 2015 14:07 — forked from stp-che/backup.sh
#!/bin/sh
d=`date +%Y%m%d`
path=/home/keeper/backup
pg_dump -U postgres -d my_database -n my_schema -f $path"dump"$d -O
zip -jq $path"dump"$d".zip" $path"dump"$d
#! /bin/sh/
# Setup for MAMP
echo
if [ -d /Applications/MAMP/Library/bin/ ]; then
echo "You're using MAMP. Cool. Gonna run some tests... ";
# Check if mysqldump is in /usr/local/bin/. If not, link 'em.
if [ ! -f /usr/local/bin/mysqldump ]; then
echo "mysqldump link doesn't exist. Creating link to MAMP.";