Skip to content

Instantly share code, notes, and snippets.

set number
set ruler
set showcmd
set showmode
set showmatch
set smartcase
set smartindent
set expandtab
set shiftwidth=2
set tabstop=2
@tackun0301
tackun0301 / file0.txt
Created April 11, 2014 15:19
ChefでpassengerのPassengerRootを自動で設定したい ref: http://qiita.com/tackun0301/items/34ebf6dbf3dc452732b2
1 $
2 LoadModule passenger_module <%= `passenger-config about root | tr -d '\n'` %>/buildout/apache2/mod_passenger.so$
3 <IfModule mod_passenger.c>$
4 #PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-4.0.41$
5 PassengerRoot <%= `passenger-config about root` %>$
6 PassengerDefaultRuby /usr/bin/ruby$
7 </IfModule>$
8 $
9 $
10 <VirtualHost *:80>$
@tackun0301
tackun0301 / file0.txt
Created February 27, 2014 16:36
Rails+Bootstrapでshowした時の表示崩れ対策 ref: http://qiita.com/tackun0301/items/3ac67db7d4e10214cbba
.dl-horizontal{
dt {
min-height:20px;
height:auto !important;
height:20px;
}
dd {
min-height:20px;
height:auto !important;
height:20px;
@tackun0301
tackun0301 / file0.txt
Created February 27, 2014 11:43
MySQL5.6をyumでCentOSにインストールする方法 ref: http://qiita.com/tackun0301/items/c3bc36f888e99424046e
rpm -ivh http://dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm
yum install -y mysql-community-server
@tackun0301
tackun0301 / file0.txt
Created February 27, 2014 11:41
OpenStackで作成したボリュームをVM上でマウントする方法 ref: http://qiita.com/tackun0301/items/8c8a0ca29318e25b57d4
mkdir /mnt/volume0
@tackun0301
tackun0301 / csrf.log
Created August 7, 2013 01:24
Rails4.0でActionController::InvalidAuthenticityTokenエラー
W, [2013-08-06T00:53:53.050447 #3928] WARN -- : Can't verify CSRF token authenticity
I, [2013-08-06T00:53:53.050957 #3928] INFO -- : Completed 422 Unprocessable Entity in 4ms
F, [2013-08-06T00:53:53.068750 #3928] FATAL -- :
ActionController::InvalidAuthenticityToken (ActionController::InvalidAuthenticityToken):
actionpack (4.0.0) lib/action_controller/metal/request_forgery_protection.rb:163:in `handle_unverified_request'
actionpack (4.0.0) lib/action_controller/metal/request_forgery_protection.rb:170:in `handle_unverified_request'
actionpack (4.0.0) lib/action_controller/metal/request_forgery_protection.rb:177:in `verify_authenticity_token'
activesupport (4.0.0) lib/active_support/callbacks.rb:377:in `_run__853284013__process_action__callbacks'
activesupport (4.0.0) lib/active_support/callbacks.rb:80:in `run_callbacks'
actionpack (4.0.0) lib/abstract_controller/callbacks.rb:17:in `process_action'
require("lsqlite3")
-- Igmar: Wanneer closen we dat DB object eigenlijk ?
db = sqlite3.open('/etc/asterisk/users.sqlite')
--CONSOLE = "Console/dsp" -- Console interface for demo
--CONSOLE = "DAHDI/1"
--CONSOLE = "Phone/phone0"
TRUNK = "DAHDI/G1"
@tackun0301
tackun0301 / gist:6020370
Created July 17, 2013 13:02
Pluck and Convert from array to hash in Rails4
# in Controller Class...
columns = [:id, :column1, :column2, :column3]
model_class_array = ModelClass.where(:id => params[:id]).pluck(:id, :column1, :column2, :column3)
@model_classes = model_class_array.map{|row| Hash[*[columns, row].transpose.flatten]}
@tackun0301
tackun0301 / gist:5965854
Last active December 19, 2015 13:59
how to copy without .git files
rsync -rv --exclude=.git demo demo_bkp
rsync -rv --exclude=.svn demo demo_bkp
helpers do
def protected!
response = callcc do |cont|
auth = Rack::Auth::Digest::MD5.new(cont, "Administrator only") do |username|
"password" # username is ignored, or Password is always 'password' in this example.
end
auth.opaque = $$.to_s
auth.call(request.env)
end