Skip to content

Instantly share code, notes, and snippets.

View ianmariano's full-sized avatar

Ian Mariano ianmariano

View GitHub Profile
@ianmariano
ianmariano / git-close-branch
Last active December 18, 2015 21:59
Quick Git plugin to close a branch (return you to master and clean up your remote and local topic branches) when merged in a pull request. Place on your path and chmod a+x it. Use: git close-branch branchname
#!/bin/bash
usage() {
echo "Usage $0 branchname"
exit 1
}
if [ -z "$1" ]; then
usage
fi
@ianmariano
ianmariano / git-remote-prune-all
Last active December 18, 2015 15:49
Tired of pruning all your git remotes by hand? Put this on your path and chmod a+x it. Then, in your repo: $ git remote-prune-all
#!/bin/bash
all=`git remote`
echo "Pruning all remotes"
for r in $all; do
echo -n "$r... "
git remote prune $r && echo "done."
done
@ianmariano
ianmariano / git-svnauthors
Created June 6, 2013 14:48
Git plugin to list svn authors. Place in your path and chmod a+x it. Will output to the console.
#!/bin/bash
usage() {
echo "$0 usage:"
echo " $0 repo-url"
exit 1
}
if [ -z "$1" ]; then
@ianmariano
ianmariano / openssl-encrypt-snippets.md
Created March 29, 2013 14:47
openssl encryption snippet

Encrypt a file using AES-256-CBC

$ openssl enc -aes-256-cbc -e < *source-path* > *encrypted-file-path*

Decrypt a file using AES-256-CBC

$ openssl enc -aes-256-cbc -d &lt; *encrypted-source-path* &gt; *decrypted-file-path*
@ianmariano
ianmariano / ruby_noexec_wrapper
Created March 6, 2013 18:19
Missing ruby_noexec_wrapper? Put this script on your path and chmod a+x it.
#!/usr/bin/env ruby
original_file=ARGV[0]
ARGV.shift
$PROGRAM_NAME=original_file
require 'rubygems'
begin
require 'rubygems-bundler/noexec'
@ianmariano
ianmariano / chef-server
Last active December 14, 2015 13:29
/etc/init.d script for chef-server
#!/bin/bash
#
### BEGIN INIT INFO
# Provides: chef-server
# Required-Start: $local_fs $remote_fs $network
# Required-Stop: $local_fs $remote_fs $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Control the Chef Server
# Description: Control the Chef Server
@ianmariano
ianmariano / ec2-set-host-info
Created February 4, 2013 15:04
Autogenerate host information on ec2 on instance startup. Run from /etc/rc.local
#!/bin/bash
#
# Save somewhere and chmod o+x it and Run it from /etc/rc.local
# Modify and re-arrange as you see fit
#
# Change as appropriate
DOMAIN=local
USER_DATA=`/usr/bin/curl -s http://169.254.169.254/latest/meta-data/hostname`
@ianmariano
ianmariano / cassandra-service
Last active August 29, 2015 14:10
Firing up Cassandra, OpsCenter and a DataAgent locally on OS X for development. This has some presumptions like the install locations (change to suit your purposes). This also presumes these services have already been configured and run properly without resorting to this script. Add to your path and chmod a+x it.
#!/bin/bash
CASSANDRA_HOME=/opt/apache/cassandra
OPSCENTER_HOME=/opt/apache/opscenter
CASS_LOG_DIR=$CASSANDRA_HOME/logs
CASS_LOGFILE=$CASS_LOG_DIR/system.log
CASS_PIDFILE=$CASSANDRA_HOME/cassandra.pid
OPSCENTER_LOGFILE=$CASS_LOG_DIR/opscenter.log
@ianmariano
ianmariano / install-oracle-java-8-ubuntu
Created October 26, 2014 15:43
Install Oracle Java 8 Ubuntu
sudo add-apt-repository ppa:webupd8team/java
sudo aptitude update
sudo aptitude install oracle-java8-installer oracle-java8-set-default
@ianmariano
ianmariano / git-change-committer
Created June 19, 2014 21:46
Rewrite an author/committer in your git history. Place on your path and do: git change-committer name new_name new_email
#!/bin/bash
usage() {
echo "$0 usage:"
echo " $0 name new_name new_email"
exit 1
}
if [ "$#" -ne 3 ]; then
usage