This file contains 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
user = User.all[1] | |
date = '2012-11-11'.to_date | |
range = date.beginning_of_day..date.end_of_day | |
trades = user.trades.where(created: range).sales.sold.norefund | |
trades = trades.only(:payment, :num) | |
payment = 0 | |
num = 0 | |
nulls = [] | |
trades.each do |trade| | |
if trade.payment && trade.num |
This file contains 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
user = User.all[1] | |
date = '2012-11-11'.to_date | |
range = date.beginning_of_day..Time.parse('2012-11-11 11:00') # date.end_of_day | |
buyers = {} | |
user.trades.where(created: range, :pay_time.ne => nil).each do |trade| | |
buyers[trade.buyer_nick] = { city: trade.receiver_city, payment: 0, items: [] } unless buyers.has_key?(trade.buyer_nick) | |
buyer = buyers[trade.buyer_nick] | |
trade.orders.each do |order| | |
buyer[:payment] += order.payment | |
buyer[:items] << order.num_iid |
This file contains 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
user = User.all[1] | |
date = '2012-11-11'.to_date | |
range = date.beginning_of_day..date.end_of_day | |
trades = user.trades.where(created: range, status: 'WAIT_BUYER_PAY') | |
CSV.open("#{date.to_s}-trades.csv", "wb:GB18030", col_sep: ',') do |csv| | |
trades.each do |trade| | |
row = [ | |
trade.tid, | |
trade.payment, | |
trade.buyer_nick, |
This file contains 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
user = User.all[1] | |
date = '2012-11-11'.to_date | |
range = date.beginning_of_day..date.end_of_day | |
trades = user.trades.where(created: range, status: 'WAIT_SELLER_SEND_GOODS') | |
buyers = {} | |
trades.each do |trade| | |
buyers[trade.buyer_nick] = {} unless buyers.has_key?(trade.buyer_nick) | |
buyer = buyers[trade.buyer_nick] | |
trade.orders.each do |order| | |
buyer[order.num_iid] = {} unless buyer.has_key?(order.num_iid) |
This file contains 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
urls = ['http://adidas.tmall.com', 'http://asics.tmall.com', 'http://vans.tmall.com', 'http://skomart.tmall.com', 'http://lining.tmall.com'] | |
urls.each do |url| | |
Seller.sync(url) | |
end | |
urls = ['http://mentholatum.tmall.com', 'http://marubi.tmall.com', 'http://loreal.tmall.com', 'http://olay.tmall.com', 'http://nivea.tmall.com', 'http://xybc.tmall.com'] | |
urls.each do |url| | |
Seller.sync(url) | |
end | |
urls = ['http://jinliufu.tmall.com', 'http://jiuxian.tmall.com', 'http://jiujiajiu.tmall.com', 'http://gjwjl.tmall.com', 'http://yanghe.tmall.com', 'http://guoyujl.tmall.com', 'http://sutanjl.tmall.com'] | |
urls.each do |url| |
This file contains 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
<!DOCTYPE> | |
<html lang="en"> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | |
</head> | |
<body> | |
<form action="https://login.taobao.com/member/login.jhtml" method="post" accept-charset="GBK" target="_blank"> | |
<input type="text" name="TPL_username"> | |
<input type="password" name="TPL_password" > | |
<input type="hidden" name="action" value="Authenticator"> |
This file contains 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
def self.get() | |
@diskinfo = `df | grep rootfs | awk '{print $2,$4,$5}'` | |
@diskinfo = @diskinfo.split(' ') | |
@diskinfo_size = (@diskinfo[0].to_f / 1024 / 1024).round(2) | |
@diskinfo_free = (@diskinfo[1].to_f / 1024 / 1024).round(2) | |
@diskinfo_perc = @diskinfo[2].sub('%','') | |
@cpu_perc = `vmstat | awk '{print $13}'`.split("\n").last | |
@mem = `cat /proc/meminfo | grep Mem | awk '{print $2}'` |
This file contains 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
.DS_Store |
This file contains 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
# -*- encoding: utf-8 -*- | |
require 'csv' | |
require 'smsbao' | |
class SendCsv < Smsbao | |
def initialize(login, passwd) | |
@smser = Smsbao.new(login, passwd) | |
end | |
def import(csv_file, col_sep=',') # MAC下为; |
This file contains 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
// 模拟 | |
const byte PIN_ANALOG_X = A0; | |
const byte PIN_ANALOG_Y = A1; | |
// 数字 | |
const byte PIN_ANALOG_K = 0; | |
// X中轴,区间值 [515..518] | |
const int X_THRESHOLD_LOW = 515; | |
const int X_THRESHOLD_HIGH = 518; | |
// Y中轴,区间值 [518..520] | |
const int Y_THRESHOLD_LOW = 518; |