Skip to content

Instantly share code, notes, and snippets.

@neilellis
neilellis / README.md
Last active May 26, 2020 13:09
Build large maven projects quicker on OS X, this gist will ensure a ramdisk is mounted in /Volumes/ramdisk and triggers a profile that redirects output to a ram disk. It also only builds modules which have changed and their dependent modules. This is done by supplying the target directory of the ultimate artifact you are interested in.

Make sure you have a profile called quick that redefines the location of maven's output to the ramdisk. To do this ensure all of the below are in your parent POM.

<properties><my.build.directory>target</my.build.directory></properties>

<build><directory>${my.build.directory}</directory></build

<profile>
  <id>quick</id>
@neilellis
neilellis / SelfClosingMenuBar.java
Created March 15, 2013 18:28
A GWT menu bar that closes itself if user interaction ceases.
package cazcade.boardcast.client.main.widgets;
import com.google.gwt.event.dom.client.MouseOutEvent;
import com.google.gwt.user.client.Event;
import com.google.gwt.user.client.Timer;
import com.google.gwt.user.client.ui.MenuBar;
import com.google.gwt.user.client.ui.MenuItem;
import java.util.HashMap;
import java.util.List;
@neilellis
neilellis / StickyTopScrollHandler.java
Last active December 15, 2015 00:38
Simple GWT 'sticky' scroll handler - like the one used in http://boardcast.it - it will cause scrolling to 'stick' from headerTopTriggerInPixels to headerBottomTriggerInPixels with a gravity towards initialScrollPosition. Useful if you have content you wish to 'hide' above the normal viewable area.
import com.google.gwt.user.client.Window;
public class StickyTopScrollHandler implements Window.ScrollHandler {
private final int headerTopTriggerInPixels;
private final int headerBottomTriggerInPixels;
private final int initialScrollPosition;
private Timer timer;
private int oldTop;
@neilellis
neilellis / rsnync_backup.sh
Last active December 15, 2015 01:08
A simple script to rsync to a backup-server, use this script with caution and make sure the destination is disposable (and running same version of OS). If unsure add --dry-run into the rsync options. You will probably want to tailor rsync-exclude.txt to your needs.
rsync -azPx -e ssh -azPx --delete-after --exclude-from="rsync-exclude.txt" / root@$1:/
#!/bin/sh
##
## Redhat / Linux / LSB
##
# chkconfig: 345 85 15
# description: Startup script for Express / Node.js application with the \
## forever module.
##
## A modification of https://gist.github.com/1339289
##
#!/bin/bash
# init script for Cassandra.
# chkconfig: 2345 90 10
# description: Cassandra
# script slightly modified from
# http://blog.milford.io/2010/06/installing-apache-cassandra-on-centos/
. /etc/rc.d/init.d/functions
CASS_HOME=/cassandra/apache-cassandra-1.2.4
#!/bin/bash
# Take input for username and password
read -p "Transmission username: " uname
read -p "$uname's Password: " passw
# Update system and install required packages
yum -y update
yum -y install gcc gcc-c++ m4 make automake curl-devel intltool libtool gettext openssl-devel perl-Time-HiRes wget
@neilellis
neilellis / install-icinga.sh
Last active April 12, 2019 13:24
Automated install for icinga on Centos 6.4 with ichinga-web, nagios-api and nagdash - please check the script before running hey :-)
#!/bin/sh
# Copyright 2013 Neil Ellis
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
@neilellis
neilellis / rebase.sh
Last active December 19, 2015 15:38
Builds a new Eucalyptus image based on an existing *CentOS* image combined with the contents of running modified instances. Then adds it to the images in Eucalyptus. This is really useful if you want to constantly make changes to your base images. Also includes support for a custome run_once.sh script which will be run on first boot. Please read…
#!/bin/sh
################# CHANGE THESE! ######################
IMAGE=centos-ops
RAMDISK_IMAGE=eri-A3493391
KERNEL_IMAGE=eki-E7E73878
INSTANCE_KEY=~/credentials/admin/admin.private
. ~/credentials/admin/eucarc
######################################################
if [ -f ${IMAGE}.img ]

Follow these steps to install Graphite on a fresh Ubuntu 12.04 instance. Make sure you read and understand the commands because by the time you read this, things could be outdated.

Graphite

Installing dependencies

# apt-get install libpq-dev
# apt-get install python-dev python-pip python-cairo python-psycopg2
# apt-get install python-django python-django-tagging