Skip to content

Instantly share code, notes, and snippets.

@i5okie
i5okie / gist:c83cd091da23850d65af
Last active December 18, 2015 00:36
ibc-win7machine
Enable-RemoteDesktop
Enable-MicrosoftUpdate
Install-WindowsUpdate
@i5okie
i5okie / bash.sh
Last active August 29, 2015 14:21
capistrano deploy:restart fails
% cap production deploy:restart 1 ↵
DEBUG [de17d89e] Running /usr/bin/env passenger -v as deploy@myserver
DEBUG [de17d89e] Command: /usr/bin/env passenger -v
DEBUG [de17d89e] /usr/bin/env: ruby: Permission denied
(Backtrace restricted to imported tasks)
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing as deploy@myserver: passenger exit status: 126
passenger stdout: Nothing written
passenger stderr: /usr/bin/env: ruby: Permission denied
@i5okie
i5okie / error
Last active August 29, 2015 14:19
cap production deploy error
...
** Invoke deploy:restart (first_time)
** Execute deploy:restart
** Invoke passenger:restart (first_time)
** Execute passenger:restart
DEBUG [725c38d2] Running /usr/bin/env passenger -v as deploy@myserver
DEBUG [725c38d2] Command: /usr/bin/env passenger -v
DEBUG [725c38d2] /usr/bin/env: ruby: Permission denied
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing as deploy@myserver: passenger exit status: 126
@i5okie
i5okie / gist:a468c3102288548b4801
Created March 16, 2015 21:00
rubber digitalocean
cap rubber:create_staging ◉ ◼◼◼◼◼◼◻◻◻◻
triggering load callbacks
* 2015-03-16 13:59:41 executing `rubber:init'
* 2015-03-16 13:59:42 executing `rubber:create_staging'
Hostname to use for staging instance [production]:
Roles to use for staging instance [apache,app,collectd,common,db:primary=true,elasticsearch,examples,graphite_server,graphite_web,graylog_elasticsearch,graylog_mongodb,graylog_server,graylog_web,haproxy,mongodb,monit,passenger,postgresql,postgresql_master,web,web_tools]:
* 2015-03-16 13:59:44 executing `rubber:create'
** Creating instance 14.04 x64/512MB/default,web,web_tools/New York 3
/Users/ivan/.rvm/gems/ruby-2.2.1/gems/rubber-2.16.0/lib/rubber/cloud/digital_ocean.rb:61:in `read': No such file or directory @ rb_sysopen - .pub (Errno::ENOENT)
from /Users/ivan/.rvm/gems/ruby-2.2.1/gems/rubber-2.16.0/lib/rubber/cloud/digital_ocean.rb:61:in `cre
@i5okie
i5okie / Domain Time Commands
Created March 13, 2015 16:38
Domain time configuration
On Server:
Stop-Service w32time
w32tm /config /manualpeerlist:"0.pool.ntp.org 1.pool.ntp.org" /syncfromflags:MANUAL
w32tm /unregister
w32tm /register
Start-Service w32time
w32tm /resync /rediscover
w32tm /query /status
@i5okie
i5okie / 0 ERROR
Last active August 29, 2015 14:16
NoMethodError in Admin::Items#edit
Showing /Users/ivan/GitHub/redress/app/views/admin/items/_doc.html.haml where line #3 raised:
undefined method `#<Document:0x007f9a69bafe40>' for :name:Symbol
Extracted source (around line #3):
.row.filelist
.small-8.columns.filename
= best_in_place :name, doc, :nil => doc.doc.file.filename
.small-2.columns.download_link
= link_to "Download", doc.file.url, class: "small-offset-1"
.small-2.columns.delete_checkbox
@i5okie
i5okie / 0
Last active August 29, 2015 14:16
PG Error
Showing /Users/ivan/GitHub/redress/app/views/admin/items/_form.html.haml where line #48 raised:
PG::UndefinedFunction: ERROR: operator does not exist: integer = character varying
LINE 1: ...s" INNER JOIN "itemdocuments" ON "documents"."id" = "itemdoc...
^
HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.
: SELECT 1 AS one FROM "documents" INNER JOIN "itemdocuments" ON "documents"."id" = "itemdocuments"."document_id" WHERE "itemdocuments"."item_id" = $1 LIMIT 1
Extracted source (around line #48):
46
@i5okie
i5okie / error
Created February 23, 2015 17:19
missing helper?
bin/rspec ◉ ◼◼◼◼◼◼◼◼◼◼
/Users/ivan/.rvm/gems/ruby-2.2.0/gems/actionpack-4.2.0/lib/abstract_controller/helpers.rb:151:in `rescue in block in modules_for_helpers': Missing helper file helpers//users/ivan/projects/ticketee/app/helpers/admin/base_helper.rb_helper.rb (AbstractController::Helpers::MissingHelperError)
from /Users/ivan/.rvm/gems/ruby-2.2.0/gems/actionpack-4.2.0/lib/abstract_controller/helpers.rb:148:in `block in modules_for_helpers'
from /Users/ivan/.rvm/gems/ruby-2.2.0/gems/actionpack-4.2.0/lib/abstract_controller/helpers.rb:144:in `map!'
from /Users/ivan/.rvm/gems/ruby-2.2.0/gems/actionpack-4.2.0/lib/abstract_controller/helpers.rb:144:in `modules_for_helpers'
from /Users/ivan/.rvm/gems/ruby-2.2.0/gems/actionpack-4.2.0/lib/action_controller/metal/helpers.rb:93:in `modules_for_helpers'
from /Users/ivan/.rvm/gems/ruby-2.2.0/gems/actionpack-4.2
<div class="tag">
<% if policy(ticket).tag? %>
<%= link_to "<span></span>".html_safe, remove_ticket_tag_path(ticket, tag), method: :delete, remote: true, class: "remove", title: "remove" %>
<% end %>
<%= tag.name %>
</div>
require 'rails_helper'
describe ProjectPolicy do
let(:user) { User.new }
subject { ProjectPolicy }
context ".scope" do
subject { Pundit.policy_scope(user, Project) }