Skip to content

Instantly share code, notes, and snippets.

View verbaleks's full-sized avatar

Oleksii Verbivskyi verbaleks

  • Cherkassy
View GitHub Profile
@verbaleks
verbaleks / paperclip.rb
Created April 1, 2016 07:50
Paperclip handler for Hashie::Mash and Hash (Grape API)
module Paperclip
class HashieMashUploadedFileAdapter < AbstractAdapter
attr_accessor :original_filename # use this accessor if you have paperclip version < 3.3.0
def initialize(target)
@tempfile, @content_type, @size = target.tempfile, target.type, target.tempfile.size
self.original_filename = target.filename
end
end
wget https://download.elastic.co/elasticsearch/elasticsearch/elasticsearch-2.1.1.tar.gz
tar xzf elasticsearch-2.1.1.tar.gz
sudo mv elasticsearch-2.1.1 /usr/share/elasticsearch
cd /usr/share/elasticsearch
./bin/elasticsearch -D
### USAGE
###
### ./ElasticSearch.sh 1.5.0 will install Elasticsearch 1.5.0
### ./ElasticSearch.sh 1.4.4 will install Elasticsearch 1.4.4
### ./ElasticSearch.sh will fail because no version was specified (exit code 1)
###
### CLI options Contributed by @janpieper
### Check http://www.elasticsearch.org/download/ for latest version of ElasticSearch
### ElasticSearch version
@verbaleks
verbaleks / gist:3f1e741fe27faea4e154
Last active August 29, 2015 14:20
Command samples
backup: # mysqldump -u root -p[root_password] [database_name] > dumpfilename.sql
restore:# mysql -u root -p[root_password] [database_name] < dumpfilename.sql
@verbaleks
verbaleks / heroku
Last active August 29, 2015 14:19 — forked from evrybiont/heroku
git remote rm heroku - this will remove the heroku remote from your application
git remote add production <production apps heroku git repo url> - this will add a new remote named 'production' pointing at the production apps git repo url (you can get this from the My Apps page on heroku.com
git remote add staging <staging apps heroku git repo url>
git push staging master
git push staging locla_branch:master
h1. Sublime Text 2 - Useful Shortcuts (PC)
Loosely ordered with the commands I use most towards the top. Sublime also offer "full documentation":http://www.sublimetext.com/docs/2/.
h2. Editing
| *Ctrl+C* | copy current line (if no selection) |
| *Ctrl+X* | cut current line (if no selection) |
| *Ctrl+⇧+K*| delete line |
| *Ctrl+↩* | insert line after |
### Install OpenJDK
cd ~
sudo apt-get update
sudo apt-get install openjdk-7-jre-headless -y
### Download and Install ElasticSearch
### Check http://www.elasticsearch.org/download/ for latest version of ElasticSearch and replace wget link below
wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-1.3.1.deb
sudo dpkg -i elasticsearch-1.3.1.deb