Skip to content

Instantly share code, notes, and snippets.

View michaelbannister's full-sized avatar

Michael Bannister michaelbannister

  • John Lewis & Partners
  • London, UK
View GitHub Profile
@michaelbannister
michaelbannister / StringCalculator.groovy
Created January 28, 2016 13:53
String calculator TDD kata first attempt
import java.util.regex.Pattern
class StringCalculator {
def add(String expression) {
if (expression.isEmpty()) {
return 0
}
def delimiter = findCustomDelimiterPattern(expression)
@michaelbannister
michaelbannister / SettersInjectionOnSpySpec.groovy
Created April 2, 2015 20:06
Spock Subjects-Collaborators extension not happy with stubbed method on Spy subject
package com.blogspot.toomuchcoding.spock.subjcollabs
import com.blogspot.toomuchcoding.spock.subjcollabs.Collaborator
import com.blogspot.toomuchcoding.spock.subjcollabs.Subject
import spock.lang.Specification
class SettersInjectionOnSpySpec extends Specification {
public static final String TEST_METHOD_1 = "Test method 1"
@michaelbannister
michaelbannister / wsadmin with module library
Last active May 22, 2018 10:05
Add folders to wsadmin Python path
$WAS_HOME/bin/wsadmin.sh -lang jython -javaoption "-Dpython.path=/my/jython/modules;/more/jython/modules"
source: http://www-01.ibm.com/support/docview.wss?uid=swg21268538
@michaelbannister
michaelbannister / international.conf
Created October 31, 2014 08:42
Apache config to simulate Smartling setting X-Language-Locale based on subdomain for localhost
NameVirtualHost *:80
<VirtualHost *:80>
ServerName localhost
ServerAlias *.localhost
LogFormat "%h %l %u %t \"%r\" %>s %b \"X-Language-Locale: %{X-Language-Locale}i\"" international
CustomLog "/private/var/log/apache2/international.log" international
ErrorLog /private/var/log/apache2/international.log
RewriteEngine On
RewriteLog /private/var/log/apache2/international.log
@michaelbannister
michaelbannister / clear_sib_queues_for_bus.py
Created March 20, 2013 11:06
Websphere 6.1 wsadmin script to delete messages from SIB queues for a given bus name.
# clears SIB queues for the specified bus on a running Websphere instance
if len(sys.argv) < 1:
print 'Expected argument containing bus name'
sys.exit(1)
busname = sys.argv[0]
queues = AdminControl.queryNames('WebSphere:type=SIBQueuePoint,SIBus='+busname+',*').splitlines()
for queue in queues:
ffmpeg -i input.mp4 -strict -2 -acodec aac -ab 160K -ac 2 -ar 44100 -vn output.m4a
# -ab audio bitrate
# -ac audio channels
# -ar audio sample rate
# -vn no video
# -strict -2 enables AAC codec as it's experimental (ffmpeg 1.0.1)