Skip to content

Instantly share code, notes, and snippets.

# To get a list of affected accounts
affected = []
bad_entry_count = 0
redis = Redis.current
Account.find_each do |account|
key = FeedManager.instance.key(:home, account)
values = redis.zrange(key, 0, -1)
bad = values.select { |val| val.include?('e') }
unless bad.empty?
@aschmitz
aschmitz / sample_load.sql
Created October 1, 2017 05:23
Loading a representative sample of data into a Mastodon database for migration tests
DO $$
DECLARE ratio float;
DECLARE statuses_count integer;
DECLARE conversations_count integer;
DECLARE notifications_count integer;
DECLARE media_attachments_count integer;
DECLARE oauth_access_tokens_count integer;
DECLARE stream_entries_count integer;
DECLARE favourites_count integer;
DECLARE mentions_count integer;
@aschmitz
aschmitz / check.js
Created June 9, 2013 15:28
This appears to leak something in Node.js 0.10.10. Requires the `heapdump` module, `npm install heapdump`.
var fs = require('fs');
var files = fs.readdirSync(__dirname).sort();
for(var fileOn = 0; fileOn < files.length; fileOn++) {
if (files[fileOn].indexOf('heapsnapshot') > -1) {
if (isLeaking(files[fileOn])) {
console.log('Still leaking.');
} else {
console.log('NOT leaking?');