Skip to content

Instantly share code, notes, and snippets.

Avatar

Carmen Alvarez calvarez-ov

View GitHub Profile
@calvarez-ov
calvarez-ov / remove-unused-resources.sh
Last active Feb 16, 2016
Remove unused resources (drawables and layouts) from an Android project.
View remove-unused-resources.sh
remove_unused_resources() {
TAG=$1 # Just for logging
RESOURCE_PATH=$2
EXTENSION=$3
echo
echo $TAG
for file in $RESOURCE_PATH*/*.$EXTENSION
do
# strip the extension
@calvarez-ov
calvarez-ov / mp4 to animated gif
Created Feb 22, 2016
Convert mp4 to animated gif
View mp4 to animated gif
ffmpeg -y -i input.mp4 -vf fps=10,scale=320:-1:flags=lanczos,palettegen palette.png
ffmpeg -i input.mp4 -i palette.png -filter_complex "fps=10,scale=320:-1:flags=lanczos[x];[x][1:v]paletteuse" output.gif
View gist:fe04c21359007b98002f2a260e7ad992
adb -d exec-out run-as com.example.app cat databases/db.db > /tmp/db.db
@calvarez-ov
calvarez-ov / mp42gif.bash
Created Sep 2, 2016
mp4 to animated gif with brief blank screen between loops
View mp42gif.bash
inputfile=$1
ffmpeg -y -i $inputfile -vf fps=10,scale=320:-1:flags=lanczos,palettegen /tmp/palette.png
ffmpeg -i $inputfile -i /tmp/palette.png -filter_complex "fps=10,scale=320:-1:flags=lanczos[x];[x][1:v]paletteuse" /tmp/temp.gif
convert /tmp/temp.gif -alpha Opaque +level-colors Black -flatten /tmp/black.png
convert /tmp/temp.gif -delay 50 /tmp/black.png /tmp/output.gif
@calvarez-ov
calvarez-ov / adbmonitorapp.bash
Created Apr 24, 2020
adb command to monitor if an application is running
View adbmonitorapp.bash
APPLICATION_ID=$1
while [ 1 ];
do processid=`adb -d shell ps |egrep $APPLICATION_ID|sed -e 's/^[^ ]* *\([0-9]*\) .*$/\1/'`
echo -n "$processid."
sleep 1
done
View stripe.kt
public override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
if (resultCode != Activity.RESULT_CANCELED) {
if (data != null) {
stripe.onPaymentResult(requestCode, data, callback =
object : ApiResultCallback<PaymentIntentResult> {
override fun onError(e: Exception) {
// show error popup