Skip to content

Instantly share code, notes, and snippets.

View ashfurrow's full-sized avatar

Ash Furrow ashfurrow

View GitHub Profile
@ashfurrow
ashfurrow / rails_console.rb
Created December 14, 2022 15:38
Script at the end of the m.t self-destruct
irb(main):026:1* def perform_total_query(domain)
irb(main):027:1* Follow.joins(:account).merge(Account.where(domain: domain)).count
irb(main):028:0> end
irb(main):026:0> inboxes = Account.inboxes
irb(main):026:0> zero_inboxes = inboxes.select {|i| perform_total_query(i.gsub("https://", '').gsub(
"http://", "").gsub("/inbox", "")) == 0} # lol whatever
irb(main):025:0> zero_inboxes.count
=> 12916
irb(main):026:0> inboxes.count
=> 14895
# Remove old followers
account = Account.find(1) # that's me babey
scope = account.followers.eager_load(:account_stat).reorder(nil)
scope.merge! Account.by_recent_status
scope.merge! Account.local
scope.merge! AccountStat.where(last_status_at: nil).or(AccountStat.where(AccountStat.arel_table[:last_status_at].lt(6.months.ago)))
scope.count # 13146

Database looks fine. Ends with this:

{"log":"LOG:  could not send data to client: Broken pipe\n","stream":"stderr","time":"2020-04-01T21:09:16.86734608Z"}
{"log":"FATAL:  connection to client lost\n","stream":"stderr","time":"2020-04-01T21:09:16.867349505Z"}
{"log":"FATAL:  canceling authentication due to timeout\n","stream":"stderr","time":"2020-04-01T21:09:16.867352182Z"}
{"log":"FATAL:  canceling authentication due to timeout\n","stream":"stderr","time":"2020-04-01T21:09:16.867354895Z"}
{"log":"FATAL:  canceling authentication due to timeout\n","stream":"stderr","time":"2020-04-01T21:09:16.867357632Z"}
// Hope you had a nice day!
@ashfurrow
ashfurrow / convert.rb
Created February 18, 2019 15:00
Converting TextExpander Exports to macOS shortcuts
#!/usr/bin/ruby
# Instructions:
# Go to https://app.textexpander.com/settings/export and download all the CSVs into the same directory as this script.
# TextExpander's Export doesn't produce valid CSV files (lol) so make sure to open them with Numbers and re-export them.
require 'csv'
plist = <<~PLIST
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
# Sometimes a user will realize they've been accidentally tooting with the wrong privay setting in a specific browswer or app, and they meant their posts to be private. This script does that.
# Hey, uh, admins? Don't do this, unless you *really* trust the user. Changing status privacy after the fact can be abused. See: https://github.com/tootsuite/mastodon/issues/3933
# Open a rails console.
ids = %w( PASTE_IDS_LIST )
statuses = ids.map { |i| Status.find(i) }
statuses.reject { |s| s.uri.include? "USERNAME" } # Check that all the statuses belong to the user
statuses.first.uri # Open in an incognito browser
statuses.first.update_attributes!(visibility: :private) # Test one status change
--- old 2018-09-08 10:53:00.000000000 -0400
+++ new 2018-09-08 10:53:09.000000000 -0400
@@ -12,8 +12,11 @@
<li>No xenophobia or violent nationalism.</li>
<li>No sexual depictions of children.</li>
<li>No holocaust denialism, no Nazi symbolism, no promotion of National Socialism.</li>
- <li>No stalking or harassment.</li>
+ <li>No stalking or harassment. In general, if someone asks you to stop interacting with them, then stop.</li>
+ <li>Posting (or threatening to post) other people's personally identifying information ("doxing").</li>
+ <li>Unwelcome sexual attention.</li>

This is an attempt to document the downtime that occurred on mastodon.technology on August 18, 2018 from roughly 10am to 3pm, Eastern Daylight Time. It's not hyper-accurate. Please contact @ashfurrow for any clarifications.

Ash sincerely apologizes for the downtime.

Timeline

  • August 17, 02:44 UTC (10:44PM EDT): the @announcements account posts notice of maintenance window for the following day. The maintenance window was described as two hours long, beginning at 14:00 UTC the next day.
  • August 18, beginning at roughly 14:10UTC, mastodon.technology experienced several periods of extended downtime. Site monitoring results are attached in a text file, as well as a screenshot of the site response time graph.
  • August 18, roughly 15:45 UTC, mastodon.technology came back online but with severe latency issues. See attached graph screenshot of site latency times. User experience was severely degraded.
  • August 18, roughly 19:88 UTC, mastodon.technology came back onlin