Skip to content

Instantly share code, notes, and snippets.

View mattantonelli's full-sized avatar

Matt Antonelli mattantonelli

  • 07:37 (UTC -05:00)
View GitHub Profile
@mattantonelli
mattantonelli / 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
@mattantonelli
mattantonelli / 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
@mattantonelli
mattantonelli / 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
@mattantonelli
mattantonelli / 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
@mattantonelli
mattantonelli / 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) } }
@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 / ffxiv_icon_categories
Last active September 17, 2024 22:43
A brief and incomplete guide to the various categories of icons found in a SaintCoinach UI dump https://github.com/xivapi/SaintCoinach
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