Skip to content

Instantly share code, notes, and snippets.

@mattfinlayson
mattfinlayson / gitty_up.rb
Created June 16, 2014 16:43
Prints a command line graph of when people commit: git log --pretty="format:%ai,%an"| ~/gitty.rb Assembled from an old 37signals post.
#!/usr/bin/ruby
require 'date';
people = {};
ARGF.each_line {
|l| time, author = l.split(',');
people[author] ||= Array.new(24, 0);
hour = DateTime.parse(time).hour;
people[author][hour] += 1;
@mattfinlayson
mattfinlayson / gitchurn.sh
Created June 16, 2014 16:41
See the most edited files in a git repository
#!/bin/bash
git log --all -M -C --name-only --format='format:' "$@" | sort -n | grep -v '^$' | uniq -c | sort | tail -n 10
{
"title": "Logstash Search",
"services": {
"query": {
"idQueue": [
1
],
"list": {
"0": {
"query": "*",
@mattfinlayson
mattfinlayson / config.yaml
Created December 10, 2013 23:02
Little ruby script to take the results of a jql query (advanced search) in jira and create todo item's for Cultured Code's Things App. I use it at the beginning of a sprint to keep track of my own work and progress. If I get less lazy I could always sync back in the other direction.
username: "fred"
password: "freds_password"
base_url: "https://jira.yourcompany.com"
jql_query: "assignee = \"fred\" AND project = NewProject AND status = Open"
@mattfinlayson
mattfinlayson / issue.py
Created June 5, 2013 19:54
Quick jira integration with python.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from jira.client import JIRA
import sys
import pprint
def connect_jira(jira_server, jira_user, jira_password):
'''
Connect to JIRA. Return None on error
@mattfinlayson
mattfinlayson / gist:3860715
Created October 9, 2012 18:57
Hubot local setup with XMPP
# Using node.js and npm build from http://nodejs.tchol.org
#
sudo yum install http://nodejs.tchol.org/repocfg/el/nodejs-stable-release.noarch.rpm
sudo yum install nodejs-compat-symlinks npm
sudo npm install -g coffee-script
cd /opt
git clone git://github.com/github/hubot.git && cd hubot
@mattfinlayson
mattfinlayson / autoproxy.rb
Created June 13, 2012 17:53
Using of to spin up a tiny proxy server in AWS.
#!/usr/bin/env ruby
require 'rubygems'
require 'fog'
ACCESS_KEY_ID='XXX'
SECRET_ACCESS_KEY='XXX'
ec2 = AWS::EC2::Base.new(:access_key_id => ACCESS_KEY_ID, :secret_access_key => SECRET_ACCESS_KEY)
@mattfinlayson
mattfinlayson / am.rb
Created June 13, 2012 17:51
right_aws example
#!/usr/bin/env ruby
require 'rubygems'
require 'right_aws'
require 'base64'
AMAZON_PUBLIC_KEY='XXX'
AMAZON_PRIVATE_KEY='XXX'
ec2 = RightAws::Ec2.new(AMAZON_PUBLIC_KEY, AMAZON_PRIVATE_KEY)
@mattfinlayson
mattfinlayson / gist:1677813
Created January 25, 2012 18:40
Your branch is ahead of 'origin/master' by 1 commit
I noticed that some of my Git repos give me nice status messages like "Your branch is ahead of 'origin/master' by 1 commit" whenever I do a git status while others do not.
I think it's because some of them weren't originally clones and had their "remote" configuration set up manually, but not completely in the way that you get when you run git clone with a recent version of Git. Whatever the cause was, here's the fix.
Here's a section of the .git/config file for a clone which does display the additional status information:
[remote "origin"]
url = git://github.com/rentzsch/mogenerator.git
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
@mattfinlayson
mattfinlayson / diff_dir.sh
Created January 25, 2012 18:32
Diff of Two Directories
diff -rq dir1 dir2