Skip to content

Instantly share code, notes, and snippets.

@t-anjan
t-anjan / rename_db
Last active December 11, 2019 20:29 — forked from ryantm/rename_db
Shell script to rename a database, based on https://www.percona.com/blog/2013/12/24/renaming-database-schema-mysql/ - Please note you need to ensure you have access to MySQL via mysql_config_editor (https://www.percona.com/blog/2014/11/25/more-secure-local-passwords-in-mysql-5-6-and-up/).
#!/bin/bash
# Copyright 2013 Percona LLC and/or its affiliates
# @see https://www.percona.com/blog/2013/12/24/renaming-database-schema-mysql/
set -e
if [ -z "$3" ]; then
echo "rename_db <server> <database> <new_database>"
exit 1
fi
db_exists=`mysql -h $1 -e "show databases like '$3'" -sss`
if [ -n "$db_exists" ]; then
@t-anjan
t-anjan / azure_stripe_disks.sh
Created June 14, 2016 13:52
Azure RAID-0 Stripe Disks
#!/bin/bash
NODENAME=$(hostname)
MOUNTPOINT="/datadrive"
RAIDCHUNKSIZE=512
RAIDDISK="/dev/md127"
RAIDPARTITION="/dev/md127p1"
# A set of disks to ignore from partitioning and formatting
# config/initializers/paperclip.rb
# If you want to disable paperclip attachments to S3 in the development environment,
# remove the comments from the "if" condition below and restart the server.
#if Rails.env.staging? || Rails.env.production?
Paperclip::Attachment.default_options[:storage] = :s3
Paperclip::Attachment.default_options[:s3_credentials] = {
:bucket => "app-#{Rails.env}",
:access_key_id => '<ACCESS_KEY_ID>',
:secret_access_key => '<SECRET_ACCESS_KEY>'