Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
BRANCH_NAME=$(git symbolic-ref --short HEAD)
BRANCH_NAME="${BRANCH_NAME##*/}"
if [[ "$BRANCH_NAME" =~ ^RCRM- ]]; then
sed -i -e "1s/^/+ $BRANCH_NAME: /" $1
fi
@martinufo
martinufo / change-jdk.groovy
Created January 9, 2015 11:08
Change all projects' JDK in Jenkins
def h = Jenkins.getInstance()
def p = h.getProjects()
j = h.getJDK("JDK 7")
println(j)
for (n in p) {
n.setJDK(j)
println(n.getName() + " " + n.getJDK())
}
@martinufo
martinufo / set_readahead.sh
Created November 5, 2014 08:06
Set readahead on all block devices
blockdev --report | tail -n +2 | awk '{ if ($2 != 256) print $7 }' | xargs -r -l1 blockdev --setra 256
# Shell script to download Oracle JDK from command prompt / terminal.
# You can download all the binaries one-shot by just giving the BASE_URL.
## Features:
# Resumes a broken [previous] download, if any.
# Renames the file to a proper name with platform adding platform info.
# Downloads all the following from Oracle Website with one shell invocation.
# a. Windows 64 and 32 bit;
# b. Linux 64 and 32 bit; and
# c. API Docs.
@martinufo
martinufo / check_host.sh
Created October 16, 2014 05:53
bash getopts
while getopts ":H:" opt; do
case $opt in
H)
HOST=$OPTARG
;;
\?)
echo "Invalid option: -$OPTARG" >&2
exit 2
;;
:)
@martinufo
martinufo / check_redis_list
Last active August 29, 2015 14:07
Simple nagios plugins for Redis
#!/bin/sh -e
if [ "$#" -ne 5 ]; then
echo "Invalid usage"
echo "`basename $0` host port key 200000 4000000"
exit 2
fi
LLEN=`redis-cli --raw -h $1 -p $2 LLEN $3`
// ==UserScript==
// @name Runkeeper Average Speed
// @author Martin Stříž
// @namespace http://martinstriz.cz/
// @version 2013.06.22
// @description Shows average speed instead of average pace on certain activity types
// @include *runkeeper.com/user/*/activity/*
// ==/UserScript==
(function(){