Skip to content

Instantly share code, notes, and snippets.

View mattantonelli's full-sized avatar

Matt Antonelli mattantonelli

  • 00:20 (UTC -04:00)
View GitHub Profile
@mattantonelli
mattantonelli / youtube-dl-audio-only.sh
Last active December 8, 2022 15:55
youtube-dl audio only
# List all available formats and download specific audio-only format
youtube-dl -F https://www.youtube.com/watch?v=xFjpTF4-PgI
youtube-dl -f 140 https://www.youtube.com/watch?v=xFjpTF4-PgI
# Download and convert to audio-only format
youtube-dl -x --audio-format m4a https://www.youtube.com/watch?v=xFjpTF4-PgI
@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_icons.md
Last active January 15, 2026 14:17
A brief and incomplete guide to the various categories of icons that can be extracted from the FFXIV game data
@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