Skip to content

Instantly share code, notes, and snippets.

View datt's full-sized avatar
🏠
Working from home

Dattatraya Dongare datt

🏠
Working from home
View GitHub Profile
@datt
datt / sublime.yml
Last active November 23, 2016 11:54
#sublime #settings for Rails project : indentation, rulers etc.
{
"color_scheme": "Packages/Color Scheme - Default/Monokai.tmTheme",
"draw_white_space": "all",
"font_size": 11,
"ignored_packages":
[
"Vintage"
],
"margin": 2,
"rulers":
@datt
datt / year_range.rb
Created January 12, 2015 16:01
fake year range string
# Usage YearRange.new(2).range_string
# "1990-1991 | 2011-2013"
class YearRange
def initialize(range = 1)
@range = range
@years = (1980..2015).to_a
end
def collect
divide_factor = @years.size/@range
@datt
datt / routes.rb
Last active August 29, 2015 14:19
temperory routes and controller for html pages for #FrontEnd. #tmp #controller create a folder named as tmp in views, whatever is the name of the page, can be in accessed from /page_name. e.g. if page name is /help_desk.html.haml, can be accessed as /help_desk
get '/tmp/:page' => 'tmp#index'
get '/tmp/:page/:inner_page' => 'tmp#index'
@datt
datt / postgres_backup.sh
Last active November 6, 2023 10:33
Postgres Backup script
#!/bin/bash -x
export PGPASSWORD=myPGPassword
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
#Script Begin
DATE=`date +%d_%m_%Y_%H_%M`
if ! /usr/bin/pg_dump -O -U postgres -h localhost project_production -f /root/backups/postgres/daily/project_production_pg_$DATE.sql; then
/bin/echo "#########################################################" >> /var/log/postgres_backup.log
/bin/echo "Postgres Backup backup failed on `date +%d-%m-%Y`" >> /var/log/postgresql_backup.log
@datt
datt / crontab
Created April 27, 2016 07:01
Postgres Backup script
Daily backup at 2 a.m.
0 2 * * * /root/scripts/postgres_backup.sh
@datt
datt / install.sh
Last active January 11, 2021 08:02
rails setup commands on aws
sudo apt-get install git
sudo apt-get install nginx
sudo apt-get install nodejs
sudo apt-get install imagemagick
sudo apt-get install libpq-dev #postgres ext lib required
sudo apt update
sudo apt-get install libmagick++-dev #imagemagick dependency
# Installing Ruby using .rbenv
sudo apt install git curl autoconf bison build-essential \
@datt
datt / create_deploy.sh
Created July 4, 2016 07:57
create a deploy user with no password.
#Login from root
adduser deploy
# set a pssowrd if asked.
# Run visudo and add following line
%deploy ALL=(ALL) NOPASSWD: ALL
@datt
datt / environment
Created July 15, 2016 05:53
FIX for 'perl: warning: Setting locale failed.'
# Add following lines in /etc/environment to fix the warnings.
LANGUAGE=en_US.UTF-8
LC_ALL=en_US.UTF-8
LANG=en_US.UTF-8
LC_TYPE=en_US.UTF-8
@datt
datt / .htaccess
Created November 18, 2016 08:17
.htaccess for redirecting to www.domain.com and leverage browser catching, compression on
Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /
## don't touch /forum URIs
#RewriteRule ^forums/ - [L,NC]
## hide .php extension snippet
@datt
datt / install-comodo-ssl-cert-for-nginx.rst
Created April 12, 2017 11:40 — forked from bradmontgomery/install-comodo-ssl-cert-for-nginx.rst
Steps to install a Comodo PositiveSSL certificate with Nginx.

Setting up a SSL Cert from Comodo

I use Namecheap.com as a registrar, and they resale SSL Certs from a number of other companies, including Comodo.

These are the steps I went through to set up an SSL cert.

Purchase the cert