Skip to content

Instantly share code, notes, and snippets.

@ehlertij
ehlertij / newrelic.user.js
Last active August 29, 2015 14:03
NewRelic Auto-expand top bar
// ==UserScript==
// @match https://rpm.newrelic.com/*
// @version 2
// ==/UserScript==
// a function that loads jQuery and calls a callback function when jQuery has finished loading
function addJQuery(callback) {
var script = document.createElement("script");
script.setAttribute("src", "//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js");
script.addEventListener('load', function() {
@ehlertij
ehlertij / windows_ec2_snapshot.bat
Last active August 11, 2017 01:24
Windows batch script for creating daily EC2 snapshots for a volume and deleting old ones.
set AWS_HOME=C:\AWS
set AWS_VOLUME=vol-12345678
set AWS_SNAPSHOT_KEEP=10
:: Create snapshot for this volume
CMD /C ec2-create-snapshot %AWS_VOLUME% -d "Daily Snapshot"
:: Find old snapshots for this volume, sort them by date desc
ec2-describe-snapshots -F "volume-id=%AWS_VOLUME%" -F "status=completed"|find /I "Daily Snapshot"|sort /R /+49>%AWS_HOME%\snapshots.txt

These instructions focus on performing Automation commands for our Node.js applications. Additional work is required to run the applications, and further work to run our Rails applications.

Prepare Laptop

Install Xcode and Command-Line Build Tools

Download and install the Xcode Command Line tools: https://docs.google.com/a/tstmedia.com/file/d/0B8_iK4kgomHFWFpQdm5PQ1lQZ0U

// ==UserScript==
// @match https://cloud.engineyard.com/*
// @version 2
// ==/UserScript==
// a function that loads jQuery and calls a callback function when jQuery has finished loading
function addJQuery(callback) {
var script = document.createElement("script");
script.setAttribute("src", "//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js");
script.addEventListener('load', function() {
@ehlertij
ehlertij / .bash_profile
Last active October 13, 2015 16:48
Set OSX terminal window to git repo name or current directory
# Set terminal window name to current git repo (and branch) or current directory
git-repo() {
git remote -v | grep '(fetch)' | grep -o "\/[a-z,A-Z,\_,\-]*\." | tail -1 | cut -c 2- | grep -o ^[a-z,A-Z,\_,\-]*
}
git-branch() {
git branch | grep \* | cut -c 3-
}
git-term() {
@ehlertij
ehlertij / .rvmrc
Created November 28, 2012 22:33
Faster Ruby
# Add this to the end of your ~/.rvmrc file
export RUBY_GC_MALLOC_LIMIT=60000000
export RUBY_FREE_MIN=200000
class UserController < ApplicationController
def show
@user = User.where("id = #{params[:user_id]}").first
end
end
@ehlertij
ehlertij / app_control.erb
Created October 11, 2012 19:55
EY Puma Recipes
#!/bin/bash
# Auto-generated by Chef; your changes will be overwritten!
# Pull in a full environment and include some configuration of said commands.
source /etc/profile
source /data/<%= @app_name %>/shared/config/env
source /data/<%= @app_name %>/shared/config/env.custom
# Ensure that we are running as the root user.
@ehlertij
ehlertij / boot.rb
Created October 9, 2012 17:14
Rails 3 set default server and port
# config/boot.rb
# Setting default port to 3010
require 'rails/commands/server'
module Rails
class Server
alias :default_options_alias :default_options
def default_options
default_options_alias.merge!(:Port => 3010)
end
@ehlertij
ehlertij / gist:3789021
Created September 26, 2012 16:29
Shrink Transaction Log
USE WSN_Forums
GO
ALTER DATABASE WSN_Forums SET RECOVERY SIMPLE
GO
DBCC SHRINKFILE('WSN_Forums_log',1)
GO
ALTER DATABASE WSN_Forums SET RECOVERY FULL
GO