Skip to content

Instantly share code, notes, and snippets.

View serafane's full-sized avatar

Matt Antonelli serafane

  • 08:21 (UTC -05:00)
View GitHub Profile
@serafane
serafane / collection_popularity.rb
Created April 29, 2026 13:26
FFXIV Collect collection popularity
# All
counts = %w(achievements_count mounts_count minions_count orchestrions_count emotes_count bardings_count hairstyles_count armoires_count spells_count relics_count fashions_count records_count survey_records_count frames_count cards_count npcs_count leves_count facewear_count outfits_count occult_records_count)
total = Character.where('minions_count > 0').count.to_f
counts.each do |count|
name = count.split('_').first.capitalize
usage = Character.where("#{count} > 0").count
percentage = (usage / total) * 100.0
puts "#{name}: #{usage} (%.2f%%)" % percentage
end
@serafane
serafane / remote_ssh_vagrant_vm.md
Created July 3, 2025 18:19
VSCode Remote - SSH for Vagrant VM

VSCode Remote - SSH for Vagrant VM

  1. Navigate to your Vagrant box directory and run vagrant ssh-config
  2. Copy the output
  3. Navigate to %userprofile%\.ssh
  4. Paste the output in config (rename the host if you prefer)
  5. Navigate to the directory containing the IdentityFile from your config
  6. Open your shell and ensure the permissions are set to 600
  7. Paste the following in your VSCode settings JSON:
"remote.SSH.useLocalServer": true
@serafane
serafane / round_robin_task_assignment.rb
Last active January 30, 2025 13:55
Round robin task assignment. Files are simply line delimited tasks/developers.
tasks = File.readlines('./tasks.txt', chomp: true).sort.freeze
developers = File.readlines('./developers.txt', chomp: true).shuffle.freeze
tasks.each_with_index do |task, i|
puts "#{task} - @#{developers[i % developers.size]}"
@serafane
serafane / mariadb_backup_restore.cnf
Created November 21, 2024 17:05
Configure MariaDB to improve dump restore time
# /etc/my.cnf.d/mariadb-server.cnf
[mysqld]
innodb_buffer_pool_size = 4G # 50% RAM
innodb_log_file_size = 1G
innodb_flush_log_at_trx_commit = 0
innodb_doublewrite = 0
max_allowed_packet = 256M
# Load the dump, skipping uniqueness and foreign key checks
time mysql -u root -p -D my_database --init-command="SET SESSION FOREIGN_KEY_CHECKS=0; SET SESSION UNIQUE_CHECKS=0;" < dump.sql
@serafane
serafane / ruby_gem_passenger_nginx.service
Last active November 24, 2024 21:07
systemd service file for NGNIX installed via Ruby Passenger gem
[Unit]
Description=The NGINX HTTP and reverse proxy server
After=syslog.target network.target remote-fs.target nss-lookup.target
[Service]
Type=forking
PIDFile=/run/nginx.pid
ExecStartPre=/opt/nginx/sbin/nginx -t
ExecStart=/opt/nginx/sbin/nginx
ExecReload=/bin/kill -s HUP $MAINPID
@serafane
serafane / update_aws_cdk_python.sh
Created July 21, 2023 14:47
Update AWS CDK for Python
# We must update both the Python and NPM packages
pip install --upgrade aws-cdk-lib
npm install -g aws-cdk@latest
@serafane
serafane / ruby_322_centos_7.sh
Created July 21, 2023 14:43
Install Ruby 3.2.2 on CentOS 7
# Resolves the following error which occurs when Ruby does not like our GCC version:
#
# vm_core.h:1865:34: error: ‘ruby_current_ec’ undeclared (first use in this function)
# rb_execution_context_t *ec = ruby_current_ec;
#
# Install the Developer Toolset 7 package to obtain a more current version of GCC
sudo yum install centos-release-scl
sudo yum install devtoolset-7
@serafane
serafane / pyenv_311_openssl11.sh
Created February 16, 2023 13:36
Install Python 3.11 via pyenv on CentOS 7 with custom OpenSSL 1.1
sudo yum install gcc make zlib-devel bzip2 bzip2-devel readline-devel sqlite sqlite-devel openssl11-devel tk-devel libffi-devel xz-devel
git clone https://github.com/pyenv/pyenv.git ~/.pyenv
CPPFLAGS=-I/usr/include/openssl11 LDFLAGS=-L/usr/lib64/openssl11 pyenv install 3.11
@serafane
serafane / centos_setup
Created January 20, 2023 17:34
Various setup stuff for a fresh CentOS VM
sudo dd if=/dev/zero of=/swapfile count=2048 bs=1MiB
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
sudo vi /etc/fstab
/swapfile swap swap defaults 0 0
sudo yum group install -y "Development Tools"
sudo yum install -y gcc-6 patch bzip2 openssl-devel libyaml-devel libffi-devel readline-devel zlib-devel gdbm-devel ncurses-devel wget libcurl-devel tmux vim
@serafane
serafane / dump_rails_model.rb
Created December 2, 2022 14:05
Simple dump of specified columns for a Rails model
headers = %w(column1 column2 column3)
CSV.open('tmp/output.csv', 'wb') { |csv| csv << headers; MyModel.each { |app| csv << app.attributes.values_at(*headers) } }