Skip to content

Instantly share code, notes, and snippets.

Device & app history
- retrieve running apps
Identity
- find accounts on the device
- add or remove accounts
- read your own contact card
Calendar
- read calendar events plus confidential information
- add or modify calendar events and send email to guests without owners' knowledge
Contacts
@mega-arbuz
mega-arbuz / curl_zapier_email_hook.sh
Created February 9, 2019 22:29
cURL for Zapier Email hook
curl --request POST \
--url https://hooks.zapier.com/hooks/catch/12345/abcd/ \
--header 'content-type: application/json' \
--data '{
"to": "me@myorg.com",
"subject": "New App Version 1.0005",
"body": "App is ready\nClick download"
}'
@mega-arbuz
mega-arbuz / android_ci_compose_email.py
Last active February 9, 2019 22:56
Compose email from template file
def get_email(app_name, app_version, app_url, changes, template_file_path):
target_subject = 1
target_body = 2
target = 0
subject = ""
body = ""
template = ""
@mega-arbuz
mega-arbuz / android_ci_changes.py
Last active February 9, 2019 22:57
Extract latest changes from changelog file
def get_changes(change_log_path):
with(open(change_log_path)) as change_log_file:
change_log = change_log_file.read()
# Split by '##' and remove lines starting with '#'
latest_version_changes = change_log.split('##')[0][:-1]
latest_version_changes = re.sub('^#.*\n?', '', latest_version_changes, flags=re.MULTILINE)
return latest_version_changes
@mega-arbuz
mega-arbuz / android_ci_apk_name.py
Last active February 9, 2019 22:58
Use app name and version for APK file name
def get_target_file_name(app_name, app_version):
app_name = app_name.lower()
app_version = app_version.replace('.', '_')
return '{name}_{version}.apk'.format(name=app_name, version=app_version).replace(' ','')
@mega-arbuz
mega-arbuz / android_ci_app_data.py
Last active February 9, 2019 22:58
Extract app version and path to APK file
def get_app(release_dir):
output_path = os.path.join(release_dir, 'output.json')
with(open(output_path)) as app_output:
json_data = json.load(app_output)
app_version = json_data[0]['apkInfo']['versionName']
app_file = os.path.join(release_dir, json_data[0]['apkInfo']['outputFile'])
return app_version, app_file
@mega-arbuz
mega-arbuz / android_ci_zapier.py
Last active February 9, 2019 22:59
Send email with Zapier hook
ZAPIER_SEND_DATA = {
"to": None,
"subject": None,
"body": None
}
def send_email(zapier_hook, to, subject, body):
ZAPIER_SEND_DATA['to'] = to
ZAPIER_SEND_DATA['subject'] = subject
@mega-arbuz
mega-arbuz / android_ci_dropbox.py
Last active February 22, 2019 17:30
Upload file to Dropbox and get shareable link
DROPBOX_UPLOAD_ARGS = {
"path": None,
"mode": "overwrite",
"autorename": True,
"strict_conflict": True
}
DROPBOX_UPLOAD_URL = 'https://content.dropboxapi.com/2/files/upload'
DROPBOX_SHARE_DATA = {
"path": None,
@mega-arbuz
mega-arbuz / .gitlab-ci.yml
Last active October 30, 2020 12:38
GitLab CI yml
image: jangrewe/gitlab-ci-android
before_script:
- export GRADLE_USER_HOME=$(pwd)/.gradle
- chmod +x ./gradlew
cache:
key: ${CI_PROJECT_ID}
paths:
- .gradle/
@mega-arbuz
mega-arbuz / send_email.sh
Last active January 25, 2019 00:55
Sends email with Zapier hook
#!/bin/bash
if [ $# -lt 4 ]; then echo "Missing parameters"; exit 1; fi
content=$(awk '{printf "%s\\n", $0}' $3)
curl --request POST \
--url $4 \
--header 'content-type: application/json' \
--data "{