Skip to content

Instantly share code, notes, and snippets.


TimBav sleekweasel

  • Badoo
  • Luton/London UK
View GitHub Profile
View Dependent await reboot complete task
echo This task runs after the reboot task, as a buffer between the reboot script and the real reboot.
echo That is, THIS task will get all the INTERRUPTED errors, not the real scripts.
# Note: This script depends on the host machine's reboot process removing the 'rebooting=true' line from the
# See the plist in this gist, or add it to your rc.local.
echo Uptime:
echo Infinite loop until machine reboot, unless reboot is already complete:
View appium.log
2016-07-19 12:52:19:487 - info: [Appium] Welcome to Appium v1.5.3 (REV 62d39fdb5ec180e37b10f5dd95b647001b9b02f7)
2016-07-19 12:52:19:488 - info: [Appium] Non-default server args:
2016-07-19 12:52:19:489 - info: [Appium] port: 1235
2016-07-19 12:52:19:490 - info: [Appium] sessionOverride: true
2016-07-19 12:52:19:490 - info: [Appium] log: '/tmp/appiumj.log'
2016-07-19 12:52:19:490 - info: [Appium] loglevel: 'error:debug'
2016-07-19 12:52:19:490 - info: [Appium] logNoColors: true
2016-07-19 12:52:19:537 - info: [Appium] Appium REST http interface listener started on
2016-07-19 12:52:30:335 - info: [HTTP] --> POST /wd/hub/session {"desiredCapabilities":{"platformName":"ios","platformVersion":"9.3","deviceName":"iPhone 6","app":"/tmp/","autoAcceptAlerts":false,"bundleId":"com.moxco.bumble","newCommandTimeout":305,"showIOSLog":false,"fullReset":true}}
2016-07-19 12:52:30:336 - info: [MJSONWP] Calling AppiumDriver.createSession() with args: [{"platformName":"ios","pla...
# Logs to stdout, maintaining an xmessage based status.
# Messages starting with space are appended.
# Magic { & } 2>/dev/null stuff is to suppress job control noise.
xlog() {
[ -n "$XM_PID" ] && { kill $XM_PID && wait $XM_PID ; } 2>/dev/null
echo === ${XM_STATE} "$*"
case "$*" in (' '*) XM_MESSAGE+="
View skanky_redis.rb
require 'socket'
# Crappy REDIS for the Linux agents, to avoid having to install redis everywhere.
# Would have been better had I realised the manual mode wasn't the standard.
# NB:
# env.LC_ALL en_US.UTF-8
class SkankyRedis
def initialize
sleekweasel /
Last active Jan 5, 2017
Videocapture applescript needs clickdrag.m to do its mouse clicking.

CLI video capture for iOS: the applescript uses the clickdrag tool to select the given window.

  • To start recording Simulator: osascript videocapture.scpt start Simulator 1 /Users/username/bin/clickdrag
  • To stop recording and save movie: osascript videoccapture.scpt stop /Users/username/Movies/somename
  • To stop recording without saving movie: osascript videocapture.scpt stop

Used by for automatic recording of test execution in cucumber.

Probably, if I renamed 'videocapture.scpt' to 'videocapture.applescript' and put a #!env osascript line at the start, it would be better.

sleekweasel / patch
Created Jan 30, 2017
~/git/calabash-android (master)$ git show 0acc0d1d98e485336c3a37b599a8b052063e85a4 > patch
View patch
commit 0acc0d1d98e485336c3a37b599a8b052063e85a4
Author: Tim Baverstock <>
Date: Fri May 29 18:18:36 2015 +0100
Retrieve Jacoco coverage
diff --git a/ruby-gem/lib/calabash-android/helpers.rb b/ruby-gem/lib/calabash-android/helpers.rb
index c94c768..485aa31 100755
--- a/ruby-gem/lib/calabash-android/helpers.rb
+++ b/ruby-gem/lib/calabash-android/helpers.rb
sleekweasel / session
Last active Feb 1, 2017
SLES/Docker locale issue caused by missing mkdir /usr/lib/locale and needing to re-start bash
View session
9f2a7296bd3e:/ # zypper in glibc-i18ndata
9f2a7296bd3e:/ # localedef -v -c -i en_GB -f UTF-8 en_GB.UTF-8
/usr/share/i18n/locales/en_GB:23: non-symbolic character value should not be used
/usr/share/i18n/locales/en_GB:24: non-symbolic character value should not be used
/usr/share/i18n/locales/en_GB:25: non-symbolic character value should not be used
/usr/share/i18n/locales/en_GB:26: non-symbolic character value should not be used
/usr/share/i18n/locales/en_GB:27: non-symbolic character value should not be used
/usr/share/i18n/locales/en_GB:30: non-symbolic character value should not be used
/usr/share/i18n/locales/en_GB:31: non-symbolic character value should not be used
/usr/share/i18n/locales/en_GB:32: non-symbolic character value should not be used
sleekweasel / README
Last active Jul 17, 2017
Patches to allow remote access to adbd on a Linux host
See also
Two patches in one:
1. Filter devices by USB VID:PID and USB bus device on Linux, in case you need to segregate devices onto different
ADB dameons running on different server ports (like we needed several groups of Samsung phones, and they re-use
their VID:PID for ALL devives):
ADB_DEV_BUS_USB=/dev/bus/usb/bus01 \
ADB_VID_PID_FILTER=1234:8794,1344:2334 \
ANDROID_ADB_SERVER_PORT=9123 adb devices
sleekweasel / command
Created Jul 20, 2017
rvm doesn't like jruby
View command
[14:31:30]~/git/bma-calabash (CAL-2855_Try_JRuby)$ cd ..
[14:32:00]~/git$ cd bma-calabash
ruby-2.3.3,:engine=>jruby,:engine_version=> is not installed.
To install do: 'rvm install ruby-2.3.3,:engine=>jruby,:engine_version=>'
[14:32:03]~/git/bma-calabash (CAL-2855_Try_JRuby)$ rvm install 'ruby-2.3.3,:engine=>jruby,:engine_version=>'
Unknown ruby interpreter version (do not know how to handle): :engine=>jruby.
Unknown ruby interpreter version (do not know how to handle): :engine_version=>
Already installed ruby-2.3.3.
To reinstall use:
sleekweasel / patch
Last active Jan 2, 2018
Patch for adb usb bus and vid-pid based segregation (multiple, comma separated), boosting simulataneous emulators, and a bodgy mechanism for remote access to this adb. See
View patch
diff --git a/adb/client/usb_linux.cpp b/adb/client/usb_linux.cpp
index f9ba7cbc2..f805ab9b4 100644
--- a/adb/client/usb_linux.cpp
+++ b/adb/client/usb_linux.cpp
@@ -120,6 +120,71 @@ static inline bool contains_non_digit(const char* name) {
return false;
+static int iterate_numbers(const char* list, int* rejects) {
+ const char* p = list;