Skip to content

Instantly share code, notes, and snippets.

@TheMightyLlama
TheMightyLlama / ADB Commands
Last active September 18, 2021 02:19
List of ADB commands for obtaining information from an application
#Gets screen capture of device every 270 seconds and outputs screencap to timestamped png file in local directory
while true; do adb shell screencap -p | perl -pe 's/\x0D\x0A/\x0A/g' > ScreenCap.`date +%Y`.`date +%m`.`date +%d`-`date +%H`.`date +%M`.`date +%S`.png; sleep 270; done
#Gets logs from device and outputs them to a timestamped file in local directory
while true; do adb logcat -v time > logging`date +%Y`.`date +%m`.`date +%d`-`date +%H`.`date +%M`.`date +%S`.txt; done
#Gets PID of <packagename>
adb shell ps | grep <packagename>
#Outputs battery level to console
@TheMightyLlama
TheMightyLlama / jira-curl.sh
Last active November 16, 2023 18:22
Perform actions on a jira issue via curl
#Creates a new issue with custom fields
curl -D- -u uname:pass -X POST --data "{\"fields\": {\"project\": { \"id\": \"10430\" },\"summary\": \"This is a test issue\", \"description\": \"Description\",\"issuetype\": { \"id\" : \"1\"}, \"components\" : [{\"id\":\"10731\"}], \"customfield_10711\" : [{\"id\":\"10500\"}] } }" -H "Content-Type: application/json" http://localhost:8080/jira/rest/api/2/issue/
#Returns all information for all versions
curl -D- -u uname:pass -X PUT -d "Content-Type: application/json" http://localhost:8080/jira/rest/api/2/project/AN/versions?
#Returns all issues in a version
#This URL requires the version ID of a single version which is provided by the above query
curl -D- -u uname:pass -X PUT -d "Content-Type: application/json" http://localhost:8080/jira/rest/api/2/search?jql=project="AN"+AND+fixVersion='12345'
@TheMightyLlama
TheMightyLlama / gist:106ad6c8bdfbd740c496
Last active August 29, 2015 14:06
download-smartling-files.sh
#!/bin/bash
#Dependencies
#Parallel with Homebrew: https://github.com/Homebrew/homebrew/blob/master/Library/Formula/parallel.rb
#Usage:
#./download-smartling-files.sh <file_type> <api_key> <project_id>
shopt -s nullglob
@TheMightyLlama
TheMightyLlama / gist:7e300149a901c3ee5642
Last active August 29, 2015 14:11
Get Release Branch Dates
function getReleases(){
git fetch &>/dev/null;
git checkout develop &>/dev/null;
git pull &>/dev/null;
for k in $(git branch|sed s/^..//);
do
#$k is release name
if [[ $k == *release* || $k == *hotfix* ]]; then
@TheMightyLlama
TheMightyLlama / Login.feature
Last active August 29, 2015 14:14
Login Sample
Feature: Login
Login can be performed with validated email
User stays on login page with wrong username/pass
Scenario: Correct Email Pass Combo
Given User Exists
And User has <email>
And User has <password>
When User attempts to login
Then they are given access to the service
@TheMightyLlama
TheMightyLlama / gist:261b296d66b3a042b743
Last active August 29, 2015 14:17
print a string and status with correct number of periods
function printStatus () {
string=$1;
status=$2;
lineLength=`tput cols`;
stringLength=${#string};
statusLength=${#status};
periodLength=$((lineLength - stringLength - statusLength));
All Asia Asset Cptl AAA
Albemarle & Bond Hldgs ABM
Aberdeen Asset Mngmnt ADN
ADVFN AFN
Alecto Minerals ALO
Amphion Innovations AMP
Africa Oilfield AOL
Alpha Strategic APS
Arbuthnot Banking ARBB
Arden Partners ARDN
For proper splitting of objects see here: http://stackoverflow.com/questions/7460934/best-practices-in-retrieving-related-data-in-a-rest-api
For faking data: https://github.com/marak/Faker.js/
JSON Schema:
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Account Data",
"description": "All information pertaining to a single account",
"type": "object",
"properties": {
%YAML 1.2
---
name: Plain Text
file_extensions: [txt]
scope: source.c
contexts:
main:
- match: \b(Attendee|agenda|item|TITLE|DATE|OWNER|ATTENDEES|AGENDA|ACTIONS|NOTES|RISKS)\b