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
solso / human-web-overview.md
Last active Sep 13, 2019
Human Web Overview
View human-web-overview.md

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
solso / router.lua
Created Jun 12, 2013
router in lua
View router.lua
inspect = require "inspect"
MYROUTES = {
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
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
table.insert(t,string.sub(k2,2,string.len(k2)-1))
end
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 Exception.new("Wrong response code (#{response.code}) in request #{url}") if response.code!=200
document = Nokogiri::XML(response.to_str)
account = Hash.new
account["email"] = document.xpath("//users/user/email").text
@solso
solso / autossh.sh
Created Jul 26, 2012
Support material for blog post of redis replication
View autossh.sh
#!/bin/sh
## --- tunnel_to_master_redis
REDIS_MASTER=XYZ
REDIS_SLAVE_PORT=6280
AUTOSSH_POLL=300
AUTOSSH_PORT=20000
AUTOSSH_GATETIME=10
AUTOSSH_LOGFILE=/var/log/autossh/autossh.log
@solso
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
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.