Skip to content

Instantly share code, notes, and snippets.

View chris-piekarski's full-sized avatar

Christopher Piekarski chris-piekarski

  • Boulder, CO
  • 02:25 (UTC)
View GitHub Profile
@chris-piekarski
chris-piekarski / git_pull_sub_repos
Last active May 28, 2019 16:24
Git Pull Multiple Subdirectory Repos
find . -maxdepth 1 -type d \( ! -name . \) -exec bash -c "cd '{}' && git pull" \;
@chris-piekarski
chris-piekarski / cli_vs_filereader
Created February 1, 2017 23:13
Android read file types
//1ms but uses file cache so not updated quickly
try {
String inputLine;
FileReader file = new FileReader("/sys/class/power_supply/battery/current_now");
BufferedReader bufferedReader = new BufferedReader(file);
inputLine = bufferedReader.readLine();
text = inputLine;
bufferedReader.close();
file.close();
} catch (Exception e) {
@chris-piekarski
chris-piekarski / aosp_app_start_profiler
Last active January 31, 2022 10:25
Android app startup 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 19:16
Static Application Context Method
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 01:59
Twisted - Python Multi Threaded 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")
@chris-piekarski
chris-piekarski / nmap_scripts_unspecific
Last active August 29, 2015 14:17
Nmap Pearl Scripts
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 April 6, 2016 23:51
zmap vs. nmap CIDR/24/16
#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 December 13, 2015 04:28
Optirun - ThinkPad T430s
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 January 27, 2022 07:07
AOSP Memory/Content Related ADB Commands/Call Logs
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 January 8, 2015 17:36
Install APK on Android w/Activity prompt
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);