Skip to content

Instantly share code, notes, and snippets.

View pokka's full-sized avatar
🌮
I may be slow to respond.

Pokka pokka

🌮
I may be slow to respond.
View GitHub Profile
@pokka
pokka / .profile
Last active August 29, 2015 14:22
bundle exec short hand
function be () {
bundle exec $@
}
function ber () {
bundle exec rake $@
}
function bes () {
bundle exec rake spec $@
}
function bess () {
@pokka
pokka / mysql-dump-import.sh
Last active April 21, 2016 10:02
mysql dump & import
#import
gunzip < backupfile.sql.gz | mysql -uroot -ppassw database
#dump
mysqldump -h -u -p database | gzip > backupfile.sql.gz
#dump without schema(data only)
mysqldump --no-create-info --skip-triggers -h -u -p database | gzip > backupfile.sql.gz
#dump with columns
@pokka
pokka / brew-rvm
Created May 26, 2015 06:38
brew&rvm
sudo mkdir /usr/local
sudo chown -R $USER /usr/local
curl -Lsf \
http://github.com/mxcl/homebrew/tarball/master | \
tar xvz -C /usr/local --strip 1
mkdir -p ~/.rvm/src && cd ~/.rvm/src && rm -rf ./rvm && \
git clone --depth 1 git://github.com/wayneeseguin/rvm.git && \
cd rvm && ./install
skip_filter *_process_action_callbacks.map(&:filter), :only => [:action_goes_here]
@pokka
pokka / gist:74aa3d4451f1df793693
Last active August 29, 2015 14:20
Check the ports stat in linux
netstat -an | grep -i listen
netstat -an | grep -i listen | grep PORTNUMBERYOUWANT
@pokka
pokka / output_to_file_or_nothing
Last active August 29, 2015 14:15
Run linux cmd with a target output and run in background
cmd > log 2>&1 &
#Redirects STDOUT to log and than replaces STDERR with the redirected STDOUT.
cmd 2>&1 > log &
#Replaces STDERR with STDOUT and then redirects the original STDOUT to log.
cmd 2>&1 > /dev/null &
@pokka
pokka / count_rb_files
Created February 9, 2015 04:47
Count ruby files in your project
find . -iname "*.rb" -type f -exec cat {} \; | wc -l
@pokka
pokka / cake.rb
Created January 28, 2014 07:59
Run rake task in console
require 'rake'
#cake == console rake
module Cake
attr :trace
attr :alias_tasks
attr :current_task
@alias_tasks = {}
@trace = false
@pokka
pokka / Guthrie IP.md
Created September 12, 2013 10:35 — forked from holman/Guthrie IP.md

This song is Copyrighted in U.S., under Seal of Copyright # 154085, for a period of 28 years, and anybody caught singin it without our permission, will be mighty good friends of ourn, cause we don’t give a dern. Publish it. Write it. Sing it. Swing to it. Yodel it. We wrote it, that’s all we wanted to do.

  • Woody Guthrie, 1940's —
namespace :deploy do
task :setup_solr_data_dir do
run "mkdir -p #{shared_path}/solr/data"
end
end
namespace :solr do
desc "start solr"
task :start, :roles => :app, :except => { :no_release => true } do
run "cd #{current_path} && RAILS_ENV=#{rails_env} bundle exec sunspot-solr start --port=8983 --data-directory=#{shared_path}/solr/data --pid-dir=#{shared_path}/pids"