Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)
That's it!
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'' |
First, install nginx for mac with "brew install nginx". | |
Then follow homebrew's instructions to know where the config file is. | |
1. To use https you will need a self-signed certificate: https://devcenter.heroku.com/articles/ssl-certificate-self | |
2. Copy it somewhere (use full path in the example below for server.* files) | |
3. sudo nginx -s reload | |
4. Access https://localhost/ | |
Edit /usr/local/etc/nginx/nginx.conf: |
Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)
That's it!
Hide Application from Dock: | |
defaults write /Applications/Application.app/Contents/Info LSUIElement 1 | |
Show Application in Dock: | |
defaults write /Applications/Application.app/Contents/Info LSUIElement 0 | |
Adrian -
I appreciate that you spent time in writing this post. I know I've been up until 2am writing similarly long ones as well. I will take responsibility for having what is likely an irrational response (I blame Twitter for that) to the term "NoOps", but I invite you to investigate why that might be. I'm certainly not the only one who feels this way, apparently, and thus far have decided this issue is easily the largest distraction in my field I've encountered in recent years. I have had the option to simply ignore my opposition to the term, and just let the chips fall where they may with how popular the term "NoOps" may or may not get. I have obviously not taken that option in the past, but I plan to in the future.
You're not an analyst saying "NoOps". Analysts are easy (for me) to ignore, because they're not practitioners. We have expectations of engineering maturity from practitioners in this field of web engineering, especially those we consider leaders. I don't have any expectations from analysts,
Latency Comparison Numbers (~2012) | |
---------------------------------- | |
L1 cache reference 0.5 ns | |
Branch mispredict 5 ns | |
L2 cache reference 7 ns 14x L1 cache | |
Mutex lock/unlock 25 ns | |
Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
Compress 1K bytes with Zippy 3,000 ns 3 us | |
Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |
global | |
log 127.0.0.1 local0 info | |
maxconn 5000 | |
ulimit-n 10000 | |
defaults | |
log global | |
mode http | |
frontend pub-srv 0.0.0.0:8080 |
class TrapLoop | |
trap('TERM') { stop! } | |
trap('INT') { stop! } | |
trap('SIGTERM') { stop! } | |
def self.stop! | |
@loop = false | |
end | |
def self.safe_exit_point! |
#pragma comment (lib, "libuv.lib") | |
#pragma comment (lib, "ws2_32.lib") | |
#pragma comment(lib, "psapi.lib") | |
#pragma comment(lib, "Iphlpapi.lib") | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <assert.h> | |
#include "../../lib/libuv/include/uv.h" | |
#include "http_parser.h" |
import collections | |
import json | |
import redis | |
import threading | |
from tornado import gen | |
from tornado import ioloop | |
from tornado import web | |
from tornado.options import define | |
from tornado.options import options | |
import tornadoredis |