Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / 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 / 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 / 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 / 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 / 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 / .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 / enable-cockpit-f22.sh
Created June 11, 2015 05:18
Enable cockpit on Fedora 22
#!/usr/bin/env bash
# based on instructions provided at
# http://www.projectatomic.io/blog/2015/06/running-cockpit-as-a-service/
atomic info fedora/cockpitws
atomic install fedora/cockpitws
cat > /etc/systemd/system/cockpitws.service << EOF
[Unit]
@abn
abn / Makefile
Created July 20, 2015 06:46
Dockerized centos rpm build makefile
#
# CentOS RPM Builder
# Usage: make build COMPONENT=</path/to/source>
#
TARGET := $(shell pwd)/target
COMPONENT := $(shell pwd)/sources
BUILDER := alectolytic/rpmbuilder-centos