Skip to content

Instantly share code, notes, and snippets.

View chris-piekarski's full-sized avatar

Christopher Piekarski chris-piekarski

  • Boulder, CO
  • 08:38 (UTC)
View GitHub Profile
@chris-piekarski
chris-piekarski / java_reflection_array_type
Created October 16, 2014 17:27
Java Reflection Field 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
}
}
}
@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);
@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 / rvm_dump
Last active October 11, 2015 18:48
Ruby RVM Info Dump: ( set -x ; cd dir ) Output
+ cd current
+ builtin cd current
+ [[ -n '' ]]
+ true
+ __rvm_do_with_env_before
+ [[ -n '' ]]
+ [[ -n /usr/local/rvm ]]
+ source /usr/local/rvm/scripts/initialize
++ : rvm_trace_flag:0
++ (( rvm_trace_flag > 0 ))
#set lots of bash shell ls colors
wget https://raw.github.com/trapd00r/LS_COLORS/master/LS_COLORS -O $HOME/.dircolors
echo 'eval $(dircolors -b $HOME/.dircolors)' >> $HOME/.bashrc
. $HOME/.bashrc
#To set if it was setup correctly
dircolors -p
@chris-piekarski
chris-piekarski / dropbox monitor
Created February 3, 2013 05:31
Fix dropbox Ubuntu monitor error.
echo 100000 | sudo tee /proc/sys/fs/inotify/max_user_watches
@chris-piekarski
chris-piekarski / create_gerrit_branch
Last active December 12, 2015 08:08
Create Gerrit branch from AOSP mirror
repo init -u git://server/manifest -b <tag> android-4.1.2_r1
repo sync
repo forall -c 'git branch company/branchname"
repo forall -c 'git checkout company/branchname"
repo forall -c 'git push ssh://cpiekarski@server:29418/$REPO_PROJECT company/branchname:company/branchname'
@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 / android_apk_location
Last active December 13, 2015 16:48
Get Android package (app) apk location
$ adb shell pm list packages -f | grep com.occipital.panorama
package:/data/app-private/com.occipital.panorama-2.apk=com.occipital.panorama
$ adb pull /data/app-private/com.occipital.panorama-2.apk ~/tmp
@chris-piekarski
chris-piekarski / ruby_twitter_crunch
Last active December 14, 2015 01:59
Ruby Twitter Crunch It Steps
> redis-server
> vi ./examples/Rakefile
@app_token = ''
@app_secret = ''
@user_accounts = {:name_one => { :token => '',
:secret => '',
:filter => ['cubs', '#baseball']},