Skip to content

Instantly share code, notes, and snippets.

Avatar

Christopher Piekarski chris-piekarski

View GitHub Profile
@chris-piekarski
chris-piekarski / aosp_app_start_profiler
Last active Apr 6, 2016
Android app startup profiler
View aosp_app_start_profiler
From AOSP page:
"Analyzing app startup time
Use $ adb shell am start with the -P or --start-profiler option to run the profiler when your app starts.
This will start the profiler almost immediately after your process is forked from zygote, before any of your code is loaded into it."
@chris-piekarski
chris-piekarski / aosp_context_from_any_class
Created May 15, 2015
Static Application Context Method
View aosp_context_from_any_class
In Android Manifest file declare following
<application android:name="com.xyz.MyApplication">
</application>
then write the class
public class MyApplication extends Application{
private static Context context;
@chris-piekarski
chris-piekarski / multi_thread_web_server
Last active May 1, 2017
Twisted - Python Multi Threaded Web Server
View multi_thread_web_server
from twisted.web import server, resource
from twisted.internet import reactor, endpoints
class Counter(resource.Resource):
isLeaf = True
numberRequests = 0
def render_GET(self, request):
self.numberRequests += 1
request.setHeader("content-type", "text/plain")
View nmap_scripts_unspecific
http://www.unspecific.com/nmap/
vi nmap-wrapper.pl --> add $opt_d=3
$ sudo ./bin/nmap-wrapper.pl -v -l 10.0.0.0/24
$ nmap-search.pl -f ./20150320.10.0.0.gnmap port 80
$ nmap-report.pl -p80 -v
#html output
#nmap has a built in xslt stylsheet in xml output, convert to html
@chris-piekarski
chris-piekarski / zmap_nmap_perf
Last active Apr 6, 2016
zmap vs. nmap CIDR/24/16
View zmap_nmap_perf
#nmap host discovery
#Nmap sends an ICMP echo request, a TCP SYN packet to port 443, a TCP ACK packet to port 80, and an ICMP timestamp request.
$ time sudo zmap -p 80 -i wlan1 10.0.0.0/24
real 0m9.135s
user 0m0.153s
sys 0m0.109s
CIDR 24
@chris-piekarski
chris-piekarski / optirun_ubuntu_thinkpad
Last active Dec 13, 2015
Optirun - ThinkPad T430s
View optirun_ubuntu_thinkpad
sudo apt-get install mesa-utils
glxinfo | grep OpenGL
optirun | grep OpenGL
glxsheres64
optirun -vv glxspheres64
lspci | grep NVIDIA
@chris-piekarski
chris-piekarski / aosp_meminfo_commands
Last active Sep 18, 2020
AOSP Memory/Content Related ADB Commands/Call Logs
View aosp_meminfo_commands
adb shell dumpsys procstats --hours 3
adb shell dumpsys meminfo
adb shell dumpsys activity
#get com.android content providers
adb shell dumpsys | grep Provider{ | grep com.android
#call logs
adb shell content query --uri content://call_log/calls
@chris-piekarski
chris-piekarski / android_isntall_apk.java
Created Jan 8, 2015
Install APK on Android w/Activity prompt
View android_isntall_apk.java
File f = new File(filePath);
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(f), "application/vnd.android.package-archive");
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
@chris-piekarski
chris-piekarski / logcat parser
Last active May 9, 2016
Parse Android logcat file into .csv file with cols as TAGS
View logcat parser
# Author: @c_piekarski
import optparse
import csv
import logging
import os
import datetime
import re
TAGS = ["Browser","Dalvikvm", "Zygote", "AndroidRuntime"]
SUBTAGS = [
@chris-piekarski
chris-piekarski / java_reflection_array_type
Created Oct 16, 2014
Java Reflection Field Array Type
View java_reflection_array_type
if(field.getType().isArray() && field.getType() == String[].class) {
if(field.getName() == "SHORTCUT" || field.getName() == "URI") {
String[] x = (String []) field.get(field);
for(int i = 0; i < x.length; i++) {
//Do something
}
}
}