This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# This is the snippet that will be added to each file | |
includeGAString="<!--#include virtual=\"/includes/ga.inc\" -->" | |
#includeGAString="<script> | |
# (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ | |
# (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), | |
# m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) | |
# })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/local/bin/bash | |
numberOfRequestsValues="10 20 40" | |
concurrencyValues="1 2 4" | |
abCmd="/usr/local/sbin/ab" | |
for url in $(cat $1); do | |
echo "# $url" | |
echo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Slow requests grouped by function call | |
cat /var/log/php-fpm/www-slow.log | grep -A 1 script_filename | \ | |
grep -v script_filename | grep -v -e "--" | cut -c 22- | sort | uniq -c | sort -nr | |
## Slow requests grouped by minute | |
cat /var/log/php-fpm/www-slow.log | grep 'pool www' | \ | |
cut -d' ' -f2 | sort | cut -d: -f1,2 | uniq -c | |
## Top 25 1 minute groups of slow requests | |
cat /var/log/php-fpm/www-slow.log | grep 'pool www' | cut -d' ' -f2 | \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/php | |
<?php | |
$directory = $argv[1]; | |
$output_column_headings = array( | |
"Config File", | |
"Virtual Host", | |
"ServerName", | |
"DocumentRoot", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
cd /etc/postfix | |
sed -i 's/#relayhost = \[an.ip.add.ress\]/relayhost = [smtp.mailgun.org]:587/g' main.cf | |
echo >> main.cf | |
echo "smtp_sasl_auth_enable = yes" >> main.cf | |
echo "smtp_sasl_password_maps = static:USERNAME:PASSWORD" >> main.cf | |
echo "smtp_sasl_security_options = noanonymous" >> main.cf | |
echo >> main.cf | |
/etc/init.d/postfix restart |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## All IPs | |
egrep -o "[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}" | |
## Find a distinct list of file exts within a specified directory | |
find ./ -type f -name "*.*" -exec basename {} \; | rev | cut -d. -f 1 | sort | uniq | rev | |
## Find files with the supplied exts (linux) | |
find ./ -regextype posix-extended -regex ".*(mp3|mp4|pdf|PDF|doc|zip|ZIP|wav|gz)$" | |
## Find files with supplied exts (mac) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Converts a mysqldump file into a Sqlite 3 compatible file. It also extracts the MySQL `KEY xxxxx` from the | |
# CREATE block and create them in separate commands _after_ all the INSERTs. | |
# Awk is choosen because it's fast and portable. You can use gawk, original awk or even the lightning fast mawk. | |
# The mysqldump file is traversed only once. | |
# Usage: $ ./mysql2sqlite mysqldump-opts db-name | sqlite3 database.sqlite | |
# Example: $ ./mysql2sqlite --no-data -u root -pMySecretPassWord myDbase | sqlite3 database.sqlite |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import print_function | |
import sys | |
import re | |
parts = [ | |
r'(?P<host>\S+)', # host %h | |
r'\S+', # indent %l (unused) | |
r'(?P<user>\S+)', # user %u | |
r'\[(?P<time>.+)\]', # time %t | |
r'"(?P<request>.+)"', # request "%r" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
LOG_FILE=/var/log/snmp/mactrap.log | |
read host | |
read ip | |
ip=`echo $ip | cut -d"[" -f2 | cut -d"]" -f1` | |
while read oid value |
OlderNewer