Skip to content

Instantly share code, notes, and snippets.

@dexeonify
dexeonify / FFmpeg Cheat Sheet.md
Last active May 30, 2024 07:39
Some basic and frequently-used FFmpeg command lines compiled into one long gist.
@j-a4
j-a4 / email_mx_validator.rb
Last active May 25, 2018 19:23
Email MX validator for Mastodon
# Validates that MX record exists for domain to prevent typos and also block by MX servers
# Use by adding to app/models/user.rb
# validates_with EmailMXValidator, if: :email_changed?
# frozen_string_literal: true
require 'resolv'
class EmailMXValidator < ActiveModel::Validator
def validate(user)
domain = user.email.split('@', 2).last
mxs = Resolv::DNS.new.getresources(domain, Resolv::DNS::Resource::IN::MX).to_a.map { |e| e.exchange.to_s }