Skip to content

Instantly share code, notes, and snippets.

@trogau
trogau / cloudwatch_log_insights_mysql_slow_query_examples.md
Created April 8, 2024 04:20 — forked from qiangxue/cloudwatch_log_insights_mysql_slow_query_examples.md
CloudWatch Log Insights query examples for MySQL slow query log.

Filtering queries

Find slowest write queries

parse @message /Query_time: (?<queryTime>.*?) Lock_time: (?<lockTime>.*?) Rows_sent: (?<rowsSent>.*?) Rows_examined: (?<rowsExamined>.*?)\s(?<query>.*?)$/
  | filter @message like /(?i)insert/
  | sort queryTime desc
  | limit 10
@trogau
trogau / index.php
Last active September 23, 2020 03:30
Some scripts for BusyBox to parse out network interface stats and send them to a simple PHP setup for collection & use with Prometheus.
<?php
header("Content-Type: text/plain");
$data = file("data.txt");
$bytesRx = $data[0];
$bytesTx = $data[1];
?># TYPE modem_stats_bytesrx counter
modem_stats_bytesrx <?= $bytesRx ?>
# TYPE modem_stats_bytestx counter
modem_stats_bytestx <?= $bytesTx ?>
@trogau
trogau / Average.js
Created June 18, 2020 09:18 — forked from johnnoel/Average.js
JavaScript ES6 Classes for perceptual image hashing
import Colour from './Colour';
import Resample from './Resample';
/**
* Average hash for images
*
* @author John Noel <john.noel@chaostangent.com>
* @see http://www.hackerfactor.com/blog/index.php?/archives/432-Looks-Like-It.html
* @see https://github.com/jenssegers/imagehash/blob/master/src/Implementations/AverageHash.php
*/