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 | |
# -*- sh -*- | |
: << =cut | |
=head1 NAME | |
Munin plugin to plot Linux CPU pressure - see: https://lwn.net/Articles/759781/ | |
=head1 CONFIGURATION |
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 | |
MYSQL="mysql --defaults-extra-file=/path/to/something.cnf" | |
# Find queries which have been running for longer than 1800 seconds. | |
for PID in $($MYSQL -BNe "SELECT id FROM information_schema.processlist WHERE command <> 'Sleep' AND info NOT LIKE '%PROCESSLIST%' AND command <> 'Killed' AND time > 1800" ) | |
do | |
#OUTPUT=$($MYSQL -NBe "SELECT id,time,command,info FROM information_schema.processlist WHERE id = $PID ") | |
#echo "Long running query output - $OUTPUT " |
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 | |
# Bash script to control a TPLink HS110 or HS100 smart plug. | |
# Usage: $0 -u username -p password -d "?" => list devices, and should output token. | |
# Usage: $0 -t <token> -d <device_id> -o off => turn off.. | |
# Usage: $0 -t <token> -d <device_id> -o off => turn on.. | |
# Default action is to turn the first device found off. |
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 | |
# Simple backup script for MySQL/MariaDB on a Debian/Ubuntu based server. | |
# You can run this as often as you like (hourly, daily, weekly). It contains locking to stop multiple executions at once. | |
# Dependencies: | |
# apt-get install lockfile-progs | |
## Begin config. |
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/python | |
# See https://gist.github.com/wryfi/3902757 | |
# Crude CPU usage thing for container(s). | |
import multiprocessing, os, re, sys, time | |
import getopt | |
cgroup_dir = '/sys/fs/cgroup/lxc/' |
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
SELECT table_schema, | |
table_name, | |
data_type, | |
( CASE data_type | |
WHEN 'tinyint' THEN 255 | |
WHEN 'smallint' THEN 65535 | |
WHEN 'mediumint' THEN 16777215 | |
WHEN 'int' THEN 4294967295 | |
WHEN 'bigint' THEN 18446744073709551615 | |
end >> IF(Locate('unsigned', column_type) > 0, 0, 1) ) AS MAX_VALUE, |
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
<?php | |
/* | |
INSTRUCTIONS: Use at your own risk. Backup your database before continuing. | |
1. Copy code to a file in the root of your website. | |
2. Change YOUR_SITE_ROOT to a value that makes sense. | |
3. Execute by visiting the page. Verify before/after results. | |
4. Change MAKE_CHANGES_TO_SITE to true and execute it again. | |
*/ |
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
<?php | |
/* | |
INSTRUCTIONS: | |
Use at your own risk. Backup your database before continuing. | |
1. Copy code to a file in the root of your website. | |
2. Change YOUR_SITE_ROOT to a value that makes sense. | |
3. Execute by visiting the page. Verify before/after results. | |
4. Change MAKE_CHANGES_TO_SITE to true and execute it again. |
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
<?php | |
/* Original effort: https://gist.github.com/Daniel15/5991193 */ | |
function last($arr) | |
{ | |
eval('list(' . str_repeat(',', count($arr) - 1) . '$result) = $arr;'); | |
return $result; | |
} | |
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/perl | |
use strict; | |
# Take in, e.g. : | |
# foobar.palepurple.co.uk IN SSHFP 1 1 9676BB7A92C7E11B90E9508A343A4CAE9888B43D"; | |
# foobar.palepurple.co.uk IN SSHFP 2 1 D4F49CE2195A0BF531275B889ED6ABFF2F24C2BC | |
# on standard input, and output the appropriate tinydns records for sshfp - | |
# e.g. | |
# :foobar.palepurple.co.uk:44:\001\001\226\166\273\172\222\307\341\033\220\351\120\212\064\072\114\256\230\210\264\075: | |
# :foobar.palepurple.co.uk:44:\002\001\324\364\234\342\031\132\013\365\061\047\133\210\236\326\253\377\057\044\302\274: |