Skip to content

Instantly share code, notes, and snippets.

View deepakdargade's full-sized avatar
🎯
Focusing

Deepak Dargade deepakdargade

🎯
Focusing
View GitHub Profile
cd ~
sudo apt-get update
sudo apt-get install openjdk-7-jre-headless -y
### Check http://www.elasticsearch.org/download/ for latest version of ElasticSearch and replace wget link below
# NEW WAY / EASY WAY
wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-0.20.6.deb
sudo dpkg -i elasticsearch-0.20.6.deb
#! /bin/bash
# GITLAB
# Maintainer: @randx
# App Version: 5.1
### BEGIN INIT INFO
# Provides: gitlab
# Required-Start: $local_fs $remote_fs $network $syslog redis-server
# Required-Stop: $local_fs $remote_fs $network $syslog
# NOTICE: to get Nginx+Unicorn best-practices configuration see the gist https://gist.github.com/3052776
$ cd /usr/src
$ wget http://nginx.org/download/nginx-1.2.1.tar.gz
$ tar xzvf ./nginx-1.2.1.tar.gz && rm -f ./nginx-1.2.1.tar.gz
$ wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.30.tar.gz
$ tar xzvf pcre-8.30.tar.gz && rm -f ./pcre-8.30.tar.gz
$ wget http://www.openssl.org/source/openssl-1.0.1c.tar.gz
#!/bin/sh
set -e
# Example init script, this can be used with nginx, too,
# since nginx and unicorn accept the same signals
# Feel free to change any of the following variables for your app:
TIMEOUT=${TIMEOUT-60}
APP_ROOT=/home/x/my_app/current
PID=$APP_ROOT/tmp/pids/unicorn.pid
CMD="/usr/bin/unicorn -D -c $APP_ROOT/config/unicorn.rb"
#!/bin/bash
### BEGIN INIT INFO
# Provides: says-dot-com-production
# Required-Start: $all
# Required-Stop: $network $local_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start the says-dot-com-production unicorns at boot
# Description: Enable says-dot-com-staging at boot time.
### END INIT INFO
  1. the default index.html does not work well in prodution mode, so do not borther to config that, just delete it and go on.

  2. To put things in production mode, do

     rails g scaffold items name:string
     rake db:migrate RAILS_ENV=production
     rm public/index.html
     #change route.rb point root to items#index
     rake assets:precompile
     sudo service nginx restart
    

./config/unicorn_init.sh stop

@deepakdargade
deepakdargade / parseSpreadsheet.rb
Created December 1, 2012 12:29 — forked from atljeremy/parseSpreadsheet.rb
Parse XLS Spreadsheet into Multi-Line Hash Using Ruby
# Required Gems
require "rubygems"
require "spreadsheet"
def getPixelTrackers
main=Hash.new
Spreadsheet.open('public/chart.xls') do |book|
book.worksheet('Sheet1').each do |row|
@deepakdargade
deepakdargade / bootstrap-modal-confirmation.js.coffee
Created September 28, 2012 11:15 — forked from hinrik/bootstrap-modal-confirmation.js.coffee
Bootstrap modal confirmation dialog for Rails
# Replace Rails' confirmation dialog with a translatable Bootstrap modal dialog.
# Requires jQuery 1.7, Bootstrap, and i18n-js (https://github.com/fnando/i18n-js)
# Translation strings used: confirm.title, confirm.ok, confirm.cancel
$ ->
$.rails.confirm = (message) ->
$("#confirm_dialog > .modal-body").html("<p><i class='icon-warning-sign'></i> " + message + '</p>')
false
if $('[data-confirm]')
$('body').append("<div class='modal hide' id='confirm_dialog'><div class='modal-header'><a class='close' data-dismiss='modal'>×</a><h3>" + I18n.t('confirm.title') + "</h3></div><div class='modal-body'></div><div class='modal-footer'><a class='btn btn-primary'></a><a href='#' data-dismiss='modal' class='btn'>" + I18n.t('confirm.cancel') + "</a></div></div>")
$('[data-confirm]').each ->
@deepakdargade
deepakdargade / jquery-multiselect-js
Created August 17, 2012 08:59
Multiselect js plugin override to show optlabel in select list
/*
* MultiSelect v0.8
* Copyright (c) 2012 Louis Cuny
*
* This program is free software. It comes without any warranty, to
* the extent permitted by applicable law. You can redistribute it
* and/or modify it under the terms of the Do What The Fuck You Want
* To Public License, Version 2, as published by Sam Hocevar. See
* http://sam.zoy.org/wtfpl/COPYING for more details.
*/
import urllib2
import json
from StringIO import StringIO
import base64
#==== configurations =======
username = "[email protected]"
password = "naked_password"
src_repo = "octocat/Hello-World"
dst_repo = "helloworld-inc/Hello-World"