This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void lcdPrintFloat( float val, byte precision) { | |
// prints val on a ver 0012 text lcd with number of decimal places determine by precision | |
// precision is a number from 0 to 6 indicating the desired decimial places | |
// example: lcdPrintFloat( 3.1415, 2); // prints 3.14 (two decimal places) | |
if(val < 0.0){ | |
lcd.print('-'); | |
val = -val; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Verifying that +patryk is my Bitcoin username. You can send me #bitcoin here: https://onename.io/patryk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#Get all of a directory(sdcard), and filter them | |
for file in `adb shell ls /sdcard/Pictures/Screenshots/ | grep .png` | |
do | |
file=`echo -e $file | tr -d "\r\n"`; | |
# create the directory to store the files in your filesystem | |
mkdir -p ~/fetched_screenshots |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static void assertIsColorClose(TextView label, int textColor) { | |
int currentTextColor = label.getCurrentTextColor(); | |
int currentRed = (currentTextColor >> 16) & 0xFF; | |
int currentGreen = (currentTextColor >> 8) & 0xFF; | |
int currentBlue = (currentTextColor >> 0) & 0xFF; | |
int expectedRed = (textColor >> 16) & 0xFF; | |
int expectedGreen = (textColor >> 8) & 0xFF; | |
int expectedBlue = (textColor >> 0) & 0xFF; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# -*- coding: iso-8859-15 -*- | |
import os | |
#Small script to change the names of the files | |
#containing dashes to replace them with underline | |
#Android asset manager cannot compile dashes, and | |
#sometimes it's easier to run the script than to | |
#bother designer to change. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function mytakescreenshoot() { | |
adb shell screencap -p | perl -pe 's/\x0D\x0A/\x0A/g' > screen.png sips -Z 640 screen.png | |
echo "Resized and saved in current folder as: screen.png" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class RootUtil { | |
public static boolean isDeviceRooted() { | |
return checkRootMethod1() || checkRootMethod2() || checkRootMethod3(); | |
} | |
private static boolean checkRootMethod1() { | |
String buildTags = android.os.Build.TAGS; | |
return buildTags != null && buildTags.contains("test-keys"); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//unity slow mode | |
public void enableSlowMode() | |
{ | |
Time.timeScale=0.3f; | |
Time.fixedDeltaTime = 0.02f * Time.timeScale; | |
if(audio.isPlaying == false) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected static void doSetListViewHeightBasedOnChildren(ListView listView, int extraPixels) { | |
if (null != listView) { | |
final ListAdapter listAdapter = listView.getAdapter(); | |
if (null != listAdapter) { | |
int totalHeight = 0, desiredWidth = View.MeasureSpec.makeMeasureSpec(listView.getWidth(), View.MeasureSpec.AT_MOST); | |
for (int i = listAdapter.getCount(); --i >= 0; ) { | |
View listItem = listAdapter.getView(i, null, listView); | |
listItem.measure(desiredWidth, View.MeasureSpec.UNSPECIFIED); | |
totalHeight += listItem.getMeasuredHeight(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void addLinks(TextView view, String url) { | |
if (null != view && null != url) { | |
view.setLinksClickable(true); | |
view.setMovementMethod(LinkMovementMethod.getInstance()); | |
String template = "<a href='{0}'>{1}</a>"; | |
String finalText = format(template, url, TextUtils.htmlEncode(view.getText().toString())); | |
view.setText(Html.fromHtml(finalText)); | |
} else { | |
if (kcDebug.isDebuggingOn) { |
OlderNewer