Skip to content

Instantly share code, notes, and snippets.

View tennessine's full-sized avatar
🐟
扫描二维码,加我为好友

爱吃猫粮的鱼 tennessine

🐟
扫描二维码,加我为好友
View GitHub Profile
@tennessine
tennessine / highlight_query.sh
Created January 3, 2017 03:40 — forked from anonymous/highlight_query.sh
This is a script to reproduce a highlighting issue with the text_phrase_prefix query
#!/bin/sh
curl -XPOST 'http://localhost:9200/example_index/'
curl -XPOST 'http://localhost:9200/example_index/example_type/_mapping?pretty=true' -d \
'{
"example_type": {
"Properties": {
"name": {
"type": "string",
@tennessine
tennessine / haproxy.cfg
Created November 19, 2016 04:15
Here's a sample WORKING haproxy config for websockets / socketio. We were able to get socketio working on an Amazon ELB with just one node, but when we added multiple nodes, we saw weird client issues. So, we decided to use HAProxy on Ubuntu 12.04 and spent significant time trying to get just the right configuration (haproxy.cfg). Note though th…
global
#debug
#daemon
log 127.0.0.1 local0
defaults
log global
option httplog
frontend unsecured *:80
#include <Servo.h>
Servo myservo;
const int servoPin = 9;
const int buttonPin = 12;
const int ledPin = 13;
void setup() {
myservo.attach(servoPin);
@tennessine
tennessine / server.js
Created December 14, 2015 10:36 — forked from tagr/server.js
Node.js/Express: Add Expires header to /images and /stylesheets directories
/**
* Module dependencies.
*/
var express = require('express')
, routes = require('./routes')
, user = require('./routes/user')
, http = require('http')
, path = require('path');
var express = require('express');
var redis = require('redis');
const serverType = process.argv[2];
const serverHost = process.argv[3];
const serverPort = parseInt(process.argv[4]);
const redisPort = 6379;
const redisHost = '127.0.0.1';
var express = require('express');
var redis = require('redis');
const serverType = process.argv[2];
const serverHost = process.argv[3];
const serverPort = parseInt(process.argv[4]);
const redisPort = 6379;
const redisHost = '127.0.0.1';
@tennessine
tennessine / gist:3e0e67d5d12ab6638009
Created May 22, 2014 09:39
Thrift: Bidirectional Async RPC
Source on GitHub: http://github.com/JoelPM/BidiThrift
A reader posted to the thrift-user mailing list wondering if it was possible for a Thrift RPC server to send messages to the client. The responses indicated that this could be accomplished by polling the server for updates or hosting another Thrift server in the client that could receive RPCs from the server (requires opening another port on the client and handling firewall issues). I responded with a technique I'd used for accomplishing something similar and the responses made me think maybe this would be worth writing up and posting some example code.
Here's my email to the mailing list that describes what I'm doing:
I think I've done something similar to what you're trying to do, and as long as you can commit to using only async messages it's possible to pull it off without having to start a server on the client to accept RPCs from the server.
When your RPC is marked as async the server doesn't send a response and the client doesn't try to read one.