Skip to content

Instantly share code, notes, and snippets.

View paour's full-sized avatar

Pierre-Luc Paour paour

View GitHub Profile
@paour
paour / MyTrails.java
Created February 27, 2014 12:30
Easy send attachment via email
BufferedWriter bw = new BufferedWriter(new FileWriter(file));
bw.write(sb.toString());
bw.close();
Intent sendIntent = new Intent(Intent.ACTION_SEND);
sendIntent.putExtra(Intent.EXTRA_SUBJECT, "MyTrails state dump");
sendIntent.putExtra(Intent.EXTRA_EMAIL, new String[]{"support@frogsparks.com"});
sendIntent.putExtra(Intent.EXTRA_TEXT, "See attachment");
sendIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse("file://" + file.getAbsolutePath()));
sendIntent.setType("text/plain");
@paour
paour / shell dump
Last active August 29, 2015 13:57
Tasker CPU Control
root@m0:/ # which su
/system/bin/su
root@m0:/ # ls -la `which su`
lrwxrwxrwx root root 2014-02-12 10:02 su -> ../xbin/su
root@m0:/ # ls -la /system/app
-rw-r--r-- root root 1573262 2008-08-01 14:00 Apollo.apk
-rw-r--r-- root root 32941 2008-08-01 14:00 BasicDreams.apk
-rw-r--r-- root root 1951013 2008-08-01 14:00 Bluetooth.apk
-rw-r--r-- root root 154371 2008-08-01 14:00 BluetoothExt.apk
-rw-r--r-- root root 2645747 2008-08-01 14:00 Browser.apk
ACTION_ACCESSIBILITY_FOCUS]
06-14 09:07:46.465 13395-13395/com.lastpass.lpandroid E/AccessibilityNodeInfoCache﹕ Disconneced node: android.view.accessibility.AccessibilityNodeInfo@16d782; boundsInParent: Rect(541, 3 - 602, 35); boundsInScreen: Rect(389, -44 - 433, -21); packageName: mobi.mgeek.TunnyBrowser; className: android.view.View; text: null; contentDescription: SPORT Link; viewIdResName: null; checkable: false; checked: false; focusable: true; focused: false; selected: false; clickable: true; longClickable: false; enabled: true; password: false; scrollable: false; [ACTION_FOCUS, ACTION_CLICK, ACTION_ACCESSIBILITY_FOCUS]
06-14 09:07:46.465 13395-13395/com.lastpass.lpandroid E/AccessibilityNodeInfoCache﹕ Disconneced node: android.view.accessibility.AccessibilityNodeInfo@16d7c0; boundsInParent: Rect(601, 3 - 679, 35); boundsInScreen: Rect(432, -44 - 488, -21); packageName: mobi.mgeek.TunnyBrowser; className: android.view.View; text: null; contentDescription: SCIENCES Link; viewIdResName: null; checkable:
@paour
paour / gist:d817f930fa8675adf637
Created September 18, 2014 07:42
Keybase proof
### Keybase proof
I hereby claim:
* I am paour on github.
* I am paour (https://keybase.io/paour) on keybase.
* I have a public key whose fingerprint is A400 021D 4B81 9184 B98D 3F08 9615 F14C 0898 1094
To claim this, I am signing this object:
@paour
paour / gist:6342932505e1fd24ab2b
Created December 11, 2014 17:42
Genymotion N4 5.0.0 startup
12-11 17:36:49.006 0-95/? E/Minikin﹕ addFont failed to create font /system/fonts/NotoSansGujarati-Regular.ttf
12-11 17:36:49.009 0-95/? E/Minikin﹕ addFont failed to create font /system/fonts/NotoSansGujarati-Bold.ttf
12-11 17:36:49.030 0-95/? E/Minikin﹕ addFont failed to create font /system/fonts/NotoSansGujaratiUI-Regular.ttf
12-11 17:36:49.032 0-95/? E/Minikin﹕ addFont failed to create font /system/fonts/NotoSansGujaratiUI-Bold.ttf
12-11 17:36:49.043 0-95/? E/Minikin﹕ addFont failed to create font /system/fonts/NotoSansGurmukhi-Regular.ttf
12-11 17:36:49.052 0-95/? E/Minikin﹕ addFont failed to create font /system/fonts/NotoSansGurmukhi-Bold.ttf
12-11 17:36:49.055 0-95/? E/Minikin﹕ addFont failed to create font /system/fonts/NotoSansGurmukhiUI-Regular.ttf
12-11 17:36:49.059 0-95/? E/Minikin﹕ addFont failed to create font /system/fonts/NotoSansGurmukhiUI-Bold.ttf
12-11 17:36:49.625 0-95/? E/Minikin﹕ addFont failed to create font /system/f
@paour
paour / button_bar_layout.xml
Created April 11, 2012 06:16 — forked from romannurik/button_bar_layout.xml
How to make a proper button bar on ICS
<!--
A button bar is a set of buttons at the bottom of an activity.
An example is an AlertDialog with OK/Cancel buttons.
Note that something similar can be accomplished using a
split action bar and text-only action buttons, but this is an
alternate presentation that's often preferred.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
@paour
paour / AndroidManifest.xml
Last active January 3, 2016 14:28 — forked from cmelchior/AndroidManifest.xml
Prevent exceptions for cases like <string name="with_markup"><b>Warning</b>This will crash the build</string>
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.trifork.example"
android:installLocation="auto"
android:versionName="@string/client_info" >
<!-- ... -->
<application
android:hardwareAccelerated="true"
@paour
paour / gist:b2a69bc46e9cb34f455c
Created May 15, 2014 12:03
Gradle new manifest merge error
11:51:03.534 [INFO] [org.gradle.execution.taskgraph.AbstractTaskPlanExecutor] :processGoogleReleaseManifest (Thread[Daemon,5,main]) completed. Took 0.209 secs.
11:51:03.534 [DEBUG] [org.gradle.execution.taskgraph.AbstractTaskPlanExecutor] Task worker [Thread[Daemon,5,main]] finished, busy: 2.098 secs, idle: 0.021 secs
11:51:03.541 [ERROR] [org.gradle.BuildExceptionReporter]
11:51:03.545 [ERROR] [org.gradle.BuildExceptionReporter] FAILURE: Build failed with an exception.
11:51:03.546 [ERROR] [org.gradle.BuildExceptionReporter]
11:51:03.547 [ERROR] [org.gradle.BuildExceptionReporter] * What went wrong:
11:51:03.547 [ERROR] [org.gradle.BuildExceptionReporter] Execution failed for task ':processGoogleReleaseManifest'.
11:51:03.548 [ERROR] [org.gradle.BuildExceptionReporter] > No enum constant com.android.manifmerger.AttributeOperationType.IGNORE
11:51:03.553 [ERROR] [org.gradle.BuildExceptionReporter]
11:51:03.554 [ERROR] [org.gradle.BuildExceptionReporter] * Exception is:
@paour
paour / build_extras.gradle
Last active October 5, 2016 12:04
A simpler and more fool-proof way to handle search providers in Android Gradle builds
def overrideProviderAuthority(packageName, inFile, outFile) {
def xml = new XmlParser().parse(inFile)
xml.findAll{it.name() == 'string'}.each{item ->
if (!item.value().isEmpty() && item.value()[0] instanceof String && item.value()[0].startsWith(".res-auto")) {
item.value()[0] = item.value()[0].replace(".res-auto", packageName)
}
}
saveXML(outFile, xml)
package com.frogsparks.mytrails.util;
import android.os.Environment;
import com.frogsparks.mytrails.MyTrails;
import java.io.File;
import java.util.*;
// http://stackoverflow.com/a/15612964/304876