Skip to content

Instantly share code, notes, and snippets.

View plasticbrain's full-sized avatar

Mike Everhart plasticbrain

View GitHub Profile
@plasticbrain
plasticbrain / check_memory.json
Last active September 25, 2015 19:44
Sensu check for memory
{
"checks": {
"memory": {
"command": "/etc/sensu/plugins/check-memory.sh -w :::system.mem_warning|128::: -c :::system.mem_critical|64:::",
"interval": 15,
"subscribers": [
"memory"
]
}
}
@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 / AWS - EC2 - Change PEM Key
Created April 15, 2015 19:12
AWS - EC2 - Change PEM Key
1. From the AWS EC2 Console go to "Key Pairs" and generate a new key pair (eg: NewKey.pem); Download the generated pem key, and chmod it to 0666
2. Use the new pem key to generate a public key
$ ssh-keygen -y
When prompted, enter the path to NewKey.pem. This will generate NewKey.pub
Tip: Edit NewKey.pub and append the key's name so you can identify it easier in the next steps.
Just append a single space, then a tag/name for the key
--- 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 / 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
@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 / 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 / gist:49b07885914129150f16
Last active May 3, 2021 19:28
AWS - EC2 - Assign Multiple IPs to the Same Instance
1. Assign a secondary private ip to the instance
- Select the instance, then choose Actions > Mange Private IP Addresses
- In the Manage Private IP Addresses dialog box, Click "Assign new IP"
- Enter a specific IP address that's within the subnet range for the instance (or just leave the field blank to have it choose one for you)
- (Optional) Select Allow reassignment to allow the secondary private IP address to be reassigned if it is already assigned to another network interface.
- Click Yes, Update, and then click Close.
2. Add the new IP to the instance's network interface.
- SSH into the instance
- $ sudo ip addr add new.ip.address.here/20 dev eth0
@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 / _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