Skip to content

Instantly share code, notes, and snippets.

View mattantonelli's full-sized avatar

Matt Antonelli mattantonelli

  • 04:12 (UTC -04:00)
View GitHub Profile
@mattantonelli
mattantonelli / patch_5_3.log
Created August 11, 2020 20:04
FFXIV Collect update log for Patch 5.3.
Creating instances
Found new data for The Copied Factory (30087):
name_fr: Réplique De L'usine Désaffectée → La Réplique De L'usine Désaffectée
Created 5 new instances
Creating quests
Found new data for The Perfect Prey (66357):
name_de: U'odhs Zweite Prüfung → U'odhs Große Prüfung
Found new data for A Sleep Disturbed (69301):
name_fr: La Légende De Thiuna → La Légende De Tiuna
Found new data for  Fire In The Forge (69380):
@mattantonelli
mattantonelli / sudoers_manage_services.sh
Created August 9, 2020 16:03
sudoers entries for allowing a service user to manage a systemd service
# sudo visudo
# ---
# Allow deployment user to manage sidekiq systemd service
# Commands must be executed with sudo, and it should not prompt the user for a password
myuser ALL= NOPASSWD: /bin/systemctl start sidekiq
myuser ALL= NOPASSWD: /bin/systemctl stop sidekiq
myuser ALL= NOPASSWD: /bin/systemctl restart sidekiq
@mattantonelli
mattantonelli / daterangerpicker.js
Last active July 24, 2020 16:01
JQuery script for initializing a daterangepicker. Replaces "cancel" with a "clear" functionality. Removes default value. https://www.daterangepicker.com/
$(function() {
$('.date-range').daterangepicker({
autoUpdateInput: false,
timePicker: true,
timePickerSeconds: true,
locale: {
cancelLabel: 'Clear',
format: 'YYYY-MM-DD HH:mm:SS'
}
});
@mattantonelli
mattantonelli / datetime_range_overlap.rb
Last active July 24, 2020 14:57
Check for overlapping datetime ranges + proof
#!/usr/bin/env ruby
require 'time'
require 'active_support'
require 'active_support/core_ext'
def overlap?(search_start, search_end, alert_start, alert_end)
puts '---'
puts "Search Range: #{search_start} - #{search_end}"
puts "Alert Range: #{alert_start} - #{alert_end}"
@mattantonelli
mattantonelli / nginx_unique_ip_count.sh
Last active August 1, 2021 17:58
Top 10 IPs making unique calls from NGINX logs
# This command expects the following log format:
# 1.2.3.4 - - [01/Aug/2021:00:00:16 -0400] "GET /news/all HTTP/1.1" 200 41188 "-" "Python/3.7 aiohttp/3.6.2"
cat /opt/nginx/logs/access.log | cut -f1 -d ' ' | sort | uniq -c | sort -n | tail -10
@mattantonelli
mattantonelli / failed_to_connect_to_bus.sh
Created June 29, 2020 18:58
Resolution for "Failed to connect to bus" error for systemd user services on CentOS 8
# Add this to your shell profile to resolve the following issue:
# $ systemctl --user status sidekiq
# Failed to connect to bus: No such file or directory
export XDG_RUNTIME_DIR=/run/user/`id -u`
@mattantonelli
mattantonelli / .irbrc
Last active April 29, 2021 19:05
Configuration for IRB. Fixes some of the lamer changes added in Ruby 2.7, among other things.
#!/usr/bin/ruby
require 'irb/completion'
require 'irb/ext/save-history'
IRB.conf[:SAVE_HISTORY] = 1000
IRB.conf[:HISTORY_FILE] = "#{ENV['HOME']}/.irb_history"
IRB.conf[:PROMPT_MODE] = :SIMPLE
IRB.conf[:USE_COLORIZE] = false
IRB.conf[:ECHO] = true
IRB.conf[:ECHO_ON_ASSIGNMENT] = true
@mattantonelli
mattantonelli / nginx.service
Last active March 2, 2022 20:44
A collection of useful systemd files. /etc/systemd/system
# /etc/systemd/user/nginx.service
[Unit]
Description=The NGINX HTTP and reverse proxy server
After=syslog.target network-online.target remote-fs.target nss-lookup.target
Wants=network-online.target
[Service]
Type=forking
PIDFile=/var/run/nginx.pid
ExecStartPre=/opt/nginx/sbin/nginx -t
@mattantonelli
mattantonelli / centos_python_basic.md
Created June 15, 2020 16:11
Setting up fresh CentOS 7/8 VMs for Python development
sudo yum install git
git clone https://github.com/pyenv/pyenv.git ~/.pyenv
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bash_profile
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bash_profile
echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n  eval "$(pyenv init -)"\nfi' >> ~/.bash_profile
exec $SHELL
sudo yum groupinstall 'development tools'
sudo yum install @development zlib-devel bzip2 bzip2-devel readline-devel sqlite sqlite-devel openssl-devel xz xz-devel libffi-devel findutils
pyenv install 3.8.2
@mattantonelli
mattantonelli / azure-functions-cli-centos.md
Last active May 13, 2020 13:07
A guide for installing Azure Functions CLI on CentOS 7.
  1. Install the necessary yum packages
yum install wget unzip libicu
  1. Download the latest linux release of azure-functions-core-tools.
wget https://github.com/Azure/azure-functions-core-tools/releases/download/2.7.2508/Azure.Functions.Cli.linux-x64.2.7.2508.zip