In computing, memoization or memoisation
is an optimization technique used primarily
to speed up computer programs by storing
the results of expensive function calls and
returning the cached result when the same
inputs occur again.
— wikipedia
This file contains 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
#include <string.h> | |
#include <cstring> | |
#include <fstream> | |
#include <iostream> | |
std::string dir = "/data/data/uk.lgl.modmenu/cache/imei"; | |
std::string buf = "whatever"; | |
std::ifstream myfile(dir); | |
if (!myfile.is_open()) { | |
std::ofstream os(dir.c_str(), std::ios::trunc); |
-
Install Termux, an Android terminal emulator that provides a Linux execution environment and various tools.
-
Update system packages in Termux:
$ pkg update -y
This file contains 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
/* | |
This method can be used to download an image from the internet using a url in Android. This use Android Download Manager to | |
download the file and added it to the Gallery. Downloaded image will be saved to "Pictures" | |
Folder in your internal storage | |
*/ | |
private void downloadImageNew(String filename, String downloadUrlOfImage){ | |
try{ | |
DownloadManager dm = (DownloadManager) getSystemService(Context.DOWNLOAD_SERVICE); | |
Uri downloadUri = Uri.parse(downloadUrlOfImage); |
This file contains 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
# arm | |
export PATH=$PATH:$HOME/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin | |
export CC=armv7a-linux-androideabi19-clang | |
export CXX=armv7a-linux-androideabi19-clang++ | |
~/.cargo/bin/cargo build --target armv7-linux-androideabi | |
# aarch64 | |
export PATH=$PATH:$HOME/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin | |
export CC=aarch64-linux-android21-clang | |
export CXX=aarch64-linux-android21-clang++ |
This file contains 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
//How it works: all the script relies on a tiny javascript stub injected to webView's document that uses Proxy api and json serialicing stuff. Calls to our internal objects are proxified to a single method "__mm_handle_method", that using reflection find the target method and populate arguments exchanged in json, plus a custom interface for methods passed as argument. | |
package es.pabloko.webviewbridge; | |
import android.app.Activity; | |
import android.content.Context; | |
import android.support.v7.app.AppCompatActivity; | |
import android.os.Bundle; | |
import android.util.Log; | |
import android.webkit.JavascriptInterface; |
A collection of Markdown code and tricks that were tested to work in Gist.
This and all public gists in https://gist.github.com/ww9 are Public Domain. Do whatever you want with it including , no need to credit me.
- Reformat this whole document and assimilate these:
This file contains 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
// Discord all events! | |
// A quick and dirty fleshing out of the discord.js event listeners (not tested at all!) | |
// listed here -> https://discord.js.org/#/docs/main/stable/class/Client | |
// Learn from this, do not just copy it mofo! | |
// | |
// Saved to -> https://gist.github.com/koad/316b265a91d933fd1b62dddfcc3ff584 | |
// Last Updated -> Halloween 2022 | |
/* |
This file contains 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
#!/system/bin/sh | |
[ "$(whoami)" != "root" ] && { echo "root required"; exit 1; } | |
configs=( /data/misc/wifi/WifiConfigStore.xml /data/misc/apexdata/com.android.wifi/WifiConfigStore.xml ) | |
for z in ${configs[@]}; do | |
if [ -f $z ]; then | |
config=$z | |
break | |
fi | |
done |
This file contains 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
package com.yourpackage.appname; | |
import java.util.concurrent.Semaphore; | |
public class MyActivity extends NativeActivity { | |
static { | |
// Load native library | |
System.loadLibrary("native-lib"); | |
} |
NewerOlder