Instantly share code, notes, and snippets.

View multi-address.nic.sh
#!/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
View ab.sh
ab -n 1000 -c 100 -k -H "Accept-Encoding: gzip, deflate" http://some.site.com/
View bash.batch.rename.sh
#!/usr/bin/env bash
for i in rc_*; do mv $i ${i/rc_/rc2_}; done
View siege.sh
siege -A "SiegeStressTest/1.0 (pwnd;)" -c 100 -r 100 -v https://someshittysite.com/
View rds.hosts.sync.sh
#!/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
View ntpdate.sh
#!/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
View nmap.sh
#!/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:
View aws.rds.restore.snapshot.sh
#!/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.
View myisam2innodb.sh
#!/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";
View postsuper
mailq
postsuper -d $(mail_queue_id)