Skip to content

Instantly share code, notes, and snippets.

Josep M. Pujol solso

Block or report user

Report or block solso

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
solso /
Last active Sep 13, 2019
Human Web Overview

Human Web Overview

Konark Modi, Alex Catarineu, Philipp Claßen and Josep M. Pujol at Cliqz

*München, October 2016

[edited on October 2017]*

[edited on September 2019 to fix broken links and add reference to HPN paper]*

solso / router.lua
Created Jun 12, 2013
router in lua
View router.lua
inspect = require "inspect"
services = {
list = {
leaf = true,
callback = function(params) for k, v in pairs(params) do print("key: " .. k .. " value: " .. v) end end
View api-aggregator-positive-word.lua
User script that returns the word with highest positive emotional value.
It runs against the SentimentAPI REST AP. See blog entry for the full details.
return function()
local max_sentiment = 5
local params = ngx.req.get_query_args()
solso / get_query_args_extended.lua
Created Apr 11, 2013
extract nested params on query_string
View get_query_args_extended.lua
function get_query_args_extended()
args = ngx.req.get_query_args()
for k, v in pairs(args) do
t = {}
for k2 in string.gmatch(k, "%b[]") do
if #t > 0 then
-- it has nested params, needs to be transformed
first = string.sub(k,1,string.find(k,"%[")-1)
View example_account_info.rb
def api_call_account_read(domain, provider_key, account_id)
url = "https://#{domain}/admin/api/accounts/#{account_id}.xml?provider_key=#{provider_key}"
response = RestClient.get url
raise"Wrong response code (#{response.code}) in request #{url}") if response.code!=200
document = Nokogiri::XML(response.to_str)
account =
account["email"] = document.xpath("//users/user/email").text
solso /
Created Jul 26, 2012
Support material for blog post of redis replication
## --- tunnel_to_master_redis
solso / sentiment_api.rb
Created May 9, 2012
Active Docs for the Sentiment API (based on the Swagger specification)
View sentiment_api.rb
#!/usr/bin/env ruby
require 'rubygems'
require 'json'
require 'sinatra'
require './analyzer.rb'
class SentimentApi < Sinatra::Base
disable :logging
disable :raise_errors
disable :show_exceptions
solso / gist:1901280
Created Feb 24, 2012
Example of varnish configuration for 3scale, proxy only
View gist:1901280
# This is a the VCL configuration file for 3scale's varnish plugin.
# Default backend definition. Set this to point to the 3scale's
# backend.
# set the beresp.ttl in vcl_fetch to have a default global TTL
# you can define custom TTL via regular expresions
## the backend of your API
You can’t perform that action at this time.