Skip to content

Instantly share code, notes, and snippets.

View rossta's full-sized avatar
💭
Being curious

Ross Kaffenberger rossta

💭
Being curious
View GitHub Profile
@rossta
rossta / query.sql
Created March 13, 2015 20:47
Find largest tables on MYSQL server
SELECT CONCAT(table_schema, '.', table_name),
CONCAT(ROUND(table_rows / 1000000, 2), 'M') rows,
CONCAT(ROUND(data_length / ( 1024 * 1024 * 1024 ), 2), 'G') DATA,
CONCAT(ROUND(index_length / ( 1024 * 1024 * 1024 ), 2), 'G') idx,
CONCAT(ROUND(( data_length + index_length ) / ( 1024 * 1024 * 1024 ), 2), 'G') total_size,
ROUND(index_length / data_length, 2) idxfrac
FROM information_schema.TABLES
ORDER BY data_length + index_length DESC
LIMIT 10;
@rossta
rossta / configure_nginx_rails.rb
Last active August 29, 2015 14:17
Configure nginx for rails
#!/usr/bin/env ruby
require 'erb'
puts "Generating nginx config..."
app_root = Dir.getwd
app_name = File.basename(app_root)
public_path = File.join(app_root, 'public')
@rossta
rossta / install.txt
Created April 9, 2015 03:22
ember-cli@0.2.3 install output
$ npm install --save-dev ember-cli@0.2.3
> ws@0.5.0 install /Users/ross/dev/challengepost/bridge/node_modules/ember-cli/node_modules/testem/node_modules/socket.io/node_modules/engine.io/node_modules/ws
> (node-gyp rebuild 2> builderror.log) || (exit 0)
CXX(target) Release/obj.target/bufferutil/src/bufferutil.o
SOLINK_MODULE(target) Release/bufferutil.node
SOLINK_MODULE(target) Release/bufferutil.node: Finished
CXX(target) Release/obj.target/validation/src/validation.o
SOLINK_MODULE(target) Release/validation.node
@rossta
rossta / railsconf-notes.md
Last active August 29, 2015 14:20
railsconf 2015 notes

RailsConf Show & Tell

Keynotes

  • Kent Beck: "A man cannot be comfortable without his own approval" - Mark Twain *
  • DHH @ 00:26:00: Rails API and Action Cable
  • Tenderlove: Just watch

Culture

@rossta
rossta / opsworks-intro.md
Last active August 29, 2015 14:20
Introduction to AWS OpsWorks

Intro to AWS OpsWorks for the Rails Developer

AWS OpsWorks

AWS OpsWorks features an integrated management experience for the entire application lifecycle including resource provisioning, configuration management, application deployment, monitoring, and access control. It will work with applications of any level of complexity and is independent of any particular architectural pattern.

Wat?

  • Configure instances
  • Automate provisioning
@rossta
rossta / hack-share.md
Last active August 29, 2015 14:21
hack sharing

How I share hacks

gist!

gist

  • multiple files
  • markdown
  • code highlighting
  • it's "githubby"
@rossta
rossta / num_repeats.rb
Created June 16, 2015 01:04
Num repeats challenge
irb(main):089:0> def num_repeats(string)
irb(main):090:1> counts = {}
irb(main):091:1> string.each_char{|k|counts[k] ||=0; counts[k] +=1}
irb(main):092:1> counts.select{|k,v| v > 1 }.length
irb(main):093:1> end
=> :num_repeats
irb(main):094:0> num_repeats
ArgumentError: wrong number of arguments (0 for 1)
from (irb):89:in `num_repeats'
from (irb):94
@rossta
rossta / stacktrace.sh
Created June 22, 2015 14:07
Error connecting to solr on remote host
deploy@app_master:princess i-9e7a7b61 /data/platform/current $ bundle exec rake sunspot:reindex
No config found for ["New Relic", "license_key"]. Activate the services that provides 'New Relic' or remove the code that uses it.
Skipping progress bar: for progress reporting, add gem 'progress_bar' to your Gemfile
rake aborted!
RSolr::Error::Http: RSolr::Error::Http - 404 Not Found
Error: Not Found
Request Data: "<?xml version=\"1.0\" encoding=\"UTF-8\"?><delete><query>type:ActsAsTaggableOn\\:\\:Tag</query></delete>"
Backtrace: /data/platform/shared/bundled_gems/ruby/2.1.0/gems/rsolr-1.0.10/lib/rsolr/client.rb:283:in `adapt_response'
@rossta
rossta / solr.err.log
Created June 23, 2015 15:06
Solr error
SEVERE: Unable to create core: default
org.apache.solr.common.SolrException: Error initializing QueryElevationComponent.
at org.apache.solr.core.SolrCore.<init>(SolrCore.java:806)
at org.apache.solr.core.SolrCore.<init>(SolrCore.java:619)
at org.apache.solr.core.CoreContainer.createFromLocal(CoreContainer.java:1021)
at org.apache.solr.core.CoreContainer.create(CoreContainer.java:1051)
at org.apache.solr.core.CoreContainer$3.call(CoreContainer.java:634)
at org.apache.solr.core.CoreContainer$3.call(CoreContainer.java:629)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)