Skip to content

Instantly share code, notes, and snippets.

@Kalisen
Kalisen / .bash_profile excerpt
Created July 2, 2016 14:52
update Java home under Windows to switch between different versions of JAVA
function setJavaHome {
JAVA_PATH="$1"
SED="sed -E \"s/(.*)(\/drives\/c\/Program Files\/Java\/[^\/]*\/bin)(.*)/\1${JAVA_PATH//\//\\\/}\/bin\3/g\""
PATH="$(echo "$PATH" | eval $SED)"
}
# java
alias j6="export JAVA_HOME='$JAVA6_HOME';setJavaHome '$JAVA6_HOME'"
alias j7="export JAVA_HOME='$JAVA7_HOME';setJavaHome '$JAVA7_HOME'"
alias j8="export JAVA_HOME='$JAVA8_HOME';setJavaHome '$JAVA8_HOME'"
@Kalisen
Kalisen / conflygurator.rb
Created June 11, 2014 00:50
Removes all pivotal campfire and tenXer hooks, add hipchat hooks for all repos
#! /usr/bin/env ruby
require 'httparty'
class Conflygurator
include HTTParty
# debug_output $stderr
TOKEN = 'github_application_token'
@Kalisen
Kalisen / AccessProxy.groovy
Last active December 31, 2015 13:59
Proxy for private method access
class AccessProxy {
private Object target
AccessProxy(Object target) {
this.target = target
}
Object invoke(String methodName, Object... args) {
final Method targetMethod = findDeclaredMethod(target.class, methodName, args.collect { it.class })
#!/bin/sh
APP_PROP="application.properties"
if [ -f "$APP_PROP" ]; then
GRAILS_VERSION=`awk -F'=' '/app.grails.version/ { print $2 }' $APP_PROP | tr -d '\r\n'`
else
GRAILS_VERSION=`cat ~/.grails/.active_version`
fi
if [ "--all" = "$1" ]; then
@Kalisen
Kalisen / inline-plugins
Created April 10, 2012 16:46
Activate/Deactivate external groovy config / for ex inline plugins
#!/bin/sh
cd ~/.grails
if [ "$1" == "help" ]; then
echo "HELP: no params for listing, 'activate' or 'ignore'"
elif [ "$1" == "activate" -o "$1" == "on" ]; then
if [ -z "$2" ]; then
for i in *-buildConfig.groovy.ignore; do mv "${i}" "${i%\.ignore}"; done
else
mv "${2}"-buildConfig.groovy.ignore "${2}"-buildConfig.groovy
fi
@Kalisen
Kalisen / gist:1934608
Created February 28, 2012 19:35
My .gitconfig
[user]
name = Tommy The Cat
email = [email protected]
[alias]
s = status
b = branch
bb = branch -a
c = checkout
co = checkout
@Kalisen
Kalisen / FunWithEncoding.groovy
Created February 7, 2012 00:55
Base N encoding
char[] chars36 = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
def encoded = encode36(1582069)
println encoded
def decoded = decode36(encoded)
println decoded
def encode36(long numerical) {
return encode(BigDecimal.valueOf(numerical), 36, "")
}
@Kalisen
Kalisen / up_plugin
Created December 29, 2011 01:22
list/upgrade plugin's version across all projects
#/bin/sh
PLUGIN_NAME=$1
PLUGIN_VERSION=$2
if [ -z "$1" -o "$1" = "-h" ]
then
echo Usage:
echo List usage of a plugin:
@Kalisen
Kalisen / git_report
Created July 29, 2011 18:46
Bash script producing a file summarizing the status of all local git repos
#!/bin/sh
REPORT_FILE=~/workspace/git_report.txt
BRANCH_CMD="git branch --no-color"
STATUS_CMD="git status --porcelain;git status | grep 'Your branch'"
echo "GIT REPORT" > $REPORT_FILE
function print_sep {
echo "=========================================================================================================================" >> $REPORT_FILE
}