2crows
3blackcrows
3inside
3linestrike
3outside
3starsinsouth
# gem 'pg' | |
# https://github.com/ged/ruby-pg | |
# http://deveiate.org/code/pg | |
# | |
# I always find it a nightmare to look up how it works because | |
# it's not intuitive at all. So here are some notes. | |
# CONNECTION | |
# ========== | |
# No connection URL support, so.. |
#!/bin/bash | |
# | |
# Backs up my entire website, in case Tumblr or CloudApp goes down someday. | |
# Last time I ran this, it took 18 minutes. | |
# | |
wget \ | |
--mirror `# turns on recursion and timestamping, basically says we want to "mirror" the whole site` \ | |
--convert-links `# after download, convert all links to point to localhost` \ |
put.your.domain.here { | |
@local { | |
file | |
not path / | |
} | |
log { | |
output file /var/log/caddy/mastodon.log | |
} |
source "https://rubygems.org" | |
gemspec |
# Channel | |
class CommentsChannel < ApplicationCable::Channel | |
def self.broadcast_comment(comment) | |
broadcast_to comment.message, comment: CommentsController.render( | |
partial: 'comments/comment', locals: { comment: comment } | |
) | |
end | |
def follow(data) | |
stop_all_streams |
require 'tempfile' | |
# The DSL class. The render method simply takes a block, then executes the block in the scope of the DSL class. You can see | |
# a use of it in the next file. | |
module Keyd | |
class DSL | |
def self.render(&block) | |
d = new | |
d.instance_exec(&block) |
-- based on https://www.crunchydata.com/blog/understanding-postgres-iops | |
SELECT | |
interval '1 millisecond' * total_exec_time AS "Total Exec. Time", | |
to_char ( | |
(total_exec_time / sum(total_exec_time) OVER ()) * 100, | |
'FM90D0' | |
) || '%' AS "Proportional Exec. Time", | |
to_char (calls, 'FM999G999G999G990') AS "Calls", | |
interval '1 millisecond' * (blk_read_time + blk_write_time) AS "Time Spent on IO", |
At the time of writing this article, PostgreSQL 17 is nearly out. On September 5th, the first release candidate was published. The final release is expected on September 26th, but we can already explain why we’ve been eagerly awaiting this release since 1 year.
At Lifen, we’ve loved Rails from the beginning. We have several Rails applications, each with different scopes and teams, all using PostgreSQL as the main database. Some of these applications handle a significant amount of traffic, and their databases need to be properly monitored. This is done by the infrastructure team and the developers themselves using PgAnalyze, Grafana and sometimes AWS console with "Performance Insight".
More than a year ago, we started monitoring the 95th and 99th percentile response times (p95, p99) on an endpoint that was experiencing timeouts. These p99 times were important because they involved a client with significantly mo
-- Carefull setup script is slow | |
-- SETUP SCRIPT :: START -- | |
DROP TABLE IF EXISTS docs; | |
CREATE TABLE docs ( | |
id SERIAL PRIMARY KEY, | |
type varchar(40) DEFAULT 'pdf' NOT NULL, | |
status varchar(40) NOT NULL, | |
sender_reference varchar(40) NOT NULL, | |
sent_at TIMESTAMPTZ, |