Skip to content

Instantly share code, notes, and snippets.

View benjohnson77's full-sized avatar

Ben Johnson benjohnson77

View GitHub Profile
@benjohnson77
benjohnson77 / upapt.sh
Created June 2, 2017 04:24 — forked from slickplaid/upapt.sh
Rackspace Ubuntu Server - Allow older system to get updates using apt with Rackspace's Mirrors
sudo sed -i -e 's/mirror.rackspace.com\|archive.ubuntu.com\|security.ubuntu.com/old-releases.ubuntu.com/g' /etc/apt/sources.list
<div class="ls-nav">
<ul>
<?php if($this->session->userdata('user_type_id') == 1 && $this->session->userdata('is_admin') != 1) { ?>
<li><a href="<?=base_url()?>dashboard" <?=($this->uri->segment(1) == 'dashboard'?'class="active"':NULL)?>><span class="icon-dashboard"></span>Dashboard</a></li>
<li><a href="<?=base_url()?>mail" <?=($this->uri->segment(1) == 'mail'?'class="active"':NULL)?>><span class="icon-mail"></span>Mail</a></li>
<li><a href="<?=base_url()?>client" <?=($this->uri->segment(1) == 'client'?'class="active"':NULL)?>><span class="icon-client"></span>Clients</a></li>
<li><a href="<?=base_url()?>company" <?=($this->uri->segment(1) == 'company'?'class="active"':NULL)?>><span class="icon-company"></span>Companies</a></li>
<li><a href="<?=base_url()?>user" <?=($this->uri->segment(1) == 'user'?'class="active"':NULL)?>><span class="icon-user"></span>Users</a></li>
<li><a href="<?=base_url()?>agent" <?=($this->uri->segment(1) == 'agent'?'class="active"':N
describe 'product' do
before(:each) do
visit '/login'
fill_in 'user_name', :with => 'admin'
fill_in 'password', :with => 'Legalinc2015'
click_on 'Sign in'
click_on 'Products'
end
describe 'stats' do
expect(page).to have_select("input[name='client_status_id']", selected: 'All')
expect(page).to have_select("input[name='client_type_id']", selected: 'All')
expect(page).to have_select("input[name='distributor_id']', selected: 'All')
expect(page).to have_select('input[name='state']', selected: 'All')
expect(page).to have_field('client_name', with: '')
expect(page).to have_field('client_email', with: '')
expect(page).to have_field('client_phone', with: '')
function alcGetUrlWithProtocol(url)
{
var useSSL = 'https:' == document.location.protocol;
if (useSSL == true){
var new_url = url.replace(/http:/,'https:');
}else{
var new_url = url ;
}
@benjohnson77
benjohnson77 / gist:5385f119efff85894247
Created July 23, 2014 23:08
refactor of the process_items vs process file
def self.process_file(uploaded_file)
items = []
CSV.foreach(uploaded_file, headers: false) do |row|
items.push(row[0].to_i)
end
process_items(items)
end
def self.process_items(items)
clearancing_status = create_clearancing_status
@benjohnson77
benjohnson77 / gist:8695801
Last active August 29, 2015 13:55
Quick script for mashing up pipedrive and contacturally
namespace :pipedrive do
desc "Look into match up pipedrive with contactually"
require 'httparty'
require 'json'
task :import => :environment do
require 'csv'
filename = Rails.root + "lib/tasks/meetingplanners.csv"
@benjohnson77
benjohnson77 / gist:7108171
Last active December 26, 2015 06:29
Comparing application performance on Rackspace vs Google Compute Engine
Started GET "/books" for 96.226.128.2 at 2013-10-22 20:18:56 +0000
Processing by Web::BooksController#index as HTML
User Load (2.7ms) SELECT `users`.* FROM `users` WHERE `users`.`id` = 38 LIMIT 1
(2.4ms) SELECT COUNT(*) FROM `reading_actions` WHERE `reading_actions`.`user_id` = 38 AND `reading_actions`.`action_type` = 'have_read'
(75.2ms) SELECT COUNT(*) FROM `reading_actions` WHERE `reading_actions`.`user_id` = 38 AND `reading_actions`.`action_type` = 'want_to_read'
(54.7ms) SELECT COUNT(*) FROM `reading_actions` LEFT OUTER JOIN readings ON readings.reading_action_id = reading_actions.id WHERE `reading_actions`.`user_id` = 38 AND (reading_actions.readable_type in ('Book', 'SocialBook') AND reading_actions.action_type = 'reading_now') AND (CASE WHEN readings.is_private = 1 THEN readings.user_id = 38 ELSE 1 = 1 END)
Rendered shared/v2/_breadcrumb.haml (2.3ms)
(2.8ms) SELECT COUNT(count_column) FROM (SELECT 1 AS count_column FROM `reading_actions` LEFT OUTER JOIN readings ON readings.readin
@benjohnson77
benjohnson77 / gist:7107825
Last active December 26, 2015 06:29
SQL benchmark on 3 different cloud platforms.
I decided to add RDS environment to my testing. So I can compare AWS(RDS) to rackspace(Rack DB) to GCE (cloud-SQL) and this is what I find running the same benchmark on all three. GCE is in the same zone, and for comparison AWS server is also in the same zone as RDS.
benchmark I am using is perl test-wisconsin from sql bench
Google
Wisconsin benchmark test
Time for create_table (3): 1 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Inserting data
Time to insert (31000): 317 wallclock secs ( 1.95 usr 2.09 sys + 0.00 cusr 0.00 csys = 4.04 CPU)
Time to delete_big (1): 0 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
@benjohnson77
benjohnson77 / gist:6873279
Last active December 24, 2015 22:29
Looks like google knife needed some additional OHAI plugin to produce the same data as the AWS-knife command.
➜ crockpot git:(master) ✗>knife bootstrap ---- ommitted -----
Bootstrapping Chef on 173.255.117.224
173.255.117.224 Starting Chef Client, version 11.6.0
173.255.117.224 resolving cookbooks for run list: ["ohai", "sudo", "users::sysadmins", "apt", "git", "snap", "locales", "imagemagick", "logrotate", "rvm::user", "mysql", "bookshout_passenger", "bookshout_passenger::qa", "instramentalapp_agent"]
173.255.117.224 Synchronizing Cookbooks:
173.255.117.224 - instramentalapp_agent
173.255.117.224 - bookshout_passenger
173.255.117.224 - openssl
173.255.117.224 - build-essential
173.255.117.224 - mysql