Skip to content

Instantly share code, notes, and snippets.

View fabito's full-sized avatar

Fábio Franco Uechi fabito

View GitHub Profile
@fabito
fabito / gist:e0c1ab1d9d8ff8d1b5561884acd126ee
Created August 15, 2016 17:13 — forked from robinloxley1/gist:7ea7c4f37a3413b1ca16
sample elasticsearch query to sort parent based on child field
{
"query":{
"has_child":{
"query":{
"function_score":{
"functions":[
{
"field_value_factor":{
"factor":1,
"field":"count"
#!/usr/bin/python
import flac.encoder as encoder
import pyaudio
import sys
import requests
import random
from threading import Thread
from Queue import Queue, Empty
@fabito
fabito / Vagrantfile
Last active August 29, 2015 14:07 — forked from jklein/Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# All Vagrant configuration is done here. The most common configuration
# options are documented and commented below. For a complete reference,
# please see the online documentation at vagrantup.com.
import functools
import logging
from google.appengine.api import memcache
def cached(time=1200):
"""
Decorator that caches the result of a method for the specified time in seconds.
Use it as:
var socket = io.connect(window.location.host);
var received;
socket.on('data', function (data) {
received = JSON.parse(data);
});