Skip to content

Instantly share code, notes, and snippets.

View amahdy's full-sized avatar
🐿️
Coding..

A.Mahdy AbdelAziz amahdy

🐿️
Coding..
View GitHub Profile
@amahdy
amahdy / release-android-debuggable.md
Created July 16, 2023 15:39
How to make a Release Android App debuggable (Android R+)

How to make a Release Android App debuggable (Android R+)

This is a newer version with a bit more details and workarounds from this gist. Especially for Android R+.

I recommend to read the previous gist to get an idea about what I'm trying to achieve. This note will be straight forward on commands to perform. Some commands use zipalign and apksigner which are located in the build-tools of your Android SDK installation folder. Mine are located in: ~/Library/Android/sdk/build-tools/34.0.0/.

@amahdy
amahdy / droidcapture.sh
Last active July 16, 2023 18:07
Automatic screen capture for Android
# I needed to automatically caputre screen of a book on an Android device
# The process is to: `screenshot` then `swipe left` for some 1000+ times
# This code can help performing those operations:
# Assuming you have installed and configured `adb`,
# and you are authenticated to execute `adb` commands on the device from a bash script:
# Folder in the device to save screenshots
SAVEDIR="/storage/emulated/0/Download/Book7"
# Specify number of pages
/**
go/enablement-skills-readiness
Must refresh the page before run, as image src keeps changing
**/
// Try & Error, this is the image by current index order:
let targetImg = document.getElementsByTagName('img')[2].src
// Buffer of image pixels, let’s take first row, 1000 pixels (actual needed 318 only)
let pixels;
// you can write to stdout for debugging purposes, e.g.
// console.log('this is a debug message');
function solution(S) {
// write your code in JavaScript (Node.js 8.9.4)
let maxLen = -1;
let currentLen = 0;
let charCount = 0;
@amahdy
amahdy / decipher.js
Last active January 17, 2022 09:12
/* Code to run in the browser console of `go/techcon-lightningtalks` */
let loadData = function() {
// Array holding the data
let data = Array();
// Keep track of `H2` elements
let index = 1;
// Keep track of pillars
@amahdy
amahdy / InjectStyleInVaadin.java
Created June 30, 2017 15:48
Inject Style in Vaadin
package TEST;
import com.vaadin.annotations.Theme;
import com.vaadin.annotations.VaadinServletConfiguration;
import com.vaadin.server.Page;
import com.vaadin.server.VaadinRequest;
import com.vaadin.server.VaadinServlet;
import com.vaadin.shared.ui.colorpicker.Color;
import com.vaadin.ui.CssLayout;
import com.vaadin.ui.UI;
self.onactivate = function(event) {
event.waitUntil(
self.clients.claim().then(function() {
var currentCacheName = CACHE_NAME + '-v' + CACHE_VERSION;
return caches.keys().then(function(cacheNames) {
return Promise.all(
cacheNames.map(function(cacheName) {
if (cacheName.indexOf(CACHE_NAME) == -1) {
return;
}
self.oninstall = function(event) {
event.waitUntil(
self.skipWaiting().then(
caches.open(CACHE_NAME + '-v' + CACHE_VERSION).then(function(cache) {
return cache.addAll(filesToCache);
})
)
);
};
"start_url": "../",
@JavaScript("vaadin://js/app.js")
@Link(rel="manifest", href="VAADIN/manifest.json")
public class MyUI extends UI {