Skip to content

Instantly share code, notes, and snippets.

View azuby's full-sized avatar

azuby

  • California, USA
View GitHub Profile
require 'spec_helper'
require_relative 'shared_examples'
describe Api::Beta::ClocksController do
let(:user) { create(:user, authentication_token: "qlnwenc") }
def self.valid_parameters
{ format: 'json', api_key: "asdlfnasldkfn",
authentication_token: user.authentication_token
Savon::HTTP::Error: HTTP error (500): <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html><head><title>Sun Java System Application Server 9.1 - Error report</title><style type="text/css"><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}HR {color : #525D76;}--></style> </head><body><h1>HTTP Status 500 - </h1><hr/><p><b>type</b> Exception report</p><p><b>message</b></p><p><b>description</b>The server encountered an internal error () that prevented it from fulfill
require "resque/tasks"
# Load entire rails environment for workers
task "resque:setup" => :environment do
Resque.before_fork = Proc.new { ActiveRecord::Base.establish_connection }
ENV['QUEUE'] = '*'
end
HttpResponse response = null;
HttpEntity entity = null;
if (requestType.equalsIgnoreCase("get")) {
HttpGet httpGet = new HttpGet(url);
if (parameters != null) {
httpGet.setEntity(new UrlEncodedFormEntity(parameters));
}
httpGet.setHeader("Accept", acceptHeader);
response = httpClient.execute(httpGet);
1. replace xxx passwords with some random password that you don't actually need to log in because of ssh keys
2. replace jellibug with syncin
3. generate ssh keys
4. replace db passwords
5. remove elasticsearch from base.json
"recipe[elasticsearch]",
"recipe[elasticsearch::bigdesk]",
"recipe[elasticsearch::head]",
and
"elasticsearch": {
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant::Config.run do |config|
config.vm.define :development do |config|
config.vm.box = "ubuntu-12.04"
config.vm.box_url = "http://files.vagrantup.com/precise64.box"
config.vm.customize ["modifyvm", :id, "--name", "ZeekMate Development"]

Step 1: Retrieve authenticity token

  • Request (phone)
`get :signin`
  • Response (Rails API)
`json: { :authenticity_token => "abc123" }`

Step 2: Create session and get session token

Method A: Carrier - Poor Location Precision, Secure

Method B: Client(phone) - High Location Precision, Insecure (Can be spoofed)

Option 1: Improve precision of Method A (Carrier Location)

  • Supports all phones on Tier 1 carriers
  • Find and correct for inaccuracy patterns

Option 2: Prevent spoofing of Method B (Client Location)

def show_link(object, content = image_tag("view.png", :alt => "View"), *args)
link_to(content, object, args) if can?(:show, object)
end
def link_to_create_association(object, association_class, content = "Add " + association_class.name.titleize, *args)
if can?(:create, association_class)
link_to(content, "#", :class => "add-fields-button", :"data-fields" => association_class.name.underscore, args)
end
end
puts Permission.exists?(action: action, resource: resource, access: access, resource_attribute: resource_attribute)
OUTPUT:
0000005be80c0 @name="updated_at", @sql_type="timestamp without time zone", @null=true, @limit=nil, @precision=nil, @scale=nil, @type=:datetime, @default=nil, @primary=nil, @coder=nil>], "privileges"=>[#<ActiveRecord::ConnectionAdapters::PostgreSQLColumn:0x00000005d6ff10 @name="id", @sql_type="integer", @null=false, @limit=nil, @precision=nil, @scale=nil, @type=:integer, @default=nil, @primary=nil, @coder=nil>, #<ActiveRecord::ConnectionAdapters::PostgreSQLColumn:0x00000005d6e1b0 @name="role_id", @sql_type="integer", @null=true, @limit=nil, @precision=nil, @scale=nil, @type=:integer, @default=nil, @primary=nil, @coder=nil>, #<ActiveRecord::ConnectionAdapters::PostgreSQLColumn:0x00000005d54620 @name="permission_id", @sql_type="integer", @null=true, @limit=nil, @precision=nil, @scale=nil, @type=:integer, @default=nil, @primary=nil, @coder=nil>, #<ActiveRecord::ConnectionAdapters::PostgreSQ