Skip to content

Instantly share code, notes, and snippets.

View spalladino's full-sized avatar
🔷

Santiago Palladino spalladino

🔷
View GitHub Profile
@spalladino
spalladino / hub.gs
Last active August 29, 2015 14:10
Google Spreadsheets InSTEDD Hub
/**
* Adds a custom menu to the active spreadsheet, containing a single menu item
* for invoking the readRows() function specified above.
* The onOpen() function, when defined, is automatically invoked whenever the
* spreadsheet is opened.
* For more information on using the Spreadsheet API, see
* https://developers.google.com/apps-script/service_spreadsheet
*/
function onOpen() {
var spreadsheet = SpreadsheetApp.getActiveSpreadsheet();
@spalladino
spalladino / es.sh
Created January 21, 2015 15:53
Hit test in elasticsearch
# Create index
curl -XPUT localhost:9200/locations/
# Create mapping with field 'shape' as geo shape
curl -XPUT localhost:9200/locations/_mapping/location -d '
{
"location": {
"properties": {
"name": {
"type": "string"
@spalladino
spalladino / backup-poirot.sh
Created April 9, 2015 14:03
Backups all distinguished Poirot entries in a monthly index and deletes the individual per-day indices
#! /bin/bash
# Invoke using YYYY.MM of indices to backup
# exit on uncaught error
set -e
# non zero exit status on a pipeline causes the whole pipeline to fail
set -o pipefail
function backup_index {
@spalladino
spalladino / verboice-demo.js
Created July 4, 2015 18:50
Verboice API demo from node.js
var request = require('request');
var express = require('express');
var http = require('http');
var url = require('url');
// Parse command line options
var program = require('commander');
program
.version("1.0.0")
@spalladino
spalladino / mbuilder-demo.js
Last active August 29, 2015 14:24
Small mBuilder demo firing external trigger and requesting table data
// Small mBuilder demo firing external trigger and requesting table data
var request = require('request');
var http = require('http');
// Fire external trigger
var symptom = 'headache';
var message = 'Rest well';
var projectId = 278;
@spalladino
spalladino / bigdata.md
Last active January 15, 2024 20:36
Apuntes de clase de la materia Big Data dictada por Daniel Yankelevich en FCEN UBA en 2015 1C

Estructuras de datos probabilísticas

  • No devuelven la respuesta exacta, sino una estimación.
  • En algoritmos de streaming, suele ser mejor una respuesta aproximada en el momento a una exacta mucho más tarde

Set membership

  • Estructura Bloom filter para set membership, usa tiempo constante para add y query
  • Hashing (tomar un fingerprint de todos los datos) suele ser mejor técnica que sampling (leer solamente algunos datos al azar), ya que genera solo falsos positivos, no negativos
@spalladino
spalladino / keybase.md
Created August 31, 2015 15:21
Keybase proof

Keybase proof

I hereby claim:

  • I am spalladino on github.
  • I am spalladino (https://keybase.io/spalladino) on keybase.
  • I have a public key whose fingerprint is 2A1E 62DE 71BC 4FC5 08D1 4A61 DA26 E6C4 5CB6 8D15

To claim this, I am signing this object:

@spalladino
spalladino / mysql-docker.sh
Created December 22, 2015 13:47
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@spalladino
spalladino / database.yml
Last active June 20, 2017 17:58
Rake task to copy master development database into current database branch
<%
require 'config'
branch = `git rev-parse --abbrev-ref HEAD`.strip rescue nil
use_single_db = !Settings.db_per_branch || !branch || branch == 'master'
branch_spec = (use_single_db ? "" : "_#{branch}").underscore.gsub(/[\.\/\-]/, '_')
%>
development:
<<: *default
database: app_development<%= branch_spec %>
@spalladino
spalladino / letsencrypt.sh
Created January 20, 2016 15:24
Template for renewing a letsencrypt certificate in a docker nginx proxy via letsencrypt's docker image
#!/bin/sh
mkdir -p {{ proxy_dir }}/www/{{ domain }}
docker pull quay.io/letsencrypt/letsencrypt
docker run -it --rm --name letsencrypt \
-v "/etc/letsencrypt:/etc/letsencrypt" \
-v "/var/lib/letsencrypt:/var/lib/letsencrypt" \
--volumes-from {{ proxy_docker_container }} \