Skip to content

Instantly share code, notes, and snippets.

View tsabat's full-sized avatar

Tim Sabat tsabat

View GitHub Profile
@tsabat
tsabat / problem.md
Last active December 23, 2015 02:09

We ran an alter table today today that took down the DB. We failed over to the salve, and in the post-mortem, we discovered this in the mysql error.log

InnoDB: ERROR: the age of the last checkpoint is 90608129,
InnoDB: which exceeds the log group capacity 90593280.
InnoDB: If you are using big BLOB or TEXT rows, you must set the
InnoDB: combined size of log files at least 10 times bigger than the
InnoDB: largest such row.
@tsabat
tsabat / detach.md
Last active December 23, 2015 06:59
detach and mount volume

##Inside the instance

Make sure you're not in the volume, as that will prevent the detachment

cd ~

then grep for anything active on that instance

@tsabat
tsabat / crontab.md
Created September 19, 2013 03:27
stop all crons

dump and remove

crontab -l > cronfile.dat   # Save actual crontab file
crontab -r                  # Remove crontab file

restore

node-config requires an environment variable be set.

instead of me doing so at the env level, just put this before you var config = require('config');

process.env['NODE_CONFIG_RUNTIME_JSON'] = '/tmp/runtime.json';
@tsabat
tsabat / hi.md
Last active December 26, 2015 03:49
integrations routes and queues

##Caveat

I don't remember this stuff super-well, so there will be some vagaries here.

##Terms

  • queues: holding bins for json-formatted integrations
  • routes: processors for queues, explained here

##Topology

@tsabat
tsabat / unused.md
Last active December 27, 2015 00:09
Chef Delete Unused Nodes
knife node list  | \ 
grep app_ | \ 
grep "app_ec2-54-212-236-68.us-west-2\|app_ec2-54-202-44-36.us-west-2" -v | \
while read -r line ; do knife node delete $line -y; done
["https://rubytapas.dpdcart.com/subscriber/download?file_id=5344","https://rubytapas.dpdcart.com/subscriber/download?file_id=5341","https://rubytapas.dpdcart.com/subscriber/download?file_id=5337","https://rubytapas.dpdcart.com/subscriber/download?file_id=5335","https://rubytapas.dpdcart.com/subscriber/download?file_id=5316","https://rubytapas.dpdcart.com/subscriber/download?file_id=5083","https://rubytapas.dpdcart.com/subscriber/download?file_id=4934","https://rubytapas.dpdcart.com/subscriber/download?file_id=2893","https://rubytapas.dpdcart.com/subscriber/download?file_id=2886","https://rubytapas.dpdcart.com/subscriber/download?file_id=1646","https://rubytapas.dpdcart.com/subscriber/download?file_id=1641","https://rubytapas.dpdcart.com/subscriber/download?file_id=1630","https://rubytapas.dpdcart.com/subscriber/download?file_id=1627","https://rubytapas.dpdcart.com/subscriber/download?file_id=1620","https://rubytapas.dpdcart.com/subscriber/download?file_id=1617","https://rubytapas.dpdcart.com/subscriber/downl
@tsabat
tsabat / sudo.rb
Last active December 27, 2015 13:09
course = Course.find('biology')
#get post ids, stored as set
post_key_arr = Course.fetch('post_ids', course_id)
#warm cache
if post_arr
post_key_arr.each do |p|
post_arr << Post.fetch('id', p.id)
end
@tsabat
tsabat / factory.md
Last active December 28, 2015 01:39

i've been fighting with FactoryGirl to create unique user IDs, emails, etc. on the User object and other factories.

The pattern I've followed for my objects is shown in this user factory

Notice the sequences for UNs, emails:

sequence(:email) {|x| "user_#{x}@codepen.io"}
sequence(:username) {|x| "un_#{x}"}
sequence(:github_id) {|x| x}
@tsabat
tsabat / wtf.md
Last active December 28, 2015 05:59

we have this file structure:

app/services/payment/code_pen_subscription.rb
app/services/promo/promotion_expire.rb

and the modules/classes defined below.

###promotion_expire.rb