Skip to content

Instantly share code, notes, and snippets.

View judoole's full-sized avatar

Ole Christian Langfjæran judoole

View GitHub Profile
require 'rubygems'
require 'spec'
require 'funfx/browser/firewatir'
BROWSER = FireWatir::Firefox.new
DEMO_APP = "location_of_application.html"
Before do
BROWSER.goto(DEMO_APP)
_git_branches()
{
local cur
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
CURRENT=`git branch | grep '^*' | awk '{print $2}'`
local versions=$(git branch | grep -v $CURRENT)
COMPREPLY=($(compgen -W "${versions}" $cur))
}
complete -F _git_branches ship
@judoole
judoole / groovybddJUnitShit.java
Created October 7, 2011 13:24
GroovyBDDJUnitShit
@Test
public void skal_hente_alle_tenant_profiler() {
Gitt.at_tenant_profile_eksisterer(new TenantProfile(1, "Single"))
Gitt.at_tenant_profile_eksisterer([id:2, description:"Dubletter"])
Gitt.at_tenant_profile_eksisterer(new TenantProfile(id:3, description:"Tribletter"))
Naar.jeg_henter_informasjon_om_soknadslista()
Saa.skal_antallet_tenant_profiler_vaere(3)
}
@judoole
judoole / smoketest.sh
Created July 30, 2012 11:24
Smoketest shell script via curl
#!/bin/bash
if [ -z "$1" ]
then
echo "usage: smoketest.sh <url>"
exit 1
fi
status=`curl --silent --head $1 | head -1 | cut -f 2 -d' '`
@judoole
judoole / RemoteObjectLogger.java
Created August 15, 2012 08:04
Logging to Java-server Flex with AMF
@Service
@RemotingDestination
public class RemoteObjectLogger {
private static final String PRE_FLEX = "[FLEX] ";
protected final Log logger = LogFactory.getLog(getClass());
@RemotingInclude
public void log(String level, String message) {
if ("INFO".equals(level)) logger.info(PRE_FLEX + message);
else if ("DEBUG".equals(level)) logger.debug(PRE_FLEX + message);
@judoole
judoole / install-locustio
Created August 27, 2013 14:20
Minumum requirements for locustio on Ubuntu
sudo apt-get install -y python-dev python-pip python-gevent libevent-dev libzmq-dev
sudo pip install pyzmq gevent-zeromq locustio
@judoole
judoole / bashrc
Created March 24, 2014 13:22
Norwegian Locale for bash
# .bashrc
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
# User specific aliases and functions
export LANG="no_NO.UTF-8"
export LC_CTYPE="no_NO.UTF-8"
@judoole
judoole / GitContext.groovy
Last active August 29, 2015 14:01
GGG. Gradle, Groovy and Git. Slap this inside your Gradle-script and you've rolled your own git-plugin.
class GitContext {
@Lazy String branchName = {
def proc = 'git rev-parse --abbrev-ref HEAD'.execute()
proc.waitFor()
assert proc.exitValue() == 0, proc.err.text
return proc.in.text.trim()
}()
def boolean isMasterBranch() {
@judoole
judoole / jenkins
Created August 12, 2014 15:08
jenkins init.d for RHEL
#!/bin/sh
#
# SUSE system statup script for Jenkins
# Copyright (C) 2007 Pascal Bleser
#
# This library is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or (at
# your option) any later version.
#
@judoole
judoole / main.js
Created December 14, 2014 20:25
Node Sensortag
var SensorTag = require('sensortag');
connect_and_enable_humidity = function(sensorTag){
console.log('discovered %s', sensorTag);
sensorTag.connect(function() {
console.log('connected');
sensorTag.discoverServicesAndCharacteristics(function() {
console.log('Discovering services')
sensorTag.enableIrTemperature(function(){
sensorTag.on('irTemperatureChange', function(objectTemperature, ambientTemperature){