This file contains hidden or 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
# ssh-instance - function to let you SSH to an EC2 instance ID | |
# Written by Mike Babineau <[email protected]>. Original here: https://gist.github.com/mbabineau/319882/ | |
# Put this in ~/.profile and reload your terminal | |
function ssh-instance() { | |
if [ $# -lt 1 ] || [ $# -gt 3 ]; then | |
echo "Usage: ssh-instance [-r region] <instance id>" | |
else | |
case "$1" in | |
"-r") |
This file contains hidden or 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
# Install AWS CLI tools, https://github.com/aws/aws-cli/ | |
# Add these functions to ~/.bash_profile or ~/.profile | |
# Modify to fit specific needs such as adding a bastion proxy option. | |
# | |
# Usage examples: | |
# $ hostname_from_instance <instance-name> | |
# $ ip_from_instance <instance-name> | |
# $ ssh-aws <instance-name> | |
# |
This file contains hidden or 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
# Search through all databases, tables, and columns in a MySQL db. | |
# From http://kedar.nitty-witty.com/blog/search-through-all-databases-tables-columns-in-mysql | |
## Table for storing resultant output | |
CREATE TABLE `temp_details` ( | |
`t_schema` varchar(45) NOT NULL, | |
`t_table` varchar(45) NOT NULL, | |
`t_field` varchar(45) NOT NULL | |
) ENGINE=MyISAM DEFAULT CHARSET=latin1; |
This file contains hidden or 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 | |
for branch in `git branch -r | grep -v HEAD | grep -v master`; do | |
echo ${branch##*/} $branch | |
done | |
echo "Fetching..." | |
git fetch --all | |
echo "Pulling..." | |
git pull -v | |
echo "Results: Branches" | |
git branch -a |
This file contains hidden or 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 dump script. Requires a user .my.cnf file that includes the basic default | |
# username, password and host. | |
echo 'DB Name to Dump:' | |
read DBNAME | |
################################### | |
# Setup vars |
This file contains hidden or 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 | |
# Fill our vars and run on cli | |
# $ php -f db-connect-test.php | |
$dbname = 'name'; | |
$dbuser = 'user'; | |
$dbpass = 'pass'; | |
$dbhost = 'host'; | |
$connect = mysql_connect($dbhost, $dbuser, $dbpass) or die("Unable to Connect to '$dbhost'"); |
This file contains hidden or 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 | |
# Requires s3cmd be installed, http://s3tools.org/s3cmd | |
echo 'Enter the database name you would like to backup:' | |
read DBNAME | |
# Setup vars | |
TMP="/tmp" | |
DBUSER="root" |
This file contains hidden or 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
Download a copy of Mavericks from the Apple Store. It will save in your /Applications directory and will open once the download is complete. Just quit the installation. If you run the installer it will delete itself so move it to keep a copy. | |
Format an 8G+ (needs about 6G of space) USB stick with the 'Mac OS X Extended Journaled' format and leave it named 'Untitled' but be sure that you do not have another volume named "Untitled" or the next step could erase something! | |
Open the Terminal app and run the following command. This copies the resources over to the USB stick and makes it a bootable drive. Check the path, if you moved the file correct the paths. | |
sudo /Applications/Install\ OS\ X\ Mavericks.app/Contents/Resources/createinstallmedia --volume /Volumes/Untitled --applicationpath /Applications/Install\ OS\ X\ Mavericks.app --nointeraction | |
You should see something like the following, the "Copying installer files..." will take about 20 minutes with not progress indication. Just wait for it. |
This file contains hidden or 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
; RESOURCES | |
max_execution_time = 120 | |
max_input_time = 120 | |
memory_limit = 260M | |
; UPLOAD | |
file_uploads = 1 | |
;upload_tmp_dir = '/tmp' | |
upload_max_filesize = 150M | |
post_max_size = 150M |
This file contains hidden or 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
# Git Pull and Drush Feature revert all | |
* * * * * cd /var/www/example.com && /usr/bin/git pull --rebase > /var/www/example.com/deploy.log; /usr/bin/drush -y fra > /var/www/example.com/deploy.log 2>&1 | |
# Recompile Sass | |
* * * * * /bin/bash -c ". /home/webadmin/.bash_profile > /var/www/example.com/deploy.log 2>&1; cd /var/www/example.com/docroot/sites/all/themes/custom/example && /home/webadmin/.rvm/gems/ruby-2.1.0/bin/bundle exec compass compile > /var/www/example.com/deploy.log 2>&1" |