Skip to content

Instantly share code, notes, and snippets.

View mattantonelli's full-sized avatar

Matt Antonelli mattantonelli

  • 05:27 (UTC -05:00)
View GitHub Profile
@mattantonelli
mattantonelli / my.cnf
Created October 3, 2022 17:44
MariaDB performance tuning
[mysqld]
innodb_buffer_pool_size=1G # Default: 128M. Ideally, this is 80% of the available RAM
max_connections=301 # Default: 151. Increase for more concurrent connections if you have the resources.
query_cache_size=64M # Default: 0
# Check configuration of custom variables above
show variables like 'innodb_buffer%';
show variables like '%connections%';
show variables like '%query_cache%';
@mattantonelli
mattantonelli / item_code_generator.rb
Last active July 11, 2022 23:14
Generates completely fictional item codes that can be redeemed for absolutely nothing
a = ('A'..'Z').to_a + (1..9).to_a
5.times.map { 4.times.map { a.sample }.join }.join(' - ')
# "4H8Y - 3OQD - 9DO8 - 6WTW - KROI"
@mattantonelli
mattantonelli / logrotate
Last active July 13, 2022 14:10
logrotate configurations
# NGINX from source
/opt/nginx/logs/*.log {
su nginx nginx
weekly
dateext
dateformat .%Y-%m-%d
rotate 3
compress
delaycompress
create 0640 nginx nginx
@mattantonelli
mattantonelli / keepalive.ps1
Created November 9, 2021 18:29
Powershell keepalive
$wsh = New-Object -ComObject WScript.Shell
while (1) {
$wsh.SendKeys('+{F15}')
Start-Sleep -seconds 300
}
@mattantonelli
mattantonelli / ffxiv_icon_categories
Last active September 20, 2025 13:05
A brief and incomplete guide to the various categories of icons that can be extracted from the FFXIV game data
000000: actions
010000: status effects
020000: items
058000: fashions (small), bardings
059000: mount & minions (small)
060000: weather, map markers, market board, player markers, various icons
061000: event actions, markers, gods, pvp, custom deliveries, playstyles, various icons
062000: jobs, beast tribes, map stuff
063000: hunts, maps
064000: emotes, mount actions, roleplay actions
@mattantonelli
mattantonelli / new_mog_station.rb
Created August 13, 2021 14:54
Bulk update for new Mog Station sources #ffxivcollect
Armoire.where('name_en like ?', "Summer's Flame%").each { |armoire| armoire.sources.create!(type: SourceType.find_by(name: 'Premium'), text: 'Mog Station', premium: true) }
@mattantonelli
mattantonelli / reaction_contest.rb
Last active June 20, 2021 12:59
Generate a unique list of users who provided any reaction on a given Discord message
reactions = message.reactions.values.map(&:to_s)
reactions.flat_map { |reaction| message.reacted_with(reaction, limit: nil) }.map(&:distinct).uniq
@mattantonelli
mattantonelli / regex.md
Created June 10, 2021 14:32
Multilingual regex stuff (works in Ruby)
Alphabetical
\A[\p{L}]+\z
Alphabetical (with spaces)
\A[\p{L} ]+\z
@mattantonelli
mattantonelli / install_ngingx_passenger_centos8.md
Last active June 17, 2021 18:02
Basic setup for NGINX + Passenger + Rails/Sinatra on CentOS 8 w/ SELinux considerations

1. Set up the basics

sudo yum group install "Development Tools"
sudo yum install openssl-devel libcurl-devel
sudo mkdir -p /opt/rails/mycoolapp/shared
sudo chcon -R -h -t httpd_sys_content_t /opt/rails/
sudo useradd nginx
sudo chown -R nginx:nginx /opt/rails
sudo su - nginx
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
@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