Skip to content

Instantly share code, notes, and snippets.


Christopher Piekarski chris-piekarski

View GitHub Profile
chris-piekarski / x11_ssh
Last active Aug 29, 2015
Headless Ubuntu X11 SSH Tunnel
View x11_ssh
On SSH server make sure the sshd config file contains "X11Forwarding yes" (/etc/ssh/sshd_config).
On the client add -X flag to ssh command ( ssh -X ). Then simply run X11 programs.
chris-piekarski / aosp_pid
Last active Aug 29, 2015
Android Process Pid
View aosp_pid
chris-piekarski / adb_aosp_content
Last active Apr 12, 2021
ADB Content Command
View adb_aosp_content
adb shell content delete --uri content://settings/settings/pointer_speed
adb shell content query --uri content://settings/settings
adb shell content insert --uri content://settings/secure --bind name:s:my_number --bind value:i:24
See "package;" in /frameworks/base/cmds/content/
Usese "final class ContentProviderProxy implements IContentProvider" in
chris-piekarski / android_wifi_status
Last active Aug 29, 2015
Properly control Android service state based on Wifi status
View android_wifi_status
private void registerConnectivityChange() {
BroadcastReceiver connectionReceiver = new BroadcastReceiver() {
public void onReceive(Context context, Intent intent) {
// When just using the ConnectivityManager you can get identical intents
// twice within one second. So we need to use the WifiManager & ConnectivityManager
// to determine true state
if (intent.getAction().equals(WifiManager.NETWORK_STATE_CHANGED_ACTION)) {
NetworkInfo networkInfo = intent
chris-piekarski / intent_package_name
Created Jan 22, 2014
Log package name of incoming Intent
View intent_package_name
import android.os.Binder;
import android.content.Intent;
class {
public void onReceive(Context context, Intent intent) {
Log.v(TAG, context.getPackageManager().getNameForUid(Binder.getCallingUid()));
View android_timezone_listener
public static void registerTimezoneListener() {
IntentFilter timezoneFilter = new IntentFilter(Intent.ACTION_TIMEZONE_CHANGED);
BroadcastReceiver timezoneReceiver = new BroadcastReceiver(){
public void onReceive(Context context, Intent intent){
Context.registerReceiver(timezoneReceiver, timezoneFilter);
chris-piekarski /
Last active Jan 2, 2016
How does Java try/catch/finally work?
package com.cpiekarski.helloworld;
* javac -d .
* java -cp . com.cpiekarski.helloworld.HelloWorldApp
chris-piekarski / android_cert_paths
Created Dec 18, 2013
Android Cert Paths
View android_cert_paths
String ANDROID_ROOT = System.getenv("ANDROID_ROOT");
String ANDROID_DATA = System.getenv("ANDROID_DATA");
CA_CERTS_DIR_SYSTEM = new File(ANDROID_ROOT + "/etc/security/cacerts");
CA_CERTS_DIR_ADDED = new File(ANDROID_DATA + "/misc/keychain/cacerts-added");
CA_CERTS_DIR_DELETED = new File(ANDROID_DATA + "/misc/keychain/cacerts-removed");
chris-piekarski / android_js_webview_proguard
Created Dec 11, 2013
Android Webview JavaScript and Proguard
View android_js_webview_proguard
In the project proguard-project.txt file see:
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
-keepclassmembers class {
public *;
View list_android_sensors
import android.hardware.SensorManager;
private SensorManager mSensorManager;
mSensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE);
List<Sensor> deviceSensors = mSensorManager.getSensorList(Sensor.TYPE_ALL);