This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // For Android | |
| // Get the ID of an Accessibility node | |
| /* | |
| * Get the associated nodeId of the passed in event source | |
| * This works as long as AccessibilityNodes keep their IDs | |
| * as the beginnings of their .toString() return values | |
| */ | |
| public String getId(AccessibilityNode node) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // For Android | |
| // Class must extend AccessibilityService to use this function verbatim | |
| // Have fun | |
| // Function will overwrite any existing text in the node | |
| public void setText(AccessibilityNodeInfo node, String textToSet) { | |
| Bundle arguments = new Bundle(); | |
| arguments.putCharSequence(AccessibilityNodeInfo.ACTION_ARGUMENT_SET_TEXT_CHARSEQUENCE, | |
| textToSet); | |
| node.performAction(AccessibilityNodeInfo.AccessibilityAction.ACTION_SET_TEXT.getId(), arguments); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // For Android | |
| // Get the URL of the current page in the Google Chrome browser | |
| // Needs to be in a class that extends AccessibilityService | |
| // A version of this code is used in PorNo!, a porn-blocker I wrote | |
| // https://github.com/mrvivacious/PorNo-_Porn_Blocker/ | |
| // | |
| // Have fun ~ | |
| String TAG = "Get Chrome URL: "; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ```sh | |
| # https://stackoverflow.com/questions/4946785/ | |
| # https://stackoverflow.com/questions/1401482/ | |
| function age() { | |
| dob="1900-31-01" # yyyy-dd-mm | |
| today=$(date '+%Y-%d-%m') | |
| echo Day $(((`date -jf %Y-%d-%m $today +%s` - `date -jf %Y-%d-%m $dob +%s`)/86400)) | |
| } | |
| ``` |