Skip to content

Instantly share code, notes, and snippets.

View dvdasari's full-sized avatar

DV Dasari dvdasari

View GitHub Profile
ssh into server (ubuntu 14:04)
cd into project root path
sudo apt-get install libmysqlclient-dev
sudo apt-get install build-essential bison openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libxml2-dev autoconf libc6-dev ncurses-dev automake libtool
bundle install
@dvdasari
dvdasari / gist:3d1d0d049c9e31a644e0
Last active August 29, 2015 14:18
error installing mysql2 0.3.16
$ bundle exec rake vlad:deploy
/Users/dvmac/.rbenv/versions/1.9.3-p484/lib/ruby/gems/1.9.1/gems/systemu-2.2.0/lib/systemu.rb:29: Use RbConfig instead of obsolete and deprecated Config.
/Users/dvmac/.rbenv/versions/1.9.3-p484/lib/ruby/gems/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `block in require': iconv will be deprecated in the future, use String#encode instead.
/Users/dvmac/.rbenv/versions/1.9.3-p484/lib/ruby/gems/1.9.1/gems/tmail-1.2.7.1/lib/tmail/vendor/rchardet-1.3/lib/rchardet.rb:59: warning: already initialized constant VERSION
Faraday::Builder is now Faraday::RackBuilder.
DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)>
@dvdasari
dvdasari / gist:0e43ea99ed369859fe32
Created March 30, 2015 22:02
install therubyracer 0.11.4
brew unlink apple-gcc42 (if apple-gcc42 was already installed with brew)
brew install apple-gcc42
sudo rm /usr/bin/gcc
sudo rm /usr/bin/g++
sudo rm /usr/bin/cpp
sudo ln -s /usr/local/Cellar/apple-gcc42/4.2.1-5666.3/bin/gcc-4.2 /usr/bin/gcc
sudo ln -s /usr/local/Cellar/apple-gcc42/4.2.1-5666.3/bin/g++-4.2 /usr/bin/g++
sudo ln -s /usr/local/Cellar/apple-gcc42/4.2.1-5666.3/bin/cpp-4.2 /usr/bin/cpp
@dvdasari
dvdasari / gist:68a898d1a7227d433ff3
Last active August 29, 2015 14:18
error installing therubyracer 0.11.4
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/Users/dvmac/.rbenv/versions/1.9.3-p484/bin/ruby -r ./siteconf20150330-74670-1hqyq1f.rb extconf.rb
checking for main() in -lpthread... yes
checking for main() in -lobjc... yes
checking for v8.h... yes
creating Makefile
make clean
default: &default
adapter: mysql2
encoding: utf8
pool: 5
username: root
password:
socket: /tmp/mysql.sock
development:
<<: *default
FROM ruby:2.1.5
RUN apt-get update -qq && apt-get install -y build-essential libpq-dev
RUN mkdir /myapp
WORKDIR /myapp
ADD Gemfile /myapp/Gemfile
ADD Gemfile.lock /myapp/Gemfile.lock
RUN bundle install
db:
image: mysql
ports:
- "3306"
web:
build: .
command: bundle exec rails server -p3500
volumes:
- .:/myapp
@dvdasari
dvdasari / gist:439ce7c1814c2392c3bf
Last active March 23, 2020 12:05
docker commands
1. Create new container
a) docker run -i -t ubuntu /bin/bash
b) docker run --name rails_dev_container -i -t ubuntu ubuntu /bin/bash
The command line flags - i -t provide an interactive shell in the new container
2. Show running docker containers ==> docker ps
3. Show list of current containers ==>
a) docker ps -a (Show all containers, both stopped and running)
b) docker ps -n x (shows the last x containers, running or stopped, ex: docker ps -n 5)
<h3>Display Coordinates</h3>
<p id="geo_loc"></p>
<script>
function success(position) {
var latitude = position.coords.latitude;
var longitude = position.coords.longitude;
output.innerHTML = '<p>Latitude is ' + latitude + '<br>Longitude is ' + longitude + '</p>';
};
# ruby gitsearch.rb
search_term = "elasticsearch"
file_types = "*.rb"
`echo "\n############################" >> search_results.txt`
`echo "Search Term: #{search_term}" >> search_results.txt`
`echo "File Types: #{file_types}" >> search_results.txt`
`echo "############################\n" >> search_results.txt`