Skip to content

Instantly share code, notes, and snippets.

View vrunoa's full-sized avatar
:electron:
Se dice: A-TO-MICO

Bruno vrunoa

:electron:
Se dice: A-TO-MICO
View GitHub Profile
@vrunoa
vrunoa / gist:8a6a1240a913045ce8945489dce34936
Created November 15, 2021 18:35
video-to-gif-using-ffmpeg
ffmpeg -i video.mp4 -vf "fps=10,scale=1024:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" -loop 0 webdriver-test.gif
import json
import sys
import os
import re
import unittest
from appium import webdriver
from time import sleep
from os.path import basename
import os
from selenium.webdriver.support.ui import WebDriverWait
@vrunoa
vrunoa / gist:3f197ba6eb8c2ae81c99f86fd7736c46
Last active June 13, 2019 06:22
appium-getting-started
  1. Setup your local environment for Android local testing - max 45minutes

  2. Download https://developer.android.com/studio, go to command-line

  3. Setup env vars

export ANDROID_HOME="~/Library/Android/sdk"
export ANDROID_SDK_ROOT="~/Library/Android/sdk"
export ANDROID_AVD_HOME="~/.android/avd"
[Appium] Welcome to Appium v1.9.1
[Appium] Appium REST http interface listener started on 0.0.0.0:4723
[HTTP] --> POST /wd/hub/session
[HTTP] {"desiredCapabilities":{"browserName":"","appiumVersion":"1.8.1","deviceName":"Android GoogleApi Emulator","platformVersion":"8.0","launchTimeout":35000,"platformName":"Android","app":"http://appium.s3.amazonaws.com/ContactManager.apk","prevent-requeue":true,"name":"Basic android native test (Android GoogleApi Emulator on Android 8.0)","avdName":"O-phone-gms-portrait-appium","locale":"es_AR","language":"es"}}
[debug] [MJSONWP] Calling AppiumDriver.createSession() with args: [{"browserName":"","appiumVersion":"1.8.1","deviceName":"Android GoogleApi Emulator","platformVersion":"8.0","launchTimeout":35000,"platformName":"Android","app":"http://appium.s3.amazonaws.com/ContactManager.apk","prevent-requeue":true,"name":"Basic android native test (Android GoogleApi Emulator on Android 8.0)","avdName":"O-phone-gms-portrait-appium","locale":"es_AR","language":"es"},null,null]
[d
@vrunoa
vrunoa / virtualbox-vagrant-nuclear-option.sh
Created September 11, 2018 05:27 — forked from tjbenton/virtualbox-vagrant-nuclear-option.sh
Completely uninstall VirtualBox and Vagrant and reinstall through brew
# update brew because `brew update` is broken after updating to El Capitan
cd `brew --prefix`
git fetch origin
git reset --hard origin/master
sudo shutdown -r now # restart the computer
# open terminal and run the following
brew update
brew cleanup
@vrunoa
vrunoa / appium-unlock.log
Created January 24, 2017 16:50
Appium pattern unlock failing log
./node_modules/.bin/gulp transpile && ./node_modules/.bin/mocha --compilers js:babel-core/register -t 0 test/functional/driver-e2e-specs.js
[08:43:15] Using gulpfile ~/Sauce/appium-android-driver/gulpfile.js
[08:43:16] Starting 'transpile'...
[08:43:30] Finished 'transpile' after 15 s
createSession
dbug AndroidDriver AndroidDriver version: 1.10.39
WARN BaseDriver The following capabilities were provided, but are not recognized by appium: unlockType, unlockKey.
info BaseDriver Session created with session id: 9d026d3f-7402-4335-a28e-6f030a80770f
@vrunoa
vrunoa / processing.py
Created June 22, 2016 19:02
Converting android m4a to wav in python
for i, m4a_buffer in enumerate(m4a_buffers):
f = tempfile.NamedTemporaryFile(dir=voice_datadir, suffix="."+input_audio_extension, prefix="%s_%d"%(username,i), delete=True)
f.write(m4a_buffers[i])
f.seek(0, os.SEEK_END)
chunk = AudioSegment.from_file(f.name, "mp4")
chunk.export("%s_%d.wav"%(username,i), format="wav")
@vrunoa
vrunoa / chunkBuffer.java
Last active June 18, 2016 00:31
chunkBuffer.java
public byte[] chunk(ByteBuffer buffer) {
byte[] finalBuffer = new byte[buffer.limit()-buffer.remaining()];
ByteBuffer target = ByteBuffer.wrap(finalBuffer);
target.order(ByteOrder.LITTLE_ENDIAN);
target.put(buffer.array(), 0, buffer.position());
retur finalBuffer
}
@vrunoa
vrunoa / jniChar2jbyteArray.cpp
Last active August 25, 2022 15:12
Convertng char* to jbyteArray the right way
JNIEXPORT jbyteArray JNICALL Java_com_urucas_test_getframes(JNIEnv* env, jobject thiz) {
__android_log_write(ANDROID_LOG_INFO, "Test", "getting frames");
char* frame;
int len;
processor->getFrames(&frame, &len);
jbyteArray arr = env->NewByteArray(len);
env->SetByteArrayRegion(arr, 0, len, reinterpret_cast<jbyte*>(&frame));
delete processor;
return arr;
}
@vrunoa
vrunoa / jniTest.cpp
Last active June 3, 2016 21:42
cv::cvtColor fail
// trying to convert Luv image to BGR
JNIEXPORT jboolean JNICALL Java_com_test_run(JNIEnv* env, jobject thiz, jlong data) {
__android_log_write(ANDROID_LOG_INFO, "TEST", "run");
if(data == 0) {
__android_log_write(ANDROID_LOG_ERROR, "TEST", "empty jlong mat");
return false;
}