Skip to content

Instantly share code, notes, and snippets.

View MrThiago's full-sized avatar
:octocat:
Flat Data...

Thiago MrThiago

:octocat:
Flat Data...
View GitHub Profile
@MrThiago
MrThiago / adb-get-serialno
Created April 30, 2018 10:15
How to get Android device Serial Number Via ADB
adb shell getprop | grep ro.boot.serialno
@MrThiago
MrThiago / TipCalculator.py
Created December 26, 2020 16:25
Tip and Bill split Calculator
print("Tip and Bill Calculator")
bill = float(input("What is the total bill?\n"))
tip = int(input("What percentage tip would you like to give: 10, 12, 15 or 20?\n"))
people = int(input("How many people to split the bill?\n"))
# Get the percentage
tip_percentage = tip / 100
# The the tip amount
print("I will tell you how days, weeks and months you have left, if you were to live until 90 years old.\n")
age = int(input("How old are you? \n"))
years_left = 90 - age
days_left = years_left * 365
weeks_left = years_left * 52
months_left = years_left * 12
print(f"You have {days_left} days, {weeks_left} weeks and {months_left} months left.")
@MrThiago
MrThiago / androidAdbTips
Last active May 4, 2020 00:44
Android Device Screenshot using ADB
Screen print
adb shell screencap -p | perl -pe 's/\x0D\x0A/\x0A/g' > screen.png
Screen recording
adb shell screenrecord /sdcard/example.mp4
:Desktop user$ adb pull /sdcard/example.mp4
@MrThiago
MrThiago / android-set-reset-status-bar-color
Created May 7, 2018 03:36
How to set and reset status bar color in android
// Change the status bar color => REQUIRES API 21 and above
private static int defaultStatusBarColor;
public static void changeStatusBarColor(Activity context, boolean change, int color){
if (Build.VERSION.SDK_INT >= 21)
{
Window window = context.getWindow();
window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
@MrThiago
MrThiago / batchImageRename
Created April 25, 2018 01:45
Shell batch rename
Remane as removing (_iphone)
for i in *.png ; do mv "$i" "${i/_iphone*.png/.png}" ; done
Rename adding (android_)
for file in images*.png; do mv "$file" "android_$file"; done
@MrThiago
MrThiago / disableAutoScroll
Created April 25, 2018 01:43
How to Disable auto-scroll after load in Android
# Adding the "descendantFocusability" attribute to the ScrollView's containing LinearLayout
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:descendantFocusability="blocksDescendants" >
@MrThiago
MrThiago / MergeImages
Created April 25, 2018 01:41
MAC combine two images into one
convert +append image_1.png image_2.png new_image_conbined.png
@MrThiago
MrThiago / images2android.sh
Created February 8, 2018 06:59 — forked from Arood/images2android.sh
Convert iPhone-resources to Android (for Titanium)
type mogrify >/dev/null 2>&1 || { echo >&2 "» This script requires mogrify. Please install ImageMagick first!"; exit 1; }
rm -rf Resources/android/images
mkdir Resources/android/images
mkdir Resources/android/images/res-xhdpi
mkdir Resources/android/images/res-mdpi
echo " » Copying the splash screen"
cp Resources/iphone/Default.png Resources/android/images/res-mdpi/default.png
cp Resources/iphone/Default@2x.png Resources/android/images/res-xhdpi/default.png
@MrThiago
MrThiago / 1MarkerAnimation.java
Created June 16, 2016 08:24 — forked from broady/1MarkerAnimation.java
Animating Markers
/* Copyright 2013 Google Inc.
Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0.html */
package com.example.latlnginterpolation;
import android.animation.ObjectAnimator;
import android.animation.TypeEvaluator;
import android.animation.ValueAnimator;
import android.annotation.TargetApi;
import android.os.Build;