Skip to content

Instantly share code, notes, and snippets.

View ferblape's full-sized avatar
🐧

Fernando Blat ferblape

🐧
View GitHub Profile
@ferblape
ferblape / app.js
Created December 6, 2011 12:24
Actuable Websockets using Node.JS
var cluster = require('cluster');
if (cluster.isMaster) {
for (var i = 0; i < 3; i++) {
cluster.fork();
}
cluster.on('death', function(worker) {
console.log('worker ' + worker.pid + ' died');
# key_buffer = 16M
key_buffer = 128M
# max_allowed_packet = 16M
max_allowed_packet = 32M
thread_stack = 128K
thread_cache_size = 8
myisam-recover = BACKUP
# table_cache = 512
table_cache = 1024
#thread_concurrency = 10
@ferblape
ferblape / filter.rb
Created May 16, 2012 16:10
Filter slow queries from Rails log file
# Usage:
# cat <environment>.log | grep Load | grep SELECT | ruby filter.rb
MAX_TIME = 30.0
h = {}
STDIN.read.split("\n").each do |line|
list = line.split(' ')
time = list[2].match(/\d+\.\d+/)[0].to_f
@ferblape
ferblape / gist:3302799
Created August 9, 2012 09:54
VacaPicada.rb

VacaPicada.rb

Every friday a bunch of Madrilean rubysts have lunch together at the second best burger joint in the city, La Vaca Picada (info and map).

Join us! (2012/08/10)

Let us know (before 13h) if you're joining us so we can make a proper reservation. The reservation will be at 14:00h. Comment in this gist with your nickname to sign up:

  • @ferblape
  • @rnaveiras
@ferblape
ferblape / gist:3314376
Created August 10, 2012 13:57
La mejor hamburguesa de Madrid™
  1. Alfredos
  2. Madcafé
  3. New York Burger
  4. Homeburger
  5. San Wich
  6. La vaca picada
 _____ 
@ferblape
ferblape / gist:4194884
Created December 3, 2012 12:57
toldo python filter
if request.header['User-Agent'] == 'Python-urllib/2.1'
render :text => "http://images3.wikia.nocookie.net/__cb20111221151513/inciclopedia/images/f/f3/Rick_astley.gif"
end
@ferblape
ferblape / instal.sh
Created March 10, 2013 19:06
Install Ruby 1.9.3-p392 and chef-solo in Ubuntu 12.04.x
#!/bin/bash
export DEBIAN_FRONTEND=noninteractive
aptitude update &&
apt-get -o Dpkg::Options::="--force-confnew" -y -fuy dist-upgrade &&
# Install base packages
apt-get remove -y nano &&
apt-get install -y gcc g++ make zlib1g-dev git-core libxml2-dev libxslt-dev libopenssl-ruby\
libsqlite3-dev sqlite3 autoconf imagemagick curl libssl-dev\
libcurl4-openssl-dev libreadline6-dev libncurses5-dev openntpd\
@ferblape
ferblape / hangouts.scpt
Created October 24, 2013 05:45
Google Hangouts - the hard way
tell application "Google Chrome"
activate
set theUrl to "https://plus.google.com/hangouts/_/"
if (count every window) = 0 then
make new window
end if
tell window 1 to make new tab with properties {URL:theUrl}
@ferblape
ferblape / gist:e39352d1fde781d8d2f4
Last active August 29, 2015 14:05
Logstash query language

Elastic search query language documentation

Summary

  • equal operator is :client_ip:xxx.xxx.xxx.xxx AND http_verb:POST

  • comparation operators should be placed after the :client_ip:xxx.xxx.xxx.xxx AND http_status_code:>=400

@ferblape
ferblape / data-links.md
Last active August 29, 2015 14:06
Datos en hojas de cálculo del gobierno de Aragón (opendata.aragon.es)