This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $t = TransactionRecharge.order(:id).first.created_at + 1.month | |
| WINNING_TABLE_LOOKUP = {} | |
| def winning_rate_of(user) | |
| WINNING_TABLE_LOOKUP[user.id] || begin | |
| counts = MatchingResult.including(user).where('matching_id > ?', 1707043).group("winner_id = #{user.id}").count | |
| WINNING_TABLE_LOOKUP[user.id] = counts.empty? ? 0 : (counts['t'] || 0).to_f / counts.values.sum | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # resize_instance.sh | |
| # Resize specified instance with given size | |
| # resize_instance.sh [instance_id] [size] | |
| # This script is based on http://alestic.com/2010/02/ec2-resize-running-ebs-root | |
| E_BADARGS=65 | |
| if [ ! -n "$1" ] | |
| then |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var http = require('http'); | |
| var net = require('net'); | |
| var url = require('url'); | |
| var connections = {}; | |
| var subscriber = http.createServer(function(req, res){ | |
| params = url.parse(req.url, true); | |
| var channel = params.pathname; | |
| channel = channel.substr(1, channel.length - 1); | |
| if(params.query.callback){ |
NewerOlder