When you need to get yourself out of an uncomfortable situation...
[alias]
panic-moonwalk = reset --hard
# back away!Launch an instance storage backed ec2 instance with the default ECS Optimized AMI (c3.* or m3.* family)
Map /dev/xvdcz to ephemeral0
SSH into it
# stop docker processes
docker ps -q | xargs docker stop
# stop dockerFor several weeks our production deployment (Express, Bookshelf/Knex -> MySQL) was randomly having queries fail resulting in 500 errors and server crashes.
The first issue is that the Knex library was using Pool2 slightly incorrectly, and when a ETIMEDOUT error occurred, it tried to release the pooled connection twice. This would create an exception which would crash express (unless you have a top level error handler defined in your express setup)
In this issue (myndzi/pool2#12 (comment)) filed on pool2 by the author of knex (tgriesser) the author of pool2 (myndzi) points out the error handling issue and created a fork of knex with the fix git+https://github.com/myndzi/knex#double-release
After installing the fix on my server, whenever ETIMEDOUT occured an error would be generated in the expected part of the code so that I could decide to retry the query or fail gracefully. Removing the ETIMEDOUT entirely would be
| define (require) -> | |
| FooStore = require './foo_store' | |
| ListeningMixin = require './listening_mixin' | |
| _getStateFromStores = -> | |
| ver: FooStore.ver() | |
| foo: FooStore.foo() | |
| React.createClass | |
| mixins: [ListeningMixin] |
| { | |
| "scope": "source.coffee", | |
| "completions": | |
| [ | |
| { "trigger": "propTypes", "contents": "propTypes: {}" }, | |
| { "trigger": "mixins", "contents": "mixins: [$1]" }, | |
| { "trigger": "statics", "contents": "statics: {}" }, | |
| { "trigger": "displayName", "contents": "displayName: '$1'" }, | |
| { "trigger": "getInitialState", "contents": "getInitialState: ->" }, |
| #!/usr/bin/env ruby | |
| require 'open-uri' | |
| require 'rexml/document' | |
| feed = open("http://devopsreactions.tumblr.com/api/read?num=50").read | |
| doc = REXML::Document.new feed | |
| posts = [] | |
| REXML::XPath.each doc, '//post' do |node| | |
| posts << node.attributes["url"] | |
| end |
| #! /usr/bin/env ruby | |
| require 'yaml' | |
| data = YAML.load(DATA) | |
| adjective = data["adjectives"].sample | |
| animal = data["animals"].select {|a| a.match(/^#{adjective[0]}/)}.sample | |
| puts "#{adjective} #{animal}" | |
| __END__ | |
| --- | |
| adjectives: | |
| - adorable |
| #!/usr/bin/env ruby | |
| require 'yaml' | |
| require 'active_support' | |
| RAILS_ROOT = File.expand_path(File.dirname(__FILE__) + '/../') | |
| files = Dir.glob("#{RAILS_ROOT}/config/locales/*.yml") | |
| locales = files.map{|f| File.basename(f, '.yml')} | |
| def flat_hash(hash, k = nil) |
# rails:attachBindings
fired when jquery-rails starts attaching bindings to links, forms etc.
# confirm
gives you the opprotunity to skip a confirm dialog by returning a falsy value
# confirm:complete
| function parse_git_branch() { | |
| git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1) /' | |
| } | |
| function get_git_color() { | |
| isred=`git status -s 2> /dev/null | egrep "^.[^? ]" | wc | awk '{print $1}'` | |
| isorange=`git status -s 2> /dev/null | egrep "^[^? ]" | wc | awk '{print $1}'` |