Skip to content

Instantly share code, notes, and snippets.

View sodonnell's full-sized avatar

Sean O'Donnell sodonnell

  • Los Angeles, CA
View GitHub Profile
echo -e "<FilesMatch \\.php$>\n\tSetHandler \"proxy:fcgi://127.0.0.1:9000\"\n</FilesMatch>\n\n" >> /etc/httpd/conf/httpd.conf;
@sodonnell
sodonnell / install.awscli.sh
Created June 26, 2018 22:49
Install Python 3.4, pip3, and the latest AWS CLI tools on RHEL7.5
yum -y install python34 python34-pip
pip3 install --upgrade pip
pip3 install awscli
@sodonnell
sodonnell / test.pquery.pl
Created July 11, 2018 22:22
print pQuery->get($url)->title;
#!/usr/bin/perl
use strict;
use warnings;
# install pQuery:
# sudo cpanm pQuery;
use pQuery;
my $url = "https://github.com/sodonnell/plowbot/";
@sodonnell
sodonnell / f.u.amazon.rds.super.privs.sh
Created July 24, 2018 17:14
Amazon RDS doesn't like DEFINER statements from mysqldump when creating views. ^&*$^#*&$
sed -i 's/\/\*[^*]*DEFINER=[^*]*\*\///' dump2rds.sql
@sodonnell
sodonnell / postsuper
Created August 23, 2018 19:48
delete item(s) from postfix queue
mailq
postsuper -d $(mail_queue_id)
@sodonnell
sodonnell / myisam2innodb.sh
Created September 6, 2018 19:47
convert LIVE mysql tables from MyISAM to InnoDB via mysql cli
#!/usr/bin/env bash
#
# This was commented on the following page:
# https://dev.mysql.com/doc/refman/8.0/en/converting-tables-to-innodb.html
#
# This script/command was tested and found to be harmless/non-destructive, surprisingly. ;-P
#
DBNAME="exampledb";
DBHOST="localhost";
DBUSER="someguy";
@sodonnell
sodonnell / aws.rds.restore.snapshot.sh
Created September 6, 2018 19:58
Restore/Re-Deploy an Amazon RDS (MySQL) Database Instance from a specified snapshot.
#!/usr/bin/env bash
#
# Restore/Re-Deploy an Amazon RDS (MySQL) Database Instance from a specified snapshot.
#
# This script is intended to be run on an AWS EC2 instance
# within an isolated VPC infrastructure, to restore or re-deploy a
# test/staging database instance from a the latest
# 'production database' snapshot.
#
# This script requires the latest aws-cli program.
@sodonnell
sodonnell / nmap.sh
Last active May 30, 2019 00:34
basic nmap scanning argument iterations and logging
#!/usr/bin/env bash
#
# Run various nmap scans on a hostname and log all scans to a single file.
#
# Alternatively, nmap does support log-output arguments on it's own, but the problem is
# grouping various scans that often conflict during the same process, thus requiring
# a series of multiple scans and would create multiple logs.
#
# usage examples:
# default scan:
@sodonnell
sodonnell / ntpdate.sh
Created October 2, 2018 15:13
ntpdate - centos/rhel
#!/usr/bin/env bash
# install ntp service and sync w/ the pool
# why wasn't this done on these old servers. smh
yum -y install ntp;
chkconfig ntpd on;
service ntpd start;
date -R; ntpq -p; date -R;
ntpdate -q 0.ro.pool.ntp.org 1.ro.pool.ntp.org
@sodonnell
sodonnell / rds.hosts.sync.sh
Last active October 12, 2018 22:24
I really hate dealing with legacy systems. This feels so wrong, and should not exist, but here we are.
#!/usr/bin/env bash
#
# This script is a complete hack to work-around a crappy
# old Amazon EC2 instance running a custom CentOS AMI that
# was NOT provisioned by Amazon AWS engineers.
#
# This particular (bain of my existence) server uses
# Google's DNS servers in the /etc/resolv.conf file, but
# wreaks havoc on the PHP web application when trying to
# call mysqli_connect, and often times-out or takes far