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
@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 / nvload
Created May 30, 2019 00:24
Automatically discover and enable NVIDIA Tesla K20/K20X GPU/CUDA devices on Red Hat Enterprise Linux (RHEL).
#!/bin/sh
#
# /etc/init.d/nvload
#
# This script was used to ensure all new/existing NVIDIA GPU/CUDA devices
# are loaded properly on an AMAX Tesla K20/K20X GPU Clustering platform,
# running Red Hat Enterprise Linux (RHEL).
#
# Author: Sean O'Donnell <sean@seanodonnell.com>
#
@sodonnell
sodonnell / siege.sh
Last active May 29, 2019 21:15
Stress Testing HTTP Services...
siege -A "SiegeStressTest/1.0 (pwnd;)" -c 100 -r 100 -v https://somerandomsite.com/
@sodonnell
sodonnell / ab.sh
Last active May 18, 2019 09:24
apache benchmark testing
ab -n 1000 -c 100 -k -H "User-Agent: Kamakazi/1.0 (https://ww2.kamakazi.pilot.io/)" https://some.site.com/
@sodonnell
sodonnell / putObject.php
Last active March 7, 2019 00:18
Using the AWS PHP SDK to upload files to S3 bucket using EC2 Instance Profile (IAM Role) Credentials
<?php
require_once 'vendor/autoload.php';
use Aws\Credentials\CredentialProvider;
use Aws\S3\S3Client;
$provider = CredentialProvider::instanceProfile();
$mprovider = CredentialProvider::memoize($provider);
$s3 = new S3Client([
@sodonnell
sodonnell / multi-address.nic.sh
Last active December 4, 2018 20:09
Configuring Multiple IP Addresses on a single Network Interface
#!/usr/bin/env bash
#
# There are many custom use cases that require
# assigning multiple 'virtual' IP addresses to
# a single network interface.
#
# One case in particular, is for developing web applications
# locally on a workstation, to support a project that has multiple
# sub-domains. In such a case, you would create virtual IP addresses
# to support virtul hosts in apache/nginx. You would then associate the
@sodonnell
sodonnell / bash.batch.rename.sh
Created October 23, 2018 15:00
Batch-renaming Files in Bash
#!/usr/bin/env bash
for i in rc_*; do mv $i ${i/rc_/rc2_}; done
@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
@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 / 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.