Skip to content

Instantly share code, notes, and snippets.

Avatar

Christopher Piekarski chris-piekarski

View GitHub Profile
@chris-piekarski
chris-piekarski / android:layout_width
Created Oct 7, 2014
Layout Width/Height Constants
View android:layout_width
public static final int FILL_PARENT
Added in API level 1
Special value for the height or width requested by a View. FILL_PARENT means that the view wants to be as big as its parent, minus the parent's padding, if any. This value is deprecated starting in API Level 8 and replaced by MATCH_PARENT.
Constant Value: -1 (0xffffffff)
public static final int MATCH_PARENT
Added in API level 8
@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
}
}
}
@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);
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 / rvm_dump
Last active Oct 11, 2015
Ruby RVM Info Dump: ( set -x ; cd dir ) Output
View rvm_dump
+ 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 ))
View LS_COLORS
#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 Feb 3, 2013
Fix dropbox Ubuntu monitor error.
View dropbox monitor
echo 100000 | sudo tee /proc/sys/fs/inotify/max_user_watches
@chris-piekarski
chris-piekarski / create_gerrit_branch
Last active Dec 12, 2015
Create Gerrit branch from AOSP mirror
View create_gerrit_branch
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 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 / android_apk_location
Last active Dec 13, 2015
Get Android package (app) apk location
View android_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