Skip to content

Instantly share code, notes, and snippets.

@abn
abn / .bashrc.git
Last active July 16, 2019 08:02
.bashrc snippet for displaying current branch when in repositories
# Add some magic when in git repos
GIT_SUFFIX=$(echo $PS1 | grep "__git_ps1")
if [ -z "$GIT_SUFFIX" ]; then
SRC=/usr/share/git-core/contrib/completion/git-prompt.sh
if [ -f $SRC ]; then
. $SRC
fi
PS1="$(echo $PS1 | sed s/']\\\$'//)\$(__git_ps1)]$ "
fi
@abn
abn / Makefile
Created April 16, 2015 00:32
Apache ActiveMQ performance testing. To run: `make run AMQ_TARGET=localhost`.
AMQ_VERSION := 5.11.1
AMQ_DIR := activemq-activemq-$(AMQ_VERSION)
AMQ_TAR := activemq-$(AMQ_VERSION).tar.gz
AMQ_TAR_URL := https://github.com/apache/activemq/archive/$(AMQ_TAR)
PERF_DIR := activemq-perftest
PERF_URL := http://svn.apache.org/repos/asf/activemq/sandbox/$(PERF_DIR)
AMQ_TARGET ?= localhost
@abn
abn / amq-perf-test.sh
Last active January 24, 2019 08:01
Apache ActiveMQ performance test
#!/usr/bin/env bash
VERSION=5.11.1
DIR=activemq-${VERSION}
TARBALL=${DIR}.tar.gz
AMQIP=${AMQIP-localhost}
wget https://github.com/apache/activemq/archive/${TARBALL}
tar xf ${TARBALL}
cd activemq-${DIR}/activemq-tooling
mvn clean install
@abn
abn / git-info
Created March 26, 2015 23:16
Git Info Script
#!/bin/bash
# author: Duane Johnson
# email: duane.johnson@gmail.com
# date: 2008 Jun 12
# license: MIT
#
# Based on discussion at http://kerneltrap.org/mailarchive/git/2007/11/12/406496
pushd . >/dev/null
@abn
abn / revok-docker-centos-7.sh
Created March 19, 2015 06:44
Deploy and start docker based Revok Scanner instance on CentOS 7
#!/usr/bin/env bash
yum -y install epel-release
yum -y install docker git
systemctl enable docker
systemctl start docker
mkdir /opt/revok
cd /opt/revok
@abn
abn / install-idea.sh
Created March 17, 2015 06:01
Install JetBrains IDEA Community edition
#!/usr/bin/env bash
VERSION=${1:-14.0.3}
#http://download-cf.jetbrains.com/idea/ideaIC-14.0.3.tar.gz
URI=http://download.jetbrains.com/idea/ideaIC-${VERSION}.tar.gz
if [ "$(whoami)" == "root" ]; then
echo "INFO: Installing system-wide"
BASE=/opt/jetbrains
BIN=/usr/bin
@abn
abn / odl.bashrc
Created March 11, 2015 08:30
.bashrc for OpenDaylight development environment
#!/usr/bin/env bash
export ODL_DEVEL_HOME=${ODL_DEVEL_HOME-$(pwd)}
export ODL_USERNAME=${ODL_USERNAME-$(whoami)}
export MAVEN_OPTS="-Xmx1024m -XX:MaxPermSize=256m"
function odl-test-integration(){
INTEGRATION_DIR=${ODL_DEVEL_HOME}/integration
if [ ! -d "${INTEGRATION_DIR}" ]; then
git clone ssh://${ODL_USERNAME}@git.opendaylight.org:29418/integration.git
@abn
abn / convert-raw-to-vmdk.sh
Last active April 30, 2021 19:06
Convert all xz compressed raw images in current directory to vmdk and xz compress them.
find ./ -type f -name "*.raw.xz" \
-exec echo "Uncompressing {} ..." \; \
-exec unxz --keep {} \; \
-exec bash -c \
'for file do
INPUT_IMG=${file/.xz/}
OUTPUT_IMG=${file/raw.xz/vmdk}
echo "Converting to vmdk: ${INPUT_IMG}";
qemu-img convert -f raw -O vmdk ${INPUT_IMG} ${OUTPUT_IMG};
echo "Compressing ...";
@abn
abn / install-capstan-fedora.sh
Last active August 29, 2015 14:16
Install script for cloudius capstan
#!/usr/bin/env bash
# install dependencies
sudo yum install golang qemu-system-x86 qemu-img git
# install capstan
go get github.com/cloudius-systems/capstan
@abn
abn / epel-release-latest
Created March 9, 2015 07:21
Install latest epel-release on RHEL 7 machine
#!/usr/bin/env bash
EPEL_URL_PREFIX=http://dl.fedoraproject.org/pub/epel/7/x86_64/e/
# install any requirements
yum -y install curl
RPM_NAME=$(curl --silent ${EPEL_URL_PREFIX} \
| egrep -oh "epel-release-7-[0-9]*.noarch.rpm" \
| sort -u | head -n 1)