Skip to content

Instantly share code, notes, and snippets.

View mattantonelli's full-sized avatar

Matt Antonelli mattantonelli

  • 03:01 (UTC -04:00)
View GitHub Profile
@mattantonelli
mattantonelli / automysqlbackup.md
Created April 7, 2021 18:15
Set up automatic MySQL/MariaDB backups with AutoMySQLBackup

1. Download and configure AutoMySQLBackup

mkdir /opt/automysqlbackup
cp /opt/automysqlbackup
wget https://sourceforge.net/projects/automysqlbackup/files/latest/download -O automysqlbackup.tar.gz
tar -xvf automysqlbackup.tar.gz
vim myserver.conf # Configure as needed

2. Create a script for running the backups

@mattantonelli
mattantonelli / archive_log.sh
Created February 18, 2021 14:23
Archive a logfile with a timestamped filename and gzip it
#!/usr/bin/env sh
#
# Purpose:
# Archive a logfile with a timestamped filename and gzip it
#
# Configuration:
# 1. Set the input and output paths below
# 2. Schedule a cron to execute this script
input=/my/log/alerts.log
@mattantonelli
mattantonelli / discord_interactions_webhook_rails.md
Created December 16, 2020 18:33
Discord interactions webhook implementation for Ruby on Rails

app/controllers/discord_controller.rb

class DiscordController < ApplicationController
  skip_before_action :verify_authenticity_token

  def interactions
    # Request signature verification
    begin
      verify_request!
 rescue Ed25519::VerifyError
@mattantonelli
mattantonelli / patch_5_4.log
Created December 8, 2020 13:13
FFXIV Collect update log for Patch 5.4.
Creating instances
Found new data for Akh Afah Amphitheatre (Hard) (20024):
name_en: Akh Afah Amphitheatre (Hard) → The Akh Afah Amphitheatre (Hard)
Found new data for Akh Afah Amphitheatre (Extreme) (20025):
name_en: Akh Afah Amphitheatre (Extreme) → The Akh Afah Amphitheatre (Extreme)
Created 13 new instances
Creating quests
Created 33 new quests
Creating achievement types
Creating achievement categories
@mattantonelli
mattantonelli / reverse_range.rb
Created November 13, 2020 00:23
A totally acceptable way of producing a reverse range in Ruby.
#!/usr/bin/env ruby
class CoolNum
attr :x
def initialize(x)
@x = x
end
def succ
@mattantonelli
mattantonelli / patch_5_35.log
Last active October 28, 2020 19:20
FFXIV Collect update log for Patch 5.35.
Creating instances
Created 0 new instances
Creating quests
Created 17 new quests
Creating achievement types
Creating achievement categories
Creating achievements
Created 53 new achievements
Creating titles
Created 8 new titles
@mattantonelli
mattantonelli / sequential_color_palette.md
Created September 18, 2020 12:34
Sequential color palette usable for things like ranking

Blue

  1. #1866B4
  2. #367DC4
  3. #5899DA
  4. #74ABE2
  5. #93BFEB
  6. #B2D4F5

@mattantonelli
mattantonelli / patch_5_31.log
Created September 8, 2020 20:37
FFXIV Collect update log for Patch 5.31.
Creating instances
Created 0 new instances
Creating quests
Created 9 new quests
Creating achievement types
Creating achievement categories
Creating achievements
Created 14 new achievements
Creating titles
Found new data for Saint of the Firmament… (488):
@mattantonelli
mattantonelli / bootleg_nginx_monthly_log_rotation.sh
Created August 21, 2020 21:03
Bootleg log rotation for NGINX. Retains at least one month of logs before they are overwritten.
cd /opt/nginx/logs
mv access_old.log.gz access_older.log.gz
mv access.log access_old.log
kill -USR1 `cat /var/run/nginx.pid`
sleep 1
gzip access_old.log
@mattantonelli
mattantonelli / ffxiv_hunts_to_csv.rb
Created August 20, 2020 21:46
Creates a CSV of hunt data for FFXIV based on the HTML extracted from https://ffxiv.ariyala.com/HuntMonsters
#!/usr/bin/env ruby
require 'csv'
require 'nokogiri'
doc = Nokogiri::HTML(open('hunts.html'))
csv = CSV.open('hunts.csv', 'wb') do |csv|
doc.css('.huntOverviewArea').each do |area|
csv << [area.css('.huntOverviewTitle').text]
area.css('.huntOverviewCell').to_a.reverse.each do |hunt|