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
/** | |
* Using in keyword with other classes in Kotlin. | |
* ---------------------------------------------- | |
* | |
* | |
* You can provide an operator contains function for a class so | |
* that you can use the in syntax in a when statement. | |
*/ | |
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
class MainActivity : AppCompatActivity() { | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
setContentView(R.layout.activity_main) | |
text_view.text = loadDexFile("dm.dex").text | |
textView2.text = loadDexFile("dm2.dex").text | |
} |
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
# Classes.jar is the input file being run through the dex process | |
dx --dex --output "dexFile.dex" classes.jar |
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
class ModuleLoader(val cacheDir: String) { | |
fun load(dex: File, cls: String = "com.example.dynamicmodule.DynamicModule"): IDynamicModule { | |
try { | |
val classLoader = DexClassLoader(dex.absolutePath, cacheDir, | |
null, this.javaClass.classLoader) | |
val moduleClass = classLoader.loadClass(cls) | |
if (IDynamicModule::class.java.isAssignableFrom(moduleClass)) { |
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
public interface IDynamicModule { | |
String getText(); | |
} |
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
#!/bin/bash | |
if [ -z "$1" ]; then | |
echo "Please specify DB file name" | |
echo "usage $0 [Database File] [App Package]" | |
exit 1 | |
fi | |
if [ -z "$2" ]; then | |
echo "Please specify the package name to run as" |
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
# Dave Thomas Oct 2015 | |
# I've added this function to my ~/.bash_profile | |
# It allows for quick one liner tests of java code from the command line | |
# Usage example: | |
# javai 'System.out.println("Hello, World!");' | |
# | |
# Second param can be import statements | |
# Eg: |
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
#!/bin/bash | |
# | |
# Strict mode: http://redsymbol.net/articles/unofficial-bash-strict-mode/ | |
set -euo pipefail | |
IFS=$'\n\t' | |
# | |
# Usage: script -f fileToPull -p packageName | |
# |
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
import System.Environment | |
import Text.Printf | |
bz = 0.552284749831 | |
zero = read "0" :: Float | |
main = do | |
args <- getArgs | |
let c = parseArg 0 args |
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
#!/bin/bash | |
# | |
# ADB Connect android device for building via wifi | |
# Based on stack over flow answer: | |
# http://stackoverflow.com/questions/4893953/run-install-debug-android-applications-over-wi-fi | |
# | |
# Usage: | |
# | |
# 1. Make sure adb command is in executable path | |
# |
NewerOlder