Skip to content

Instantly share code, notes, and snippets.

View Sanne's full-sized avatar

Sanne Grinovero Sanne

View GitHub Profile
@Sanne
Sanne / jira
Last active September 26, 2015 10:57
Open JIRA from git branch
#!/bin/bash
# This script will look into the GIT commit log of the current directory, backwards since the branch
# from master, searching for references to JIRA issues of a set of known projects.
# It will then print URLs to all mentioned JIRA issues.
# Optionally (uncommnent one line) it could open all relevant issues in different tabs of a browser: this is useful
# in my workflow as I often want to comment and/or close the issues when merging work in upstream.
#
# Released under the WTFPL license version 2 http://sam.zoy.org/wtfpl/
#
# Copyright (c) 2011 Sanne Grinovero
@Sanne
Sanne / gitconfig
Last active September 27, 2015 11:48
gitconfig
[core]
editor = gedit
[merge]
tool = meld
[color]
ui = yes
[color "branch"]
current = yellow reverse
local = yellow
remote = green
@Sanne
Sanne / git-inspect
Created April 26, 2012 17:40
See differences between current branch and master [other branch]
#!/bin/bash
# Released under the WTFPL license version 2 http://sam.zoy.org/wtfpl/
# Copyright (c) 2012 Sanne Grinovero
if [[ $# -eq 0 ]]; then
rm -f *.patch && git format-patch -M80% -C80% master && gedit -w -s *.patch && rm *.patch
else
rm -f *.patch && git format-patch -M80% -C80% "$@" && gedit -w -s *.patch && rm *.patch
fi
@Sanne
Sanne / git-pull
Created May 3, 2012 12:24
Send a pull request from command line
#!/bin/bash
# Released under the WTFPL license version 2 http://sam.zoy.org/wtfpl/
#
# Copyright (c) 2012 Sanne Grinovero
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/\1/"
}
function git_project_id {
@Sanne
Sanne / git-deep-prune.sh
Created July 11, 2012 14:24
git-deep-prune
#!/bin/bash
# Script to loop on local and remote branches, to delete all those which are
# already merged in master.
# Assumes "origin" and "master" are your references: replace all occurrences
# of "origin" with the name of your personal remote.
#
# Careful with branches which should are meant as tags in the past!
#
# Inspired from http://devblog.springest.com/a-script-to-remove-old-git-branches
# Released under the WTFPL license version 2 http://sam.zoy.org/wtfpl/
@Sanne
Sanne / jenkins.appl
Last active December 13, 2015 22:08
BoxGrinder script: Jenkins machine for Hibernate
name: jenkins-hibernate
summary: Jenkins instance to run builds of Hibernate
version: 1
release: 1
os:
name: fedora
version: 17
password: yyy
hardware:
cpus: 4
@Sanne
Sanne / release.sh
Created June 8, 2013 11:33
Search release script
SHORT_VERSION="4.3"
FULL_VERSION="4.3.0.Final"
NEXT_FULL_VERSION="4.3.1-SNAPSHOT"
##
# When editing the rsync commands, always test then with a dry run (-n) !
##
# Upload documentation to jboss.org:
@Sanne
Sanne / git-update.sh
Last active January 16, 2017 18:17
git-update
#!/bin/bash
# Temporarily checks out the "master" branch, fetches updates from upstream,
# pushes a copy to "origin" to keep it in synch, and then returns to the original
# branch.
#
# Released under the WTFPL license version 2 http://sam.zoy.org/wtfpl/
#
# Copyright (c) 2014 Sanne Grinovero
requireBranchName() {
@Sanne
Sanne / gitPS1
Last active February 16, 2017 12:26
gitPS1
function parse_git_dirty {
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit, working tree clean" ]] && echo "*"
}
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1$(parse_git_dirty)]/"
}
export PS1="$(if (( EUID == 0 )); then echo '\[\033[01;31m\]\h'; else echo '\[\033[5;32m\]\u@\h \[\033[00m\]\w\[\033[01;32m\]$(parse_git_branch)\[\033[00m\]$ '; fi)"
#!/bin/sh
# version 20170828
# Backup script using rsync to create multiple snapshots of the source.
# A little known trick of rsync is to be able to run a three-way comparison,
# so to only transfer the diffs but store a full copy in a new directory,
# while comparing and hard linking to the previous snapshot.
# This allows to make many frequent snapshots at minimal network and storage
# impact.
#
# This version doesn't do any form of rotation: you'll eventually run out of space.