AWS have released a new featue called CloudWatch Events, which lets you configure events fired by cloudwatch and direct them to SNS, Lambda functions, etc. Here's the blog post
Here's the motivational image:
# | |
# Simple query object for combining multiple redash queries | |
# | |
# Example usage: | |
# Find all users who have logged in in the last 8 weeks who have sent an email by analysing the logstash logs | |
# Then group the results by the week they signed up on and their emailed yes/no status | |
# | |
# import requery | |
# userQuery = 'SELECT * FROM user WHERE lastSeen > DATE_SUB(NOW(), INTERVAL 8 WEEK)' | |
# emailQuery = '{ "index" : "logstash-*", "query": { "query_string": { "query": "action:sendEmail" } }, "size" : 1000 } |
upstream redash { | |
server redash:5000; | |
} | |
server { | |
listen 80; | |
location / { | |
return 301 https://$host$request_uri; | |
} |
FROM ruby:2.3 | |
MAINTAINER [email protected] | |
# Install app dependencies | |
RUN apt-get update -qq && apt-get install -y \ | |
build-essential \ | |
libpq-dev \ | |
unzip \ | |
telnet \ | |
vim \ |
AWS have released a new featue called CloudWatch Events, which lets you configure events fired by cloudwatch and direct them to SNS, Lambda functions, etc. Here's the blog post
Here's the motivational image:
This is a sample of how to send some information to logstash via the TCP input in nodejs or python. It assumes the logstash host is on 10.10.10.100 and the TCP listening input is 9563.
The logstash.conf should look something like the sample file.
The log message should be a stringified JSON object with the log message in the @message field.
To use, run the node script node sendMessageToLogstash.js
, or the python script python sendMessageToLogstash.js
// Go encourages us to organize our code using goroutines and to use | |
// channels of channels to implement request-response semantics [1]. | |
// | |
// I have encountered far more instances that require acknowledgment | |
// than fully-fledged respones so I became curious whether channels | |
// of channels were indeed the best implementation strategy. | |
// | |
// In summary, yes, they are. These benchmarks demonstrate that | |
// channels perform better than mutexes, that condition variables are | |
// still clumsy, and that preallocation is a huge win when and if you |
In August 2007 a hacker found a way to expose the PHP source code on facebook.com. He retrieved two files and then emailed them to me, and I wrote about the issue:
http://techcrunch.com/2007/08/11/facebook-source-code-leaked/
It became a big deal:
http://www.techmeme.com/070812/p1#a070812p1
The two files are index.php (the homepage) and search.php (the search page)
-- show running queries (pre 9.2) | |
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query | |
FROM pg_stat_activity | |
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%' | |
ORDER BY query_start desc; | |
-- show running queries (9.2) | |
SELECT pid, age(clock_timestamp(), query_start), usename, query | |
FROM pg_stat_activity | |
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%' |
Dear Rubyists,
I just lost a contract because of my code in a Rails project.
The specific code in question is related to a "posting a comment" feature. Here are the details:
In this project, "posting a comment" does not simply entail inserting a row into the database. It involves a procedure to yes, insert a row, but also detect its language, check for spam, send emails, and "share" it to Twitter and Facebook. I believe this algorithm should be encapsulated. I do not believe it belongs in a controller or a model. I do not believe Active Record callbacks should be used.
The "senior developer", whom is the stake holder's right hand man, said this:
class SSEHandler(tornado.web.RequestHandler): | |
def initialize(self): | |
self.set_header('Content-Type', 'text/event-stream') | |
self.set_header('Cache-Control', 'no-cache') | |
def emit(self, data, event=None): | |
""" | |
Actually emits the data to the waiting JS | |
""" | |
response = u'' |