Skip to content

Instantly share code, notes, and snippets.

View plasticbrain's full-sized avatar

Mike Everhart plasticbrain

View GitHub Profile
@plasticbrain
plasticbrain / gist:9007765
Created February 14, 2014 19:45
Install Apache GeoIP module
$ sudo apt-get install libapache2-mod-geoip
$nano /etc/apache2/mods-available/geoip.conf
Uncomment "GeoIPDBFile" line
For WorldTrack, the file location is: /var/www/geoip.dat
You should store your .dat file OUTSIDE of your publicly accessible www dir
OR, use .htaccess to deny access to it:
@plasticbrain
plasticbrain / gist:9065764
Last active August 29, 2015 13:56
Installing IP2Location c library and apache module
$ sudo apt-get install autoconf gcc build-essential apache2-prefork-dev apache2-threaded-dev libtool
$ wget http://www.ip2location.com/downloads/ip2location-apache-5.0.0.tar.gz
$ tar xvfz ip2location-apache-5.0.0.tar.gz
$ wget http://www.ip2location.com/downloads/ip2location-c-6.0.2.tar.gz
$ tar xvfz ip2location-c-6.0.2.tar.gz
$ cd ip2location-c-6.0.2/
$ autoreconf -i -v --force
@plasticbrain
plasticbrain / _TEMPLATE_
Last active August 29, 2015 13:57
Apache vhosts template
<VirtualHost *:80>
ServerName domain.com
ServerAlias www.domain.com
ServerAdmin webmaster@localhost
DocumentRoot /var/www/domain.com/html
<Directory />
Options -Indexes +FollowSymLinks +MultiViews
@plasticbrain
plasticbrain / gist:11177904
Created April 22, 2014 12:52
Helpful MySQL Commands and Tips
## Show current number of open connections
SHOW STATUS WHERE `variable_name` = 'Threads_connected';
@plasticbrain
plasticbrain / monit.xml
Last active August 29, 2015 14:08
[M/Monit] XML that the Monit agent sends to the M/Monit collector
<?xml version="1.0" encoding="ISO-8859-1"?>
<monit id="d4e0fa0729268bdb7bd35be98bdf2d33" incarnation="1414691060" version="5.3.2">
<server>
<uptime>30</uptime>
<poll>120</poll>
<startdelay>0</startdelay>
<localhostname>dev</localhostname>
<controlfile>/etc/monit/monitrc</controlfile>
<httpd>
<address>192.168.1.104</address>
@plasticbrain
plasticbrain / Monit Service Types
Last active August 29, 2015 14:08
Monit Service Types
0 - Filesystem
1 - Directory
2 - File
3 - Process
4 - Host
5 - System
6 - Program (?)
7 - Fifo (?)
@plasticbrain
plasticbrain / useragents.csv
Created December 16, 2014 05:09
Random Useragents
We can make this file beautiful and searchable if this error is corrected: Unclosed quoted field in line 9.
useragent
"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/39.0.2171.65 Chrome/39.0.2171.65 Safari/537.36"
"Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.71 Safari/537.36"
"Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; Trident/6.0)"
"Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.114 Safari/537.36"
"Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; WOW64; Trident/7.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E)"
"Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; WOW64; Trident/7.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; BRI/1; .NET4.0E; McAfee)"
"Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; Trident/7.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; AskTbOVO2/5.17.6.42067; playbrytetoolbar_Playbryte)"
"M
--- a/arch/x86/kernel/entry_64.S
+++ b/arch/x86/kernel/entry_64.S
@@ -1259,7 +1259,7 @@ apicinterrupt3 HYPERVISOR_CALLBACK_VECTOR \
idtentry debug do_debug has_error_code=0 paranoid=1 shift_ist=DEBUG_STACK
idtentry int3 do_int3 has_error_code=0 paranoid=1 shift_ist=DEBUG_STACK
-idtentry stack_segment do_stack_segment has_error_code=1 paranoid=1
+idtentry stack_segment do_stack_segment has_error_code=1
#ifdef CONFIG_XEN
idtentry xen_debug do_debug has_error_code=0
@plasticbrain
plasticbrain / check-memory.sh
Last active September 23, 2015 23:09
check-memory for sensu
#!/bin/bash
#
# Evaluate free system memory from Linux based systems.
#
# Date: 2007-11-12
# Author: Thomas Borger - ESG
# Date: 2012-04-02
# Modified: Norman Harman - norman.harman@mutualmobile.com
#
# The memory check is done with following command line:
@plasticbrain
plasticbrain / check_disk.json
Created September 24, 2015 18:36
Sensu check for disks
{
"checks": {
"disk": {
"command": "/usr/local/bin/check-disk-usage.rb -w 85 -c 90",
"interval": 300,
"subscribers": [
"linux"
]
}
}