Skip to content

Instantly share code, notes, and snippets.

View seanf's full-sized avatar

Sean Flanigan seanf

  • Brisbane, Australia
View GitHub Profile
#!/bin/sh
# Tag revisions like this:
# $ git tag -a -m "Version 0.2" v0.2 HEAD
VF=VERSION-FILE
DEFAULT_VERSION=UNKNOWN
LF='
'
@seanf
seanf / settings.xml
Created July 26, 2011 01:25
Sample of ~/.m2/settings.xml for deployment to Zanata Cloudbees repo
<settings xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/settings-1.0.0.xsd">
<servers>
<server>
<id>cloudbees-private-snapshot-repository</id>
<username>user</username>
<password>pass</password>
<filePermissions>664</filePermissions>
@seanf
seanf / rmb.sh
Last active September 27, 2022 11:00
Remove Merged Branches From Git. Copied from http://stackoverflow.com/a/9739058/14379 based on http://rob.by/2013/remove-merged-branches-from-git
#!/bin/bash
current_branch=$(git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/')
if [ "$current_branch" != "master" ]; then
echo "WARNING: You are on branch $current_branch, NOT master."
fi
echo -e "Fetching merged branches...\n"
git remote update --prune
remote_branches=$(git branch -r --merged | grep -v '/master$' | grep -v "/$current_branch$")
@seanf
seanf / 81-thinkpad-dock.rules
Last active December 18, 2015 09:38
ThinkPad docking script (copied from http://www.thinkwiki.org/wiki/Docking_Solutions)
# save as /etc/udev/rules.d/81-thinkpad-dock.rules
KERNEL=="dock.0", ACTION=="change", RUN+="/usr/local/sbin/thinkpad-dock.sh"
@seanf
seanf / git-pr
Last active December 19, 2015 06:59
Push current branch to github, enable tracking and open the pull request page
#!/bin/bash
this_branch=$(git rev-parse --abbrev-ref HEAD)
github_project=https://github.com/zanata/zanata-server
base_branch=integration/master
read -p "Push branch \"$this_branch\" to github, enable tracking, and open pull request page (y/n)? " -n 1 -r choice
if [[ $choice =~ ^[Yy]$ ]]; then
git push -u origin $this_branch
xdg-open ${github_project}/compare/${base_branch}...${this_branch}
fi
@seanf
seanf / grapeConfig.xml
Created August 28, 2013 03:37
~/.groovy/grapeConfig.xml for Zanata development
<?xml version="1.0"?>
<ivysettings>
<settings defaultResolver="downloadGrapes"/>
<resolvers>
<chain name="downloadGrapes">
<!-- todo add 'endorsed groovy extensions' resolver here -->
<ibiblio name="local" root="file:${user.home}/.m2/repository/" m2compatible="true"/>
<filesystem name="cachedGrapes">
<ivy pattern="${user.home}/.groovy/grapes/[organisation]/[module]/ivy-[revision].xml"/>
<artifact pattern="${user.home}/.groovy/grapes/[organisation]/[module]/[type]s/[artifact]-[revision].[ext]"/>
@seanf
seanf / testargs4j.groovy
Last active December 21, 2015 20:38
args4j test in Groovy
@Grab(group='args4j', module='args4j', version='2.0.25')
import org.kohsuke.args4j.*
import org.kohsuke.args4j.spi.*
import static org.kohsuke.args4j.ExampleMode.ALL
public class Sample {
private boolean recursive
// @Option(name="-r", usage="Recursive", handler=BooleanOptionHandler.class)
@seanf
seanf / fixspace
Created October 1, 2013 01:54
Remove whitespace errors
#!/bin/bash
# Remove trailing whitespace per line
sed -i 's/[ \t]*$//' "$@"
#http://stackoverflow.com/questions/7359527/removing-trailing-starting-newlines-with-sed-awk-tr-and-friends
# Delete all trailing blank lines at end of file (only).
sed -i -e :a -e '/^\n*$/{$d;N;};/\n$/ba' "$@"
@seanf
seanf / zanata-table-fix-case.groovy
Last active September 27, 2022 11:00
zanata-table-fix-case.groovy: convert lower case Zanata table names back to their original (title) case in an SQL backup
#!/bin/env groovy
/*
* zanata-table-fix-case.groovy
*
* Unix filter script to convert lower case Zanata table names back to their original (title) case in an SQL backup
*
* Usage: zcat zanata_backup.sql.gz | zanata-tables-fix-case.groovy | gzip -c > zanata_backup.casefixed.sql.gz
*
* Version 3
* Date: 7 Nov 2013
@seanf
seanf / remove-zanata-host-specifics.sql
Created November 11, 2013 04:22
Scrubs host-specific server settings from a Zanata database
DELETE FROM HApplicationConfiguration WHERE config_key LIKE 'host.url';
DELETE FROM HApplicationConfiguration WHERE config_key LIKE 'piwik%';
DELETE FROM HApplicationConfiguration WHERE config_key LIKE 'log.email.active';
DELETE FROM HApplicationConfiguration WHERE config_key LIKE 'log.destination.email';