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; | |
use warnings; | |
use Getopt::Long qw(:config no_ignore_case ); | |
my $replace = undef; | |
my $delete = undef; | |
my $help = 0; | |
GetOptions ( |
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 | |
# | |
# Obtained from: | |
# https://confluence.atlassian.com/display/ONDEMANDKB/Automatic+backups+for+JIRA+OnDemand | |
# and modified to include: | |
# - longer waiting period for backup to be created | |
# - S3 upload | |
# |
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
PYTHON_PATH=$(which python) | |
PSQL_PATH=$(which psql) | |
MYSQL_SCRIPT='mysql2file.py' | |
MYSQL_SERVER= | |
MYSQL_PORT=3306 | |
MYSQL_DATABASE= | |
MYSQL_USER= | |
MYSQL_PASSWORD= |
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/env python | |
from sys import argv | |
import csv | |
import MySQLdb | |
from MySQLdb import cursors | |
mysql_params = [argv[1], argv[2], argv[3], argv[4], argv[5]] | |
output_file = argv[6] | |
mysql_query = argv[7] |
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 | |
# If a fusefs connection has been lost, shutdown the server and optionally log the event to an S3 object. | |
# I use this AWS EC2 instances in auto-scaling groups. If it shuts down, it gets terminated by the ASG, and replaced with a fresh one. | |
# Might be some fringe cases in the error handling code that haven't been encountered or thought of. Hence, might not be 100% reliable, so use at your own risk | |
cd /root | |
# Create lock | |
lockfile='/root/fscheck.lock' |
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
DELIMITER $$ | |
CREATE PROCEDURE `sp_utility_deduplicate_column` (IN table_in VARCHAR(64), IN unique_in VARCHAR(64), IN nonunique_in VARCHAR(64), length_in INT(11)) | |
BEGIN | |
/* sp_utility_deduplicate_column | |
IN table_in The name of the table to execute deduplication on | |
IN unique_in The PRIMARY KEY for table_in (auto-incremented integer recommended) | |
IN nonunique_in The column that contains duplicated values (INDEX recommended) |
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 | |
if [ ! "$(which smartctl)" ] ; then | |
echo "smartmontools is not installed" | |
exit 1 | |
fi | |
logical=($(df | grep -Eo 'sd[a-z]')) | |
# This doesn't preserve the mountpoint of the raid device, but whatevs for now |
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
-- If your table is really large, and it very well may be if you've the need to rotate it, you'll want to make sure the column that holds the timestamp/date is indexed. | |
-- WARNING: This script incurs a write lock for the duration of the trigger recreation and table rename. If your application can't handle this, you might lose data! | |
-- Create our new skeleton table | |
CREATE TABLE x_copy LIKE x; | |
-- Replace the interval with the timespan of data you'd like to keep, or | |
-- replace this statement with one that stores an id in the local variable of which all higher will be retained | |
SELECT MIN(id) INTO @end_id FROM x WHERE created_at >= DATE(NOW()) - INTERVAL 3 WEEK; |
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/env python | |
# | |
# mysql2cassandra.py | |
# Dump a MySQL result set to file and then import into a Cassandra column family | |
# | |
# Configuration | |
# mysql_params [host, port, user, password, db] MySQL conenction parameters | |
# mysql_columns [colname, colname2, ...] Columns for building MySQL query | |
# The column that will hold values of the row key in the Cassandra column family must be first |
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 | |
db_user=username | |
db_pass=password | |
db_schema=schema | |
db_host=hostname | |
db_login="-h$db_host -u$db_user -p$db_pass " | |
# Dump BASE TABLES (not views) | |
echo "Dumping base tables..." |
OlderNewer