Skip to content

Instantly share code, notes, and snippets.

View MatiasFernandez's full-sized avatar

Matias Fernandez MatiasFernandez

View GitHub Profile
@MatiasFernandez
MatiasFernandez / haproxy.cfg
Last active July 30, 2020 18:06
Simple haproxy config example for local testing
global
log stdout format raw local0
defaults
log global
mode http
timeout connect 4s
timeout client 30s
timeout server 10s
option redispatch
option forwardfor
@MatiasFernandez
MatiasFernandez / http-server.rb
Created March 1, 2020 15:04
Basic Ruby Echo HTTP Server
#!/usr/bin/ruby
# run like ./http-server.rb 8000
require 'webrick'
server = WEBrick::HTTPServer.new(:Port => ARGV.first)
server.mount_proc '/' do |req, res|
puts req.header
puts req.body
@MatiasFernandez
MatiasFernandez / list_status_counters.sql
Last active May 7, 2021 20:11
MySQL: Useful queries to debug and optimize query execution
-- This is useful to see counters that are updated while executing the query. This provides useful information
-- about number of times the DB executed operations over indices or tables. It also provides information about
-- the sorting process. More info about counters: https://fromdual.com/mysql-handler-read-status-variables
-- ****** When you have enough permissions to flush server status counters ******
FLUSH STATUS;
-- QUERY TO ANALYZE
@MatiasFernandez
MatiasFernandez / mysql_locks.sql
Last active June 13, 2024 04:20
MySQL: Useful queries to debug locks
SHOW ENGINE INNODB STATUS;
-- Transactions waiting for a lock, including blocking transaction details
SELECT
waiting_trx.trx_id AS waiting_trx_id,
waiting_trx.trx_started AS waiting_trx_started,
waiting_trx.trx_state AS waiting_trx_state,
waiting_trx.trx_rows_locked AS waiting_trx_rows_locked,
waiting_trx.trx_rows_modified AS waiting_trx_rows_modified,
waiting_trx.trx_mysql_thread_id AS waiting_thread,
@MatiasFernandez
MatiasFernandez / mysql.sql
Last active May 7, 2021 20:10
MySQL: Useful queries
-- List running queries
SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST WHERE command = "Query" ORDER BY TIME DESC;
-- Indexes size
SELECT database_name, table_name, index_name, stat_value AS pages,
round(stat_value*@@innodb_page_size/1024/1024, 2) size_in_mb
FROM mysql.innodb_index_stats
WHERE stat_name = 'size'
ORDER BY 4 DESC;
@MatiasFernandez
MatiasFernandez / errores-a17.md
Created October 17, 2017 12:20
Clasificacion y priorizacion de errores y bugs - Agiles 2017 Chile

Clasificacion y priorizacion de errores y bugs - Ágiles 2017 Chile

Abstract

En esta charla cuento sobre un proceso que diseñamos, inspirados en la medicina, para clasificar y priorizar todos los errores que aparecen en nuestro sistema de forma inesperada. De forma de poder conocer el 100% de los errores que ocurren y poder tener feedback continuo sobre el estado del sistema, algo que es muy importante cuando se utiliza continuous deployment.

Slides: https://www.slideshare.net/Azagthot/clasificacion-y-priorizacion-distribuida-de-errores-y-bugs

Info adicional

@MatiasFernandez
MatiasFernandez / cd-agiles2017.md
Created October 15, 2017 19:31
Continuous Deployment sin equipos de QA ni de ops - Agiles 2017 Chile

Continuous Deployment sin equipos de QA ni ops - Ágiles 2017 Chile

Abstract

En esta charla cuento mi experiencia trabajando en un proyecto para una empresa de Estados Unidos en donde pasamos de un modelo de release train con releases diarios a continuous deployment con múltiples releases por día. Todo esto lo logramos sin tener ningun equipo de QA ni de operaciones, solo developers.

Slides: https://www.slideshare.net/Azagthot/continuous-deployment-sin-equipos-de-qa-ni-de-ops-80834132

Info adicional

@MatiasFernandez
MatiasFernandez / fetch_csv.rb
Last active October 3, 2018 14:22
Fetch remote CSV
def remote_csv(url)
CSV.new(open(url))
end
@MatiasFernandez
MatiasFernandez / script.rb
Created August 2, 2017 15:05
Edit schema migrations table
class SchemaMigration < ActiveRecord::Base; self.primary_key = :version; end
@MatiasFernandez
MatiasFernandez / changed_ruby_files.rb
Last active September 26, 2017 13:45
Git pre commit hook to run rubocop on modified files
force_skip = ['master', 'develop'].include? `git rev-parse --abbrev-ref HEAD`.strip
diff_files = []
# Note: ACMRTUXB is all file types except delete
diff_files.concat(`git --no-pager diff --name-only --diff-filter='ACMRTUXB' origin/develop...`.split(/\n/))
diff_files.concat(`git --no-pager diff --name-only --diff-filter='ACMRTUXB' --cached`.split(/\n/))
if force_skip || diff_files.empty?
# so that rubocop doesnt run any tests
puts '-v'