Skip to content

Instantly share code, notes, and snippets.

TimBav sleekweasel

  • Badoo
  • Luton/London UK
Block or report user

Report or block sleekweasel

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@sleekweasel
sleekweasel / adb.cpp
Last active Feb 13, 2020
Patch for adb - prevent automatic server launch, if adb server is not running.
View adb.cpp
diff --git a/adb/adb.cpp b/adb/adb.cpp
index 6b30be884..e05b707ed 100644
--- a/adb/adb.cpp
+++ b/adb/adb.cpp
@@ -664,7 +664,13 @@ static void ReportServerStartupFailure(pid_t pid) {
while (static_cast<size_t>(i) < lines.size()) fprintf(stderr, "%s\n", lines[i++].c_str());
}
+const char* env_adb_server_autostart = "ADB_SERVER_AUTOSTART";
int launch_server(const std::string& socket_spec) {
@sleekweasel
sleekweasel / w11
Created Jun 26, 2019
Apparent deadlock while requriing modules for 100 appium server instances.
View w11
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
[09:18:58]node 6635 root cwd DIR 254,1 12288 14943924 /local/buildAgent/work/dcce385aab59e3da/bma-calabash
[09:18:58]node 6635 root rtd DIR 0,188 4096 75761720 /
[09:18:58]node 6635 root txt REG 0,188 29055080 36438248 /usr/bin/node
[09:18:58]node 6635 root mem REG 254,1 36438248 /usr/bin/node (path dev=0,188)
[09:18:58]node 6635 root mem REG 254,1 36176220 /lib/x86_64-linux-gnu/libc-2.24.so (path dev=0,188)
[09:18:58]node 6635 root mem REG 254,1 36176248 /lib/x86_64-linux-gnu/libpthread-2.24.so (path dev=0,188)
[09:18:58]node 6635 root mem REG 254,1 3409779 /lib/x86_64-linux-gnu/libgcc_s.so.1 (path dev=0,188)
[09:18:58]node 6635 root mem REG 254,1 36176228 /lib/x86_64-linux-gnu/libm-2.24.so (path dev=0,188)
[09:18:58]node 6635 root mem REG
@sleekweasel
sleekweasel / diff.sh
Last active Jun 13, 2019
diff in oldish bash!
View diff.sh
#!/bin/bash
#
# Implementation of https://en.wikipedia.org/wiki/Longest_common_subsequence_problem in old-ish BASH
# because my Android emulator doesn't have diff on it.
# Seriously bogs down on files >100 lines
# Could implement the common head and tail trimming efficiency.
XL=()
XC=()
while IFS= read -r line || [[ "$line" ]] ; do XL+=("$line") ; XC+=($(echo "$line" | cksum | tr ' ' -)) ; done < ${1?First filename required}
@sleekweasel
sleekweasel / huh.txt
Last active Mar 6, 2019
Duplicated Android device id?!
View huh.txt
#!/bin/bash
usbreset_serials() {
echo Resetting.. May cause devices to move - files to ioctl/vanish.
xargs -t |
sed 's/\/serial/\/uevent/g' |
xargs -tr grep -h DEVNAME= |
sed 's/DEVNAME=/\/dev\//' |
xargs -trn1 sudo $(dirname $0)/usbreset
}
@sleekweasel
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 https://badoo.com/techblog/blog/2016/07/21/segregating-android-devices-for-docker-containers/
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;
@sleekweasel
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=>9.1.11.0-SNAPSHOT is not installed.
To install do: 'rvm install ruby-2.3.3,:engine=>jruby,:engine_version=>9.1.11.0-SNAPSHOT'
[14:32:03]~/git/bma-calabash (CAL-2855_Try_JRuby)$ rvm install 'ruby-2.3.3,:engine=>jruby,:engine_version=>9.1.11.0-SNAPSHOT'
Unknown ruby interpreter version (do not know how to handle): :engine=>jruby.
Unknown ruby interpreter version (do not know how to handle): :engine_version=>9.1.11.0-SNAPSHOT.
Already installed ruby-2.3.3.
To reinstall use:
@sleekweasel
sleekweasel / README
Last active Jul 17, 2017
Patches to allow remote access to adbd on a Linux host
View README
See also https://techblog.badoo.com/blog/2016/07/21/segregating-android-devices-for-docker-containers/
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
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
sleekweasel / patch
Created Jan 30, 2017
~/git/calabash-android (master)$ git show 0acc0d1d98e485336c3a37b599a8b052063e85a4 > patch
View patch
commit 0acc0d1d98e485336c3a37b599a8b052063e85a4
Author: Tim Baverstock <tim.baverstock@corp.badoo.com>
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
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
You can’t perform that action at this time.