Skip to content

Instantly share code, notes, and snippets.

View kamal-github's full-sized avatar
:octocat:
Focusing

Kamal Namdeo kamal-github

:octocat:
Focusing
View GitHub Profile
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
@kamal-github
kamal-github / Bear_and_Steady_Gene.cpp
Created April 10, 2016 13:51
Bear and Steady Gene (CPP program)
bool validityCheck(map<char, int> dict, int limit){
if(dict['A'] <= limit && dict['C'] <= limit && dict['G'] <= limit && dict['T'] <= limit){
return true;
}else{
return false;
}
}
int main() {
int N, maxIndex = 0, out = 999999;
@kamal-github
kamal-github / jquery validate customization
Last active March 31, 2016 10:49
jquery validate plugin - different trick when customizing
1) If you don't want to show error message -
`$('#form').validate({
errorPlacement: function(error,element) {
return true;
}
});`
`http://stackoverflow.com/questions/1578007/jquery-validate-hide-display-validation-error-messages-show-custom-errors`
@kamal-github
kamal-github / nginxproxy.md
Created February 9, 2016 17:43 — forked from soheilhy/nginxproxy.md
How to proxy web apps using nginx?

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers

@kamal-github
kamal-github / nginx-ssl-config
Created February 9, 2016 17:42 — forked from apollolm/nginx-ssl-config
Nginx Configuration with multiple port apps on same domain, with SSL.
# the IP(s) on which your node server is running. I chose port 3000.
upstream app_geoforce {
server 127.0.0.1:3000;
}
upstream app_pcodes{
server 127.0.0.1:3001;
}

RVM and Ruby

apt-get -yqq install libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison subversion pkg-config curl build-essential git

su - vagrant -c "sudo bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)"
adduser vagrant rvm
source /etc/profile.d/rvm.sh
su - vagrant -c "rvm pkg install libyaml"
su - vagrant -c "rvm install 2.0.0-turbo"

su - vagrant -c "rvm use 2.0.0-turbo --default"

## Postgres
Configure so that the vagrant user doesn't need to provide username and password.
apt-get -yqq install postgresql postgresql-contrib-9.3 libpq-dev postgresql-server-dev-9.3
su - postgres
createuser --createdb --superuser -Upostgres vagrant
psql -c "ALTER USER vagrant WITH PASSWORD 'password';"
psql -c "create database discourse_development owner vagrant encoding 'UTF8' TEMPLATE template0;"
psql -c "create database discourse_test owner vagrant encoding 'UTF8' TEMPLATE template0;"
## Postgres
Configure so that the vagrant user doesn't need to provide username and password.
apt-get -yqq install postgresql postgresql-contrib-9.3 libpq-dev postgresql-server-dev-9.3
su - postgres
createuser --createdb --superuser -Upostgres vagrant
psql -c "ALTER USER vagrant WITH PASSWORD 'password';"
psql -c "create database discourse_development owner vagrant encoding 'UTF8' TEMPLATE template0;"
psql -c "create database discourse_test owner vagrant encoding 'UTF8' TEMPLATE template0;"

Postgres

Configure so that the vagrant user doesn't need to provide username and password.

apt-get -yqq install postgresql postgresql-contrib-9.3 libpq-dev postgresql-server-dev-9.3
su - postgres
createuser --createdb --superuser -Upostgres vagrant
psql -c "ALTER USER vagrant WITH PASSWORD 'password';"
psql -c "create database discourse_development owner vagrant encoding 'UTF8' TEMPLATE template0;"

psql -c "create database discourse_test owner vagrant encoding 'UTF8' TEMPLATE template0;"

@kamal-github
kamal-github / unicorn.rb
Created November 19, 2015 15:11 — forked from zacksiri/unicorn.rb
unicorn.rb
# Sample verbose configuration file for Unicorn (not Rack)
#
# This configuration file documents many features of Unicorn
# that may not be needed for some applications. See
# http://unicorn.bogomips.org/examples/unicorn.conf.minimal.rb
# for a much simpler configuration file.
#
# See http://unicorn.bogomips.org/Unicorn/Configurator.html for complete
# documentation.