Skip to content

Instantly share code, notes, and snippets.

View grosscol's full-sized avatar

Colin grosscol

View GitHub Profile
@grosscol
grosscol / bgrep.sh
Created June 14, 2016 21:25
Grep through the bundle dependencies.
function bgrep {
ag "$@" $(bundle show --paths) .
}
@grosscol
grosscol / solr_cores_status.rb
Last active June 14, 2016 15:55
Grabbing status of solr cores via restful api
def cores_status
vars = {
action: "STATUS",
wt: "json"}
target_url = "#{self.solr_admin_url}/cores"
resp = Typhoeus.get(target_url, params: vars)
if resp.response_code == 200
body = JSON.parse!(resp.response_body)
@grosscol
grosscol / rescueme.rb
Created January 28, 2016 19:14
Rescue next
(-5..5).each do |v|
begin
puts 10 / v
rescue => e
puts "#{e.message}"
next
end
end
@grosscol
grosscol / analytics_spec_fail
Created January 27, 2016 23:40
analytics_spec_fail for sufia7 master
13) Admin::StatsController statistics page top formats gathers formats
Failure/Error: json = open(query_url).read
ActionView::Template::Error:
404 Not Found
# ./app/models/system_stats.rb:99:in `top_data'
# ./app/models/system_stats.rb:57:in `top_formats'
# ./app/presenters/sufia/admin_stats_presenter.rb:22:in `top_formats'
# ./app/views/admin/stats/_top_data.html.erb:9:in `__home_grosscol_workspace_sufia_app_views_admin_stats__top_data_html_erb___3059809105315880374_47081691704000'
# ./app/views/admin/stats/index.html.erb:9:in `__home_grosscol_workspace_sufia_app_views_admin_stats_index_html_erb__4280599541274542522_47081693780540'
@grosscol
grosscol / solr.xml
Created January 8, 2016 20:00
Solr5 xml
<?xml version="1.0" encoding="UTF-8" ?>
<solr>
<sharedLib>lib</sharedLib>
<solrcloud>
<str name="host">${host:}</str>
<int name="hostPort">${jetty.port:8983}</int>
<str name="hostContext">${hostContext:solr}</str>
<int name="zkClientTimeout">${zkClientTimeout:15000}</int>
<bool name="genericCoreNodeNames">${genericCoreNodeNames:true}</bool>
@grosscol
grosscol / umich_dev_solr.xml
Last active January 8, 2016 20:00
Hackish Solr4 solr.xml
<?xml version="1.0" encoding="UTF-8" ?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
@grosscol
grosscol / ecr.log
Created November 6, 2015 21:12
Engine Cart Regenerate log
Removing sample rails app
Using rake 10.4.2
Using i18n 0.7.0
Using json 1.8.3
Using minitest 5.8.1
Using thread_safe 0.3.5
Using tzinfo 1.2.2
Using activesupport 4.2.4
Using builder 3.2.2
Using erubis 2.7.0
@grosscol
grosscol / tang.sh
Created September 10, 2015 18:05
Piece of bashrc for dev on tang.
# If logging into tang, cd to dev
if [[ $HOSTNAME = 'tang.umdl.umich.edu' ]]; then
# Add rbenv init script evaluation
eval "$(rbenv init -)"
# Set rbenv version for this shell
rbenv shell 2.2.1
# Alias bundle exec as bunx
alias bunx='bundle exec'
# Change to dev directory
cd /quod-dev/dev/grosscol
@grosscol
grosscol / rubobadcop_spec.rb
Created September 4, 2015 19:54
Rubocop & Rspec headache with testing a module
# I either end up with a rubocop error or an rspec error. In each case, the travis build will not pass.
# Rubocop error:
# RSpec/DescribedClass: Use described_class instead of Hydra::Works::GenericFile::Characterization
describe Hydra::Works::GenericFile::Characterization do
let(:demo_class) do
Class.new(Hydra::Works::GenericFile::Base) do
include Hydra::Works::GenericFile::Characterization
end
end
@grosscol
grosscol / more_noid_woes.rb
Created August 10, 2015 21:08
More NOID minting woes with File io
# Make a new rails application and drop this file in.
#
# Run from the command line with just plain ruby:
# bundle exec ruby doit.rb
#
# Run from the command line with rails:
# bundle exec rails runner "eval(File.read 'doit.rb')"
require 'active_fedora/noid'