Skip to content

Instantly share code, notes, and snippets.

@aitor
aitor / gist:5933892
Last active Jun 13, 2020
Proposal for TEDxZaragoza 2013
View gist:5933892

Algorithms

  • Main topic: Algorithm based economies.
  • Estimated run time: 15 minutes.

Abstract

Stock market flash crashes. Time dilation. Dynamic pricing. Mass-customization of nonexistent products. Our world is becoming increasingly governed by algorithms.

An algorithm is a process or rules system automated by a computer program. Potentially very complex in behavior, these algorithms start with very simple instructions executed by the machine with the only limitations of its physical constrains, a set of constrains very different to ours.

@aitor
aitor / gist:1710365
Created Jan 31, 2012
Our role in a software-based civilization (temptative title)
View gist:1710365

What is to be a developer?

Coder, informatician, software artisan, digital craftsman, hacker… maybe we can't agree about the denomination of our work as we like to invent countless number of ways to call it but we don't -used to- have problems explaining what is its nature.

For that last 40 years we and the developers before us, have being struggling to discover how to make better, more flexible, more resilient software. But in all this time it was pretty clear that the product we were creating was made by lines of code, that the context for using it was that screen in front of us, the personal computer, and that the users of our work were very much other human beings. Even the biggest tipping point in the software industry -the creation of the Internet- to a large extent didn't change this.

Now look around you. Software is the mythological hydra turned digital, turned invisible, turned ubiquitous, turned anything and everything, anywhere and everywhere. The way software is constantly permeating through ou

@aitor
aitor / gist:1071887
Created Jul 8, 2011
Señores que han recibido dinerito europeo para proyectos cuya descripcion contiene un dominio web
View gist:1071887
[Aitor@Banba:~/Desktop/Datasets 12:47:32] Grep -I "\\.Com" Fondos\ Estructurales.Csv (+ textmate formatting)
Andalucia, 2008, 1.321,55 €, Pgv Reino Unido 2008 - Patrocinio Tesco.Com (Pu),Instituto Español De Comercio Exterior (Icex) (Mityc)
Andalucia, 2008, 4.308,96 €, Autoescuela Tartessos, S.L., Diseño Y Programacion Del Sitio Web Autoescuela Tartessos.Com
Andalucia, 2008, 12.000,00 €, Gente Notable, SL, Gentenotable.Com
Andalucia, 2009, 8.249,34 €, Mis Cargas.Com,"Almost the Quickest Users of Internet, S.L."
Andalucia, 2009, 11.318,73 €, Deskonekta.Com Viajes Y Eventos,Deskonekta Viajes Y Eventos Sll
Andalucia, 2009, 28.000,00 €, Tienda Virtual De Pantalones a Medida.Comercio Electronico.,Sdad Coop and Industrial Textil De Corte Y Confección (Cotex
Andalucia, 2009, 1.060,00 €, Ampliacion Servidor Dedicado Para Www.Luz84.Com En Datacenter,Tech-Luz Iluminacion S.a.U.
Andalucia, 2009, 16.139,99 €, Puesta En
@aitor
aitor / README.md
Created Oct 13, 2019 — forked from igorwwwwwwwwwwwwwwwwwwww/README.md
clickhouse-playground
View README.md

clickhouse-playground

capture logs:

heroku logs --tail -a travis-api-production | grep at=info | gsed -e 's/^\([0-9]*-[0-9]*-[0-9]*\)T\([0-9]*:[0-9]*:[0-9]*\)/date=\1 time="\1 \2" /' | lcut date time method path host request_id fwd dyno connect service status bytes > access.log

boot:

View taxid_validator.rb
# frozen_string_literal: true
class TaxidValidator < ActiveModel::EachValidator
VALID_FORMATS = {
nif: /^(\d{8})([A-Z])$/,
nie: /^[XYZ]\d{7,8}[A-Z]$/,
}.freeze
CONTROL_DIGIT_TABLE = %w[T R W A G M Y F P D X B N J Z S Q V H L C K E].freeze
CONTROL_DIGIT_NIE_MAPPING = {
View ruby_hook.rb
# Trigger a travis build
post "/push-webhook" do
uri = URI.parse("https://api.travis-ci.org/repo/your-org/your-repo/requests")
request = Net::HTTP::Get.new(uri.request_uri)
request["Content-Type"] = "application/json"
request["Accept"] = "application/json"
request["Travis-API-Version"] = "3"
request["Authorization"] = "token your-token"
View env.java
private Environment(String ip, String mac, String iccid, String imei,
String carrier, String device, String os, String androidId,
String localization) {
this.ip = ip;
this.mac = mac;
this.iccid = iccid;
this.imei = imei;
this.carrier = carrier;
this.device = device;
this.os = os;
View heroku.sh
#!/usr/bin/env bash
set -ex
# Pass in Heroku API token
token=$1
# We run this script in a stateless Docker image, so to make the script a bit
# cleaner, we just write out the credentials to a file that the Heroku Toolbelt
# knows to read.
View run.sh
> pip2.7 install otpsecure  
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
Collecting otpsecure
Requirement already satisfied: beautifulsoup4 in /usr/local/lib/python2.7/site-packages (from otpsecure) (4.8.0)
Requirement already satisfied: pycrypto>=2.6.1 in /usr/local/lib/python2.7/site-packages (from otpsecure) (2.6.1)
Requirement already satisfied: requests>=2.4.1 in /usr/local/lib/python2.7/site-packages (from otpsecure) (2.22.0)
Requirement already satisfied: soupsieve>=1.2 in /usr/local/lib/python2.7/site-packages (from beautifulsoup4->otpsecure) (1.9.2)
Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in /usr/local/lib/python2.7/sit
@aitor
aitor / authenticate_user_spec.rb
Last active Jul 23, 2019
Service / Usecase Objects in vanilla Ruby
View authenticate_user_spec.rb
describe AuthenticateManagerService do
subject(:context) { described_class.call(username, password) }
describe '.call' do
context 'when the context is successful' do
let(:username) { 'correct_user' }
let(:password) { 'magic' }
it 'succeeds' do
expect(context).to be_success