layout | title | tags | ||
---|---|---|---|---|
default |
My First Post Title |
|
my post content with a link
TNT Queries | |
-- select * from tntmatch t where not exists (select 'hi' from playermatch p where p.matchid = t.matchid); | |
-- select * from playermatch p where not exists (select 'hi' from tntmatch t where t.matchid = p.matchid); | |
-- select * from tntmatch t where (select count(matchid) from playermatch p where p.matchid = t.matchid) > 4; | |
--WRANK LINES WON (including own) | |
SELECT m.matchdate, p.username, pm.*, | |
(select count(playerid) from playermatch where matchid = pm.matchid) as pCt, (select ifnull(sum(`lines`),0) from playermatch where matchid = pm.matchid and wrank >= pm.wrank) as lines_won, (select group_concat(n.username) from playermatch b, player n where b.matchid = pm.matchid and n.playerid = b.playerid and b.playerid != pm.playerid) as opps |
_ = require "underscore" | |
mysql = require "mysql" | |
mongo = require "mongodb" | |
humanize = require "./lib/onpage_humanize" | |
server = new mongo.Server 'localhost', 27017, {auto_reconnect: true} | |
db = new mongo.Db 'harvest', server | |
db.open (err, mongo_connection) -> | |
console.log "err: ", err if err? |
# mongodb.conf | |
# Where to store the data. | |
# Note: if you run mongodb as a non-root user (recommended) you may | |
# need to create and set permissions for this directory manually, | |
# e.g., if the parent directory isn't mutable by the mongodb user. | |
dbpath=/vol/mongodb/data/ | |
#only accept requests from localhost |
{ "duration" : 175.408, "_id" : ObjectId("506dcaeb56017b931e000005") } | |
{ "duration" : 19.582, "_id" : ObjectId("506dcb0c56017b931e00000d") } | |
{ "duration" : 21.024, "_id" : ObjectId("506dcb3156017b931e000015") } | |
{ "duration" : 39.613, "_id" : ObjectId("506dccb76f7e0ee01f000005") } | |
{ "duration" : 15.782, "_id" : ObjectId("506dce321cd1d84821000005") } | |
{ "duration" : 16.306, "_id" : ObjectId("506dce621cd1d84821000010") } | |
{ "duration" : 15.606, "_id" : ObjectId("506dce931cd1d8482100001b") } | |
{ "duration" : 14.393, "_id" : ObjectId("506dcec71cd1d84821000026") } | |
{ "duration" : 14.81, "_id" : ObjectId("506dceff1cd1d84821000031") } | |
{ "duration" : 15.897, "_id" : ObjectId("506ddabd8d3d3c4225000005") } |
# logstash - aggregator instance | |
description "logstash aggregator instance" | |
pre-start script | |
mkdir -p /vol/logstash/log/ | |
end script | |
start on [2345] | |
stop on runlevel [06] |
# logstash - shipper instance | |
description "logstash shipper instance" | |
pre-start script | |
mkdir -p /mnt/logs | |
end script | |
start on [2345] | |
stop on runlevel [06] |
# Ubuntu upstart file at /etc/init/mongodb.conf | |
limit nofile 20000 20000 | |
kill timeout 300 # wait 300s between SIGTERM and SIGKILL. | |
pre-start script | |
mkdir -p /vol/mongodb/ | |
mkdir -p /vol/log/ | |
end script |
layout | title | tags | ||
---|---|---|---|---|
default |
My First Post Title |
|
my post content with a link
creds = require "./creds" | |
aws = require "aws-lib" | |
ec2 = aws.createEC2Client creds.key, creds.secret | |
ec2.call "DescribeVolumes", {}, (err, results) -> | |
console.error "err: ", err if err? | |
console.log "results: ", results |
1) | |
select e.name from Employees e, Employees b where e.bossID = b.EmployeeID and e.Salary > b.Salary | |
2) | |
select * from ( | |
select d.Name, e.Name, e.Salary, rank() over(partition by e.DepartmentID order by e.Salary DESC) as salRank from Departments d, Employees e where e.DepartmentID = d.DepartmentID) a where salRank = 1 | |
3) | |
select * from (select departmentID , count(*) as ct from Employees group by departmentID) where ct < 3 |