Skip to content

Instantly share code, notes, and snippets.

Avatar

Christopher Piekarski chris-piekarski

View GitHub Profile
@chris-piekarski
chris-piekarski / android.uid.system
Created Mar 26, 2013
Run Android APK as system user
View android.uid.system
Manifest:
<manifest package="com.package"
android:sharedUserId="android.uid.system"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
Android.mk:
LOCAL_CERTIFICATE := platform
View android_win32_emulator_avd_ram_issue
C:\Users\<user>\.android\avd\<avd-profile-name>.avd\config.ini
Replace
hw.ramSize=1024
by
hw.ramSize=1024MB
Also, if you're seeing apps killed because of low memory increase VM Heap size to 64
@chris-piekarski
chris-piekarski / pypi_package_upload
Last active Dec 15, 2015
process for uploading new pypi package
View pypi_package_upload
python setup.py sdist --formats=gztar,zip
python setup.py sdist upload
Check/Add .pypirc file under user home dir ~/.pypirc
[distutils]
index-servers =
pypi
[pypi]
@chris-piekarski
chris-piekarski / gist:5339025
Created Apr 8, 2013
Override AOSP device network attributes for ConnectivityManager
View gist:5339025
frameworks/base/core/res/res/values/config.xml
<!-- This string array should be overridden by the device to present a list of network
attributes. This is used by the connectivity manager to decide which networks can coexist
based on the hardware -->
<!-- An Array of "[Connection name],[ConnectivityManager.TYPE_xxxx],
[associated radio-type],[priority],[restoral-timer(ms)],[dependencyMet] -->
<!-- the 5th element "resore-time" indicates the number of milliseconds to delay
before automatically restore the default connection. Set -1 if the connection
@chris-piekarski
chris-piekarski / resolve_gerrit_conficts
Last active Dec 16, 2015
Dealing w/Gerrit Conflicts
View resolve_gerrit_conficts
Need to flush out:
git checkout chrischanges
git pull https://tinfoil.blah.com/gerrit/platform/packages/apps/Settings refs/changes/12/112/1
git add src/com/blah/blah/Utils.java
git commit -a
git rebase --continue
git add src/com/blah/blah/Utils.java
git push ssh://cpiekarski@tinfoil.blah.com:29418/platform/packages/apps/Settings chrischanges:refs/for/balh/android-4.1.2_r1
@chris-piekarski
chris-piekarski / nc_port_forward
Last active Dec 16, 2015
nc port forward examples
View nc_port_forward
Will work once:
nc -l 0.0.0.0 6127
nc -l 6126 | nc 0.0.0.0 6127
wget http://0.0.0.0:6126
First 'nc -l' should hit.
@chris-piekarski
chris-piekarski / wrong_thread_exception
Created May 2, 2013
Android Views & CalledFromWrongThreadException
View wrong_thread_exception
#CalledFromWrongThreadException
#Views can only be executed on by the thread that created them. If your in a different thread you have to use
#the runOnUiThread method.
runOnUiThread(new Runnable() {
public void run() {
//stuff that updates ui
}
View ssh_cron_example
1 5 * * * /bin/bash -l -c -i "source $HOME/.keychain/chis-devpc-sh && /usr/bin/scp -vvv -F /home/chris/.ssh/config -i /home/chris/.ssh/id_rsa db:/var/apps/perch/shared/backups/\* /home/chris/ServerBackups/" > /home/chris/tmp/db_backup_copy_log.cron 2>&1
View android-4.1.2_r1_to_8.0.0_r36.rst
ipython
import rglob

android-1.6_r1.4

rglob.lcount("/home/chris/aosp_android-1.6_r1.4/", "*.java")
2687649
rglob.lcount("/home/chris/aosp_android-1.6_r1.4/", "*.cpp")
1994029
@chris-piekarski
chris-piekarski / logcat_phone_app
Created Jun 25, 2013
Get logcat buffer from phone app
View logcat_phone_app
private String getLogData(String level) {
Log.d(TAG, "Getting log data for level: "+level);
StringBuilder log = new StringBuilder();
try {
Process process = Runtime.getRuntime().exec("logcat -d");
BufferedReader bufferedReader = new BufferedReader(
new InputStreamReader(process.getInputStream()));
String line = "";