Skip to content

Instantly share code, notes, and snippets.

View calvarez-ov's full-sized avatar

Carmen Alvarez calvarez-ov

  • Paris, France
View GitHub Profile
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
@calvarez-ov
calvarez-ov / adbmonitorapp.bash
Created April 24, 2020 09:19
adb command to monitor if an application is running
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
@calvarez-ov
calvarez-ov / mp42gif.bash
Created September 2, 2016 14:00
mp4 to animated gif with brief blank screen between loops
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 / gist:fe04c21359007b98002f2a260e7ad992
Created May 31, 2016 10:25
copy a database file using adb
adb -d exec-out run-as com.example.app cat databases/db.db > /tmp/db.db
char *toto = "toto"
free(toto);
@calvarez-ov
calvarez-ov / mp4 to animated gif
Created February 22, 2016 17:00
Convert 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
@calvarez-ov
calvarez-ov / remove-unused-resources.sh
Last active February 16, 2016 16:42
Remove unused resources (drawables and layouts) from an Android project.
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